MonoLayer Perceptron
All checks were successful
linter / quality (push) Successful in 6m16s
tests / ci (8.4) (push) Successful in 4m10s
tests / ci (8.5) (push) Successful in 4m29s

This commit is contained in:
2026-04-04 16:45:04 +02:00
parent f6620c2eca
commit 2f4db07918
21 changed files with 641 additions and 226 deletions

View File

@@ -66,7 +66,7 @@ class ADALINEPerceptronTraining extends NetworkTraining
foreach ($inputsForCurrentEpoch as $inputsWithLabel) {
$inputs = array_slice($inputsWithLabel, 0, -1);
$correctOutput = (float) end($inputsWithLabel);
$output = $this->perceptron->test($inputs);
$output = $this->perceptron->test($inputs)[0];
$iterationError = $correctOutput - $output;
$this->epochError += ($iterationError ** 2) / 2; // Squared error for the example
}
@@ -92,7 +92,7 @@ class ADALINEPerceptronTraining extends NetworkTraining
private function iterationFunction(array $inputs, float $correctOutput): float
{
$output = $this->perceptron->test($inputs);
$output = $this->perceptron->test($inputs)[0];
$error = $correctOutput - $output;