Wiki
This commit is contained in:
@@ -24,18 +24,20 @@ class IterationEventBufferTest extends TestCase
|
||||
});
|
||||
}
|
||||
|
||||
public function test_limited_buffer_discards_non_selected_epochs(): void
|
||||
public function test_limited_buffer_sends_the_latest_non_selected_epoch_on_final_flush(): void
|
||||
{
|
||||
Event::fake();
|
||||
$buffer = new PerceptronLimitedEpochEventBuffer('session', 'training', 2);
|
||||
|
||||
$buffer->addIteration(1, 0, 0.5, []);
|
||||
$buffer->addIteration(2, 0, 0.25, []);
|
||||
$buffer->addIteration(2, 1, 0.125, []);
|
||||
$buffer->flush();
|
||||
|
||||
Event::assertDispatchedTimes(PerceptronTrainingIteration::class, 2);
|
||||
Event::assertDispatched(PerceptronTrainingIteration::class, function (PerceptronTrainingIteration $event): bool {
|
||||
return count($event->iterations) === 1
|
||||
&& $event->iterations[0]['epoch'] === 1;
|
||||
return count($event->iterations) === 2
|
||||
&& $event->iterations[0]['epoch'] === 2;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user