The expression return array_search($tar..., $this->classes, true) could return the type false|string which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
26
}
27
28
/**
29
* @return mixed
30
*/
31
protected function predictSample(array $sample)
32
{
33
$output = $this->setInput($sample)->getOutput();
34
35
$predictedClass = null;
36
$max = 0;
37
foreach ($output as $class => $value) {
38
if ($value > $max) {
39
$predictedClass = $class;
40
$max = $value;
41
}
42
}
43
44
return $predictedClass;
45
}
46
47
/**
48
* @param mixed $target
49
*/
50
protected function trainSample(array $sample, $target): void