Fix error bugs

This commit is contained in:
Dennis Eichhorn 2018-02-23 17:55:17 +01:00
parent e97bd27eb0
commit 03208332ae
3 changed files with 6 additions and 6 deletions

View File

@ -258,7 +258,7 @@ class Functions
$squared = [];
foreach ($values as $value) {
$squared[] = $value * $exp;
$squared[] = $value ** $exp;
}
return $squared;
@ -280,7 +280,7 @@ class Functions
$squared = [];
foreach ($values as $value) {
$squared[] = $value * $exp;
$squared[] = $value ** $exp;
}
return $squared;

View File

@ -111,7 +111,7 @@ class Error
*/
public static function getMeanAbsoulteError(array $errors) : float
{
return Average::arithmeticMean(Functions::abs($errors));
return MeasureOfDispersion::meanAbsoluteDeviation($errors);
}
/**
@ -125,7 +125,7 @@ class Error
*/
public static function getMeanSquaredError(array $errors) : float
{
return Average::arithmeticMean(Functions::powerInt($errors, 2));
return MeasureOfDispersion::squaredMeanDeviation($errors);
}
/**

View File

@ -74,7 +74,7 @@ class FunctionsTest extends \PHPUnit\Framework\TestCase
self::assertEquals([4, 9, 16], Functions::powerInt([2, 3, 4], 2));
self::assertEquals([8, 27, 64], Functions::powerInt([2, 3, 4], 3));
self::assertEquals([2, 3, 8], Functions::powerFloat([4, 9, 16], 1/2), '', 0.0);
self::assertEquals([2, 3, 8], Functions::powerFloat([8, 27, 64], 1/3), '', 0.0);
self::assertEquals([2.0, 3.0, 4.0], Functions::powerFloat([4, 9, 16], 1/2), '', 0.0);
self::assertEquals([2.0, 3.0, 4.0], Functions::powerFloat([8, 27, 64], 1/3), '', 0.0);
}
}