git init
This commit is contained in:
52
app/Events/PerceptronTrainingIteration.php
Normal file
52
app/Events/PerceptronTrainingIteration.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PerceptronTrainingIteration implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $iteration,
|
||||
public int $exampleIndex,
|
||||
public float $error,
|
||||
public array $synaptic_weights,
|
||||
public string $sessionId,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
// Log::debug("Broadcasting on channel: " . $this->sessionId . '-perceptron-training');
|
||||
return [
|
||||
new Channel($this->sessionId . '-perceptron-training'),
|
||||
];
|
||||
}
|
||||
|
||||
public function broadcastWith(): array
|
||||
{
|
||||
return [
|
||||
'iteration' => $this->iteration,
|
||||
'exampleIndex' => $this->exampleIndex,
|
||||
'error' => $this->error,
|
||||
'synaptic_weights' => $this->synaptic_weights,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user