15 lines
371 B
PHP
15 lines
371 B
PHP
<?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;
|
|
}
|
|
}
|