From 8af26db16cbdceb40df09cef226c9f4ee84739c4 Mon Sep 17 00:00:00 2001 From: Matthias Guillitte Date: Sun, 22 Mar 2026 10:42:15 +0100 Subject: [PATCH] Fix gradient descent --- app/Models/GradientDescentPerceptronTraining.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Models/GradientDescentPerceptronTraining.php b/app/Models/GradientDescentPerceptronTraining.php index 703aca0..a329cee 100644 --- a/app/Models/GradientDescentPerceptronTraining.php +++ b/app/Models/GradientDescentPerceptronTraining.php @@ -54,6 +54,8 @@ class GradientDescentPerceptronTraining extends NetworkTraining $this->addIterationToBuffer($iterationError, [[$this->perceptron->getSynapticWeights()]]); } + $this->epochError /= $this->datasetReader->getEpochExamplesCount(); // Average error for the epoch + // Synaptic weights correction after each epoch $synaptic_weights = $this->perceptron->getSynapticWeights(); $new_weights = array_map(