Skip to content

Commit

Permalink
Update SVR.php
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisAUTHIE authored Aug 27, 2024
1 parent fef1033 commit 146a0c8
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 146a0c8

Please sign in to comment.