Skip to content

Commit

Permalink
replace mean calls
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Apr 27, 2016
1 parent 80a712e commit 52cbda0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Phpml/Math/Statistic/Correlation.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static function pearson(array $x, array $y)
}

$count = count($x);
$meanX = array_sum($x) / $count;
$meanY = array_sum($y) / $count;
$meanX = Mean::arithmetic($x);
$meanY = Mean::arithmetic($y);

$axb = 0;
$a2 = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Phpml/Math/Statistic/StandardDeviation.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function population(array $a, $sample = true)
throw InvalidArgumentException::arraySizeToSmall(2);
}

$mean = array_sum($a) / $n;
$mean = Mean::arithmetic($a);
$carry = 0.0;
foreach ($a as $val) {
$d = $val - $mean;
Expand Down

0 comments on commit 52cbda0

Please sign in to comment.