Skip to content

Commit 85d7d4b

Browse files
committed
Appease Stan
1 parent c1bede9 commit 85d7d4b

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

src/Classifiers/SVC.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ public function predictSample(array $sample) : string
237237
}
238238

239239
$sampleWithOffset = [];
240-
foreach($sample as $key=>$value){
241-
$sampleWithOffset[$key+1] = $value;
240+
241+
foreach ($sample as $key => $value) {
242+
$sampleWithOffset[$key + 1] = $value;
242243
}
243244

244245
$index = $this->model->predict($sampleWithOffset);

src/Regressors/SVR.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,11 @@ public function predictSample(array $sample)
237237
}
238238
//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
239239
$sampleWithOffset = [];
240-
foreach($sample as $key=>$value){
241-
$sampleWithOffset[$key+1] = $value;
240+
241+
foreach ($sample as $key => $value) {
242+
$sampleWithOffset[$key + 1] = $value;
242243
}
244+
243245
return $this->model->predict($sampleWithOffset);
244246
}
245247

src/Transformers/ImageResizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public function resize(array &$sample) : void
9292
{
9393
foreach ($sample as &$value) {
9494
if (DataType::detect($value)->isImage()) {
95-
$width = imagesx($value) ?: 0;
96-
$height = imagesy($value) ?: 0;
95+
$width = imagesx($value);
96+
$height = imagesy($value);
9797

9898
if ($width === $this->width and $height === $this->height) {
9999
continue;

src/Transformers/ImageVectorizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function fit(Dataset $dataset) : void
9191
$value = $sample[$column];
9292

9393
$this->sizes[$column] = [
94-
imagesx($value) ?: 0,
95-
imagesy($value) ?: 0,
94+
imagesx($value),
95+
imagesy($value),
9696
];
9797
}
9898
}

tests/Regressors/SVRTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SVRTest extends TestCase
4343
*
4444
* @var float
4545
*/
46-
protected const MIN_SCORE = -INF;
46+
protected const MIN_SCORE = 0.9;
4747

4848
/**
4949
* Constant used to see the random number generator.

0 commit comments

Comments
 (0)