mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-22 04:55:10 +00:00
Fix 'toSmall' typo (#234)
This commit is contained in:
parent
451f84c2e6
commit
6ac61a860c
@ -23,7 +23,7 @@ class InvalidArgumentException extends Exception
|
|||||||
return new self('The array has zero elements');
|
return new self('The array has zero elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function arraySizeToSmall(int $minimumSize = 2): self
|
public static function arraySizeTooSmall(int $minimumSize = 2): self
|
||||||
{
|
{
|
||||||
return new self(sprintf('The array must have at least %d elements', $minimumSize));
|
return new self(sprintf('The array must have at least %d elements', $minimumSize));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ final class ANOVA
|
|||||||
{
|
{
|
||||||
$classes = count($samples);
|
$classes = count($samples);
|
||||||
if ($classes < 2) {
|
if ($classes < 2) {
|
||||||
throw InvalidArgumentException::arraySizeToSmall(2);
|
throw InvalidArgumentException::arraySizeTooSmall(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$samplesPerClass = array_map(function (array $class): int {
|
$samplesPerClass = array_map(function (array $class): int {
|
||||||
|
@ -21,7 +21,7 @@ class Covariance
|
|||||||
|
|
||||||
$n = count($x);
|
$n = count($x);
|
||||||
if ($sample && $n === 1) {
|
if ($sample && $n === 1) {
|
||||||
throw InvalidArgumentException::arraySizeToSmall(2);
|
throw InvalidArgumentException::arraySizeTooSmall(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($meanX === null) {
|
if ($meanX === null) {
|
||||||
@ -59,7 +59,7 @@ class Covariance
|
|||||||
|
|
||||||
$n = count($data);
|
$n = count($data);
|
||||||
if ($sample && $n === 1) {
|
if ($sample && $n === 1) {
|
||||||
throw InvalidArgumentException::arraySizeToSmall(2);
|
throw InvalidArgumentException::arraySizeTooSmall(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i < 0 || $k < 0 || $i >= $n || $k >= $n) {
|
if ($i < 0 || $k < 0 || $i >= $n || $k >= $n) {
|
||||||
|
@ -20,7 +20,7 @@ class StandardDeviation
|
|||||||
$n = count($numbers);
|
$n = count($numbers);
|
||||||
|
|
||||||
if ($sample && $n === 1) {
|
if ($sample && $n === 1) {
|
||||||
throw InvalidArgumentException::arraySizeToSmall(2);
|
throw InvalidArgumentException::arraySizeTooSmall(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mean = Mean::arithmetic($numbers);
|
$mean = Mean::arithmetic($numbers);
|
||||||
|
@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class RandomSplitTest extends TestCase
|
class RandomSplitTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testThrowExceptionOnToSmallTestSize(): void
|
public function testThrowExceptionOnTooSmallTestSize(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
new RandomSplit(new ArrayDataset([], []), 0);
|
new RandomSplit(new ArrayDataset([], []), 0);
|
||||||
|
@ -32,7 +32,7 @@ final class ANOVATest extends TestCase
|
|||||||
self::assertEquals([0.6, 2.4, 1.24615385], ANOVA::oneWayF($samples), '', 0.00000001);
|
self::assertEquals([0.6, 2.4, 1.24615385], ANOVA::oneWayF($samples), '', 0.00000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testThrowExceptionOnToSmallSamples(): void
|
public function testThrowExceptionOnTooSmallSamples(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
$samples = [
|
$samples = [
|
||||||
|
@ -73,7 +73,7 @@ class CovarianceTest extends TestCase
|
|||||||
Covariance::fromXYArrays([1, 2, 3], []);
|
Covariance::fromXYArrays([1, 2, 3], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testThrowExceptionOnToSmallArrayIfSample(): void
|
public function testThrowExceptionOnTooSmallArrayIfSample(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
Covariance::fromXYArrays([1], [2], true);
|
Covariance::fromXYArrays([1], [2], true);
|
||||||
@ -85,7 +85,7 @@ class CovarianceTest extends TestCase
|
|||||||
Covariance::fromDataset([], 0, 1);
|
Covariance::fromDataset([], 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testThrowExceptionOnToSmallDatasetIfSample(): void
|
public function testThrowExceptionOnTooSmallDatasetIfSample(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
Covariance::fromDataset([1], 0, 1);
|
Covariance::fromDataset([1], 0, 1);
|
||||||
|
@ -32,7 +32,7 @@ class StandardDeviationTest extends TestCase
|
|||||||
StandardDeviation::population([], false);
|
StandardDeviation::population([], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testThrowExceptionOnToSmallArray(): void
|
public function testThrowExceptionOnTooSmallArray(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
StandardDeviation::population([1]);
|
StandardDeviation::population([1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user