Skip to content

Commit

Permalink
Fixed gradient descent not properly working
Browse files Browse the repository at this point in the history
  • Loading branch information
xEcho1337 committed Jan 7, 2025
1 parent 238e6bb commit c02a94d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/echo/brain4j/structure/Neuron.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
public class Neuron {

private final List<Synapse> synapses = new ArrayList<>();
private final ThreadLocal<Double> localValue = new ThreadLocal<>();
private final ThreadLocal<Double> delta = new ThreadLocal<>();
private final ThreadLocal<Double> localValue = ThreadLocal.withInitial(() -> 0.0);
private final ThreadLocal<Double> delta = ThreadLocal.withInitial(() -> 0.0);
private double totalDelta;
@Expose private double bias;

Expand All @@ -34,7 +34,7 @@ public double getDelta() {
}

public void setDelta(double delta) {
this.delta.set(delta);
this.delta.set(this.delta.get() + delta);
this.totalDelta += delta;
}

Expand Down

0 comments on commit c02a94d

Please sign in to comment.