| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class MLPClassifier extends MultilayerPerceptron implements Classifier |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param mixed $target |
||
| 14 | * |
||
| 15 | * @throws InvalidArgumentException |
||
| 16 | */ |
||
| 17 | public function getTargetClass($target): int |
||
| 18 | { |
||
| 19 | if (!in_array($target, $this->classes, true)) { |
||
| 20 | throw new InvalidArgumentException( |
||
| 21 | sprintf('Target with value "%s" is not part of the accepted classes', $target) |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | return array_search($target, $this->classes, true); |
||
|
|
|||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | protected function predictSample(array $sample) |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param mixed $target |
||
| 49 | */ |
||
| 50 | protected function trainSample(array $sample, $target): void |
||
| 59 |