Modified limitedEventBuffer to send in linear delay

This commit is contained in:
2026-03-23 16:00:51 +01:00
parent 236fa503fb
commit dea908c63e
2 changed files with 4 additions and 12 deletions

View File

@@ -32,20 +32,12 @@ class PerceptronLimitedEpochEventBuffer implements IPerceptronIterationEventBuff
'weights' => $synaptic_weights,
];
if ($this->underSizeIncreaseCount <= $this->sizeIncreaseStart) { // Special case where we need to send each iteration separately
$this->underSizeIncreaseCount++;
$this->data[] = $newData;
$this->flush();
return;
}
$lastEpoch = $this->data[0]['epoch'] ?? null;
if ($this->data && $lastEpoch !== $epoch) { // Current Epoch has changed from the last one
if ($lastEpoch % $this->epochInterval === 0) { // The last epoch need to be sent
if ($lastEpoch == 1 || $lastEpoch % $this->epochInterval === 0) { // The last saved epoch need to be sent
$this->flush(); // Flush all data from the previous epoch
} else {
$this->data = [];
$this->data = []; // We clear the data without sending it as we are saving the next epoch data
}
$lastEpoch = $epoch;