Multilayer neuron network
This commit is contained in:
@@ -28,13 +28,24 @@ class PerceptronIterationEventBuffer implements IPerceptronIterationEventBuffer
|
||||
|
||||
public function addIteration(int $epoch, int $exampleIndex, float $error, array $synaptic_weights): void
|
||||
{
|
||||
$this->data[] = [
|
||||
$iteration = [
|
||||
'epoch' => $epoch,
|
||||
'exampleIndex' => $exampleIndex,
|
||||
'error' => $error,
|
||||
'weights' => $synaptic_weights,
|
||||
];
|
||||
|
||||
$payload = [
|
||||
'iterations' => [...$this->data, $iteration],
|
||||
'trainingId' => $this->trainingId,
|
||||
];
|
||||
|
||||
if ($this->data !== [] && strlen(json_encode($payload, JSON_THROW_ON_ERROR)) > config('broadcasting.broadcast_max_payload_size')) {
|
||||
$this->flush();
|
||||
}
|
||||
|
||||
$this->data[] = $iteration;
|
||||
|
||||
if ($this->underSizeIncreaseCount <= $this->sizeIncreaseStart) { // We can still send a single date because we are under the increase start threshold
|
||||
$this->underSizeIncreaseCount++;
|
||||
$this->flush();
|
||||
|
||||
Reference in New Issue
Block a user