epoch >= $this->maxEpochs) { $message = 'Le nombre maximal d\'époques a été atteint'; if ($finalError) { $message .= " avec une erreur finale de $finalError"; } event(new PerceptronTrainingEnded($message, $this->sessionId, $this->trainingId)); } } protected function broadcastTrainingEnded(string $reason): void { $this->iterationEventBuffer->flush(); event(new PerceptronTrainingEnded($reason, $this->sessionId, $this->trainingId)); } protected function addIterationToBuffer(float $error, array $synapticWeights) { if ($this->isCancelled !== null && ($this->isCancelled)()) { throw new TrainingCancelledException; } $this->iterationEventBuffer->addIteration($this->epoch, $this->datasetReader->getLastReadLineIndex(), $error, $synapticWeights); } public function cancel(): void { $this->broadcastTrainingEnded('Entraînement annulé'); } public function getEpoch(): int { return $this->epoch; } abstract public function getSynapticWeights(): array; }