| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 70 | private function predictSample(array $sample) |
||
| 71 | { |
||
| 72 | $distances = $this->kNeighborsDistances($sample); |
||
| 73 | |||
| 74 | $predictions = array_combine(array_values($this->labels), array_fill(0, count($this->labels), 0)); |
||
| 75 | |||
| 76 | foreach ($distances as $index => $distance) { |
||
| 77 | ++$predictions[$this->labels[$index]]; |
||
| 78 | } |
||
| 79 | |||
| 80 | arsort($predictions); |
||
| 81 | reset($predictions); |
||
| 82 | |||
| 83 | return key($predictions); |
||
| 84 | } |
||
| 85 | |||
| 106 |