mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-01-26 08:38:32 +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)
|
public function __construct(array $samples, array $labels)
|
||||||
{
|
{
|
||||||
if (count($samples) != count($labels)) {
|
if (count($samples) != count($labels)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->samples = $samples;
|
$this->samples = $samples;
|
||||||
|
@ -9,9 +9,9 @@ class InvalidArgumentException extends \Exception
|
|||||||
/**
|
/**
|
||||||
* @return InvalidArgumentException
|
* @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)
|
public static function score(array $actualLabels, array $predictedLabels, bool $normalize = true)
|
||||||
{
|
{
|
||||||
if (count($actualLabels) != count($predictedLabels)) {
|
if (count($actualLabels) != count($predictedLabels)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$score = 0;
|
$score = 0;
|
||||||
|
@ -20,7 +20,7 @@ class Chebyshev implements Distance
|
|||||||
public function distance(array $a, array $b): float
|
public function distance(array $a, array $b): float
|
||||||
{
|
{
|
||||||
if (count($a) !== count($b)) {
|
if (count($a) !== count($b)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$differences = [];
|
$differences = [];
|
||||||
|
@ -20,7 +20,7 @@ class Euclidean implements Distance
|
|||||||
public function distance(array $a, array $b): float
|
public function distance(array $a, array $b): float
|
||||||
{
|
{
|
||||||
if (count($a) !== count($b)) {
|
if (count($a) !== count($b)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$distance = 0;
|
$distance = 0;
|
||||||
|
@ -20,7 +20,7 @@ class Manhattan implements Distance
|
|||||||
public function distance(array $a, array $b): float
|
public function distance(array $a, array $b): float
|
||||||
{
|
{
|
||||||
if (count($a) !== count($b)) {
|
if (count($a) !== count($b)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$distance = 0;
|
$distance = 0;
|
||||||
|
@ -33,7 +33,7 @@ class Minkowski implements Distance
|
|||||||
public function distance(array $a, array $b): float
|
public function distance(array $a, array $b): float
|
||||||
{
|
{
|
||||||
if (count($a) !== count($b)) {
|
if (count($a) !== count($b)) {
|
||||||
throw InvalidArgumentException::sizeNotMatch();
|
throw InvalidArgumentException::arraySizeNotMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$distance = 0;
|
$distance = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user