Skip to content

Commit

Permalink
Appease Stan
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Aug 31, 2024
1 parent c1bede9 commit 85d7d4b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/Classifiers/SVC.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/Regressors/SVR.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Transformers/ImageResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Transformers/ImageVectorizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
];
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Regressors/SVRTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 85d7d4b

Please sign in to comment.