Use correct naming for iteration and epoch
Some checks failed
linter / quality (push) Failing after 7s
tests / ci (8.4) (push) Failing after 4s
tests / ci (8.5) (push) Failing after 4s

This commit is contained in:
2026-03-21 09:46:35 +01:00
parent 6abb417430
commit a70b7670e7
8 changed files with 38 additions and 37 deletions

View File

@@ -4,11 +4,11 @@ namespace App\Models;
use App\Events\PerceptronTrainingEnded;
use App\Services\DataSetReader;
use App\Services\PerceptronIterationEventBuffer;
use App\Services\IPerceptronIterationEventBuffer;
abstract class NetworkTraining
{
protected int $iteration = 0;
protected int $epoch = 0;
/**
* @abstract
@@ -18,8 +18,8 @@ abstract class NetworkTraining
public function __construct(
protected DataSetReader $datasetReader,
protected int $maxIterations,
protected PerceptronIterationEventBuffer $iterationEventBuffer,
protected int $maxEpochs,
protected IPerceptronIterationEventBuffer $iterationEventBuffer,
protected string $sessionId,
protected string $trainingId,
) {
@@ -29,8 +29,8 @@ abstract class NetworkTraining
abstract protected function stopCondition(): bool;
protected function checkPassedMaxIterations(?float $finalError) {
if ($this->iteration >= $this->maxIterations) {
$message = 'Le nombre maximal d\'itérations a été atteint';
if ($this->epoch >= $this->maxEpochs) {
$message = 'Le nombre maximal d\'epoch a été atteint';
if ($finalError) {
$message .= " avec une erreur finale de $finalError";
}
@@ -40,6 +40,6 @@ abstract class NetworkTraining
}
protected function addIterationToBuffer(float $error, array $synapticWeights) {
$this->iterationEventBuffer->addIteration($this->iteration, $this->datasetReader->getLastReadLineIndex(), $error, $synapticWeights);
$this->iterationEventBuffer->addIteration($this->epoch, $this->datasetReader->getLastReadLineIndex(), $error, $synapticWeights);
}
}