-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeight.java
More file actions
37 lines (30 loc) · 741 Bytes
/
Copy pathWeight.java
File metadata and controls
37 lines (30 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
public class Weight {
private Neuron source;
private Neuron sink;
private double value, value_delta;
public Weight(Neuron source, Neuron sink) {
this.source = source;
this.sink = sink;
this.value = Math.random() * 8.0 - 4.0;
value_delta = 0;
}
public void addDelta(double d) {
value_delta += d;
}
public void avgAddDelta(int size) {
value += value_delta / size;
value_delta = 0;
}
public double forwardCalc() {
return source.getValue() * value;
}
public double getValue() {
return value;
}
public Neuron getSink() {
return sink;
}
public Neuron getSource() {
return source;
}
}