Multilayer neuron network
linter / quality (push) Successful in 7m10s
tests / ci (8.4) (push) Successful in 4m43s
tests / ci (8.5) (push) Successful in 4m47s

This commit is contained in:
2026-09-08 16:29:02 +02:00
parent 2f4db07918
commit 08aa04fe56
17 changed files with 630 additions and 50 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ class NetworkPerceptron extends Perceptron
}
// Hidden Layer
for ($layerIndex = 0; $layerIndex < count($synaptic_weights) - 2; $layerIndex++) {
for ($layerIndex = 0; $layerIndex < count($synaptic_weights) - 1; $layerIndex++) {
$this->network[$layerIndex + 1] = [];
foreach ($synaptic_weights[$layerIndex] as $neuronWeights) {
@@ -0,0 +1,13 @@
<?php
namespace App\Models\Perceptrons;
class SigmoidPerceptron extends Perceptron
{
public function activationFunction(float $weighted_sum): float
{
$weighted_sum = max(-40, min(40, $weighted_sum));
return 1 / (1 + exp(-$weighted_sum));
}
}