mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-26 14:56:28 +00:00
force implementation of protected functon in Predictable trait
This commit is contained in:
parent
b04cf220bd
commit
d9d7895947
@ -44,7 +44,7 @@ class KNearestNeighbors implements Classifier
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function predictSample(array $sample)
|
protected function predictSample(array $sample)
|
||||||
{
|
{
|
||||||
$distances = $this->kNeighborsDistances($sample);
|
$distances = $this->kNeighborsDistances($sample);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class NaiveBayes implements Classifier
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function predictSample(array $sample)
|
protected function predictSample(array $sample)
|
||||||
{
|
{
|
||||||
$predictions = [];
|
$predictions = [];
|
||||||
foreach ($this->labels as $index => $label) {
|
foreach ($this->labels as $index => $label) {
|
||||||
|
@ -24,4 +24,11 @@ trait Predictable
|
|||||||
|
|
||||||
return $predicted;
|
return $predicted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $sample
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
abstract protected function predictSample(array $sample);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user