Skip to content

Commit

Permalink
Update SVR.php (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisAUTHIE committed Aug 30, 2024
1 parent 65251d9 commit c1bede9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Regressors/SVR.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,12 @@ public function predictSample(array $sample)
if (!$this->model) {
throw new RuntimeException('Estimator has not been trained.');
}

return $this->model->predict($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;
}
return $this->model->predict($sampleWithOffset);
}

/**
Expand Down

0 comments on commit c1bede9

Please sign in to comment.