Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | protected function predictSample(array $sample) |
||
46 | { |
||
47 | $distances = $this->kNeighborsDistances($sample); |
||
48 | $predictions = (array) array_combine(array_values($this->targets), array_fill(0, count($this->targets), 0)); |
||
49 | |||
50 | foreach (array_keys($distances) as $index) { |
||
51 | ++$predictions[$this->targets[$index]]; |
||
52 | } |
||
53 | |||
54 | arsort($predictions); |
||
55 | reset($predictions); |
||
56 | |||
57 | return key($predictions); |
||
58 | } |
||
76 |