Backpropagation in synapse
This commit is contained in:
parent
736766fb31
commit
9568cdfcfb
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user