���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/Aem/lib/mlbackend/php/phpml/src/Phpml/Classification/MLPClassifier.php
���ѧ٧ѧ�
<?php declare(strict_types=1); namespace Phpml\Classification; use Phpml\Exception\InvalidArgumentException; use Phpml\NeuralNetwork\Network\MultilayerPerceptron; class MLPClassifier extends MultilayerPerceptron implements Classifier { /** * @param mixed $target * * @throws InvalidArgumentException */ public function getTargetClass($target): int { if (!in_array($target, $this->classes, true)) { throw new InvalidArgumentException( sprintf('Target with value "%s" is not part of the accepted classes', $target) ); } return array_search($target, $this->classes, true); } /** * @return mixed */ protected function predictSample(array $sample) { $output = $this->setInput($sample)->getOutput(); $predictedClass = null; $max = 0; foreach ($output as $class => $value) { if ($value > $max) { $predictedClass = $class; $max = $value; } } return $predictedClass; } /** * @param mixed $target */ protected function trainSample(array $sample, $target): void { // Feed-forward. $this->setInput($sample); // Back-propagate. $this->backpropagation->backpropagate($this->getLayers(), $this->getTargetClass($target)); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�