git init
This commit is contained in:
14
app/Services/RandomSynapticWeights.php
Normal file
14
app/Services/RandomSynapticWeights.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class RandomSynapticWeights implements ISynapticWeights {
|
||||
public function generate(int $input_size): array
|
||||
{
|
||||
$weights = [];
|
||||
for ($i = 0; $i < $input_size + 1; $i++) { // +1 for bias weight
|
||||
$weights[] = rand(-100, 100) / 100; // Random weights between -1 and 1
|
||||
}
|
||||
return $weights;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user