mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-01-24 23:58:24 +00:00
rename exception named constructor name
This commit is contained in:
parent
ded28def2d
commit
b04cf220bd
@ -27,7 +27,7 @@ class ArrayDataset implements Dataset
|
||||
public function __construct(array $samples, array $labels)
|
||||
{
|
||||
if (count($samples) != count($labels)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$this->samples = $samples;
|
||||
|
@ -9,9 +9,9 @@ class InvalidArgumentException extends \Exception
|
||||
/**
|
||||
* @return InvalidArgumentException
|
||||
*/
|
||||
public static function sizeNotMatch()
|
||||
public static function arraySizeNotMatch()
|
||||
{
|
||||
return new self('Size of given arguments not match');
|
||||
return new self('Size of given arrays not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ class Accuracy
|
||||
public static function score(array $actualLabels, array $predictedLabels, bool $normalize = true)
|
||||
{
|
||||
if (count($actualLabels) != count($predictedLabels)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$score = 0;
|
||||
|
@ -20,7 +20,7 @@ class Chebyshev implements Distance
|
||||
public function distance(array $a, array $b): float
|
||||
{
|
||||
if (count($a) !== count($b)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$differences = [];
|
||||
|
@ -20,7 +20,7 @@ class Euclidean implements Distance
|
||||
public function distance(array $a, array $b): float
|
||||
{
|
||||
if (count($a) !== count($b)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$distance = 0;
|
||||
|
@ -20,7 +20,7 @@ class Manhattan implements Distance
|
||||
public function distance(array $a, array $b): float
|
||||
{
|
||||
if (count($a) !== count($b)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$distance = 0;
|
||||
|
@ -33,7 +33,7 @@ class Minkowski implements Distance
|
||||
public function distance(array $a, array $b): float
|
||||
{
|
||||
if (count($a) !== count($b)) {
|
||||
throw InvalidArgumentException::sizeNotMatch();
|
||||
throw InvalidArgumentException::arraySizeNotMatch();
|
||||
}
|
||||
|
||||
$distance = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user