From 2a07830bb690c9c6edcac34fa9f0d64d8bf53913 Mon Sep 17 00:00:00 2001 From: Louis AUTHIE <65625876+LouisAUTHIE@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:19:25 +0200 Subject: [PATCH] Update SVC.php --- src/Classifiers/SVC.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Classifiers/SVC.php b/src/Classifiers/SVC.php index f8d1bece1..beea2d540 100644 --- a/src/Classifiers/SVC.php +++ b/src/Classifiers/SVC.php @@ -236,7 +236,12 @@ public function predictSample(array $sample) : string throw new RuntimeException('Estimator has not been trained.'); } - $index = $this->model->predict($sample); + $sampleWithOffset = []; + foreach($sample as $key=>$value){ + $sampleWithOffset[$key+1] = $value; + } + + $index = $this->model->predict($sampleWithOffset); return $this->classes[$index]; }