Use correct naming for iteration and epoch
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user