diff --git a/src/Classifiers/SVC.php b/src/Classifiers/SVC.php index beea2d540..8fe04fb2f 100644 --- a/src/Classifiers/SVC.php +++ b/src/Classifiers/SVC.php @@ -237,8 +237,9 @@ public function predictSample(array $sample) : string } $sampleWithOffset = []; - foreach($sample as $key=>$value){ - $sampleWithOffset[$key+1] = $value; + + foreach ($sample as $key => $value) { + $sampleWithOffset[$key + 1] = $value; } $index = $this->model->predict($sampleWithOffset); diff --git a/src/Regressors/SVR.php b/src/Regressors/SVR.php index 05d90c615..1d5e8bc24 100644 --- a/src/Regressors/SVR.php +++ b/src/Regressors/SVR.php @@ -237,9 +237,11 @@ public function predictSample(array $sample) } //As SVM needs to have the same keys and order between training samples and those to predict we need to put an offset to the keys $sampleWithOffset = []; - foreach($sample as $key=>$value){ - $sampleWithOffset[$key+1] = $value; + + foreach ($sample as $key => $value) { + $sampleWithOffset[$key + 1] = $value; } + return $this->model->predict($sampleWithOffset); } diff --git a/src/Transformers/ImageResizer.php b/src/Transformers/ImageResizer.php index b9bd48e3e..a97694491 100644 --- a/src/Transformers/ImageResizer.php +++ b/src/Transformers/ImageResizer.php @@ -92,8 +92,8 @@ public function resize(array &$sample) : void { foreach ($sample as &$value) { if (DataType::detect($value)->isImage()) { - $width = imagesx($value) ?: 0; - $height = imagesy($value) ?: 0; + $width = imagesx($value); + $height = imagesy($value); if ($width === $this->width and $height === $this->height) { continue; diff --git a/src/Transformers/ImageVectorizer.php b/src/Transformers/ImageVectorizer.php index 564bbb296..9a130a7a6 100644 --- a/src/Transformers/ImageVectorizer.php +++ b/src/Transformers/ImageVectorizer.php @@ -91,8 +91,8 @@ public function fit(Dataset $dataset) : void $value = $sample[$column]; $this->sizes[$column] = [ - imagesx($value) ?: 0, - imagesy($value) ?: 0, + imagesx($value), + imagesy($value), ]; } } diff --git a/tests/Regressors/SVRTest.php b/tests/Regressors/SVRTest.php index 2710d0b61..af7f29db5 100644 --- a/tests/Regressors/SVRTest.php +++ b/tests/Regressors/SVRTest.php @@ -43,7 +43,7 @@ class SVRTest extends TestCase * * @var float */ - protected const MIN_SCORE = -INF; + protected const MIN_SCORE = 0.9; /** * Constant used to see the random number generator.