Backpropagation in synapse

This commit is contained in:
Pascal Serrarens 2026-07-03 09:31:28 +02:00
parent 736766fb31
commit 9568cdfcfb

View File

@ -1,5 +1,6 @@
using System;
using UnityEngine;
using Unity.Mathematics;
namespace NanoBrain {
@ -31,6 +32,20 @@ namespace NanoBrain {
this.weight = weight;
}
public virtual void BasicBackPropagation(float error, float learningRate) {
float derivative = error;
switch (neuron.activator) {
case Neuron.ActivationType.Linear:
derivative *= 1;
break;
default:
break;
}
derivative *= math.length(neuron.activation);
float deltaWeight = learningRate * derivative;
this.weight += deltaWeight;
}
}
}