src/Phpml/Math/Statistic/Covariance.php 1 location
|
@@ 136-138 (lines=3) @@
|
| 133 |
|
|
| 134 |
|
if ($means === null) { |
| 135 |
|
$means = []; |
| 136 |
|
for ($i=0; $i < $n; $i++) { |
| 137 |
|
$means[] = Mean::arithmetic(array_column($data, $i)); |
| 138 |
|
} |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
$cov = []; |
src/Phpml/DimensionReduction/PCA.php 1 location
|
@@ 89-92 (lines=4) @@
|
| 86 |
|
{ |
| 87 |
|
// Calculate means for each dimension |
| 88 |
|
$this->means = []; |
| 89 |
|
for ($i=0; $i < $n; $i++) { |
| 90 |
|
$column = array_column($data, $i); |
| 91 |
|
$this->means[] = Mean::arithmetic($column); |
| 92 |
|
} |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
/** |