상속: implements ArrayAccess, implements JsonSerializable
예제 #1
0
 /**
  * Regression Leverages
  * A measure of how far away the independent variable values of an observation are from those of the other observations.
  * https://en.wikipedia.org/wiki/Leverage_(statistics)
  *
  * Leverage score for the i-th data unit is defined as:
  * hᵢᵢ = [H]ᵢᵢ
  * which is the i-th diagonal element of the project matrix H,
  * where H = X⟮XᵀX⟯⁻¹Xᵀ where X is the design matrix.
  *
  * @return array
  */
 public function leverages() : array
 {
     return $this->reg_P->getDiagonalElements();
 }
예제 #2
0
 /**
  * Augment a matrix from below
  * An augmented matrix is a matrix obtained by appending the rows of two given matrices
  *
  *     [1, 2, 3]
  * A = [2, 3, 4]
  *     [3, 4, 5]
  *
  * B = [4, 5, 6]
  *
  *         [1, 2, 3]
  * (A_B) = [2, 3, 4]
  *         [3, 4, 5]
  *         [4, 5, 6]
  *
  * @param  Matrix $B Matrix rows to add to matrix A
  *
  * @return Matrix
  *
  * @throws MatrixException if matrices do not have the same number of columns
  */
 public function augmentBelow(Matrix $B) : Matrix
 {
     if ($B->getN() !== $this->n) {
         throw new Exception\MatrixException('Matrices to augment do not have the same number of columns');
     }
     $⟮A∣B⟯ = array_merge($this->A, $B->getMatrix());
     return MatrixFactory::create($⟮A∣B⟯);
 }