Skip to content

Commit 647886e

Browse files
weighted relations preparation
1 parent bfcb4ff commit 647886e

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/main/java/network/aika/neuron/INeuron.java

+2
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@ public void updateSynapse(Synapse s) {
896896
private void updateSynapse(Synapse.State state, double sign, Synapse s) {
897897
updateSum(s.isRecurrent(), s.isNegative(state), sign * (s.getLimit(state) * s.getWeight(state)));
898898

899+
posDirSumDelta += sign * s.computeMaxRelationWeights();
900+
899901
if(s.getInput().get().isPassiveInputNeuron() && !s.isNegative(state)) {
900902
posPassiveSumDelta += sign * (!s.isNegative(state) ? (s.getLimit(state) * s.getWeight(state)) : 0.0);
901903
}

src/main/java/network/aika/neuron/Synapse.java

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import network.aika.*;
2121
import network.aika.Document;
22+
import network.aika.neuron.activation.Activation;
2223
import network.aika.neuron.relation.Relation;
2324
import network.aika.Writable;
2425

@@ -301,6 +302,14 @@ public boolean isZero() {
301302
return Math.abs(weight) < TOLERANCE;
302303
}
303304

305+
public double computeRelationWeights(Activation.Link l) {
306+
return 0;
307+
}
308+
309+
public double computeMaxRelationWeights() {
310+
return 0;
311+
}
312+
304313

305314
public enum State {
306315
NEXT,

src/main/java/network/aika/neuron/activation/Activation.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ public State computeValueAndWeight(int round) throws RecursiveDepthExceededExcep
391391

392392
double x = Math.min(s.getLimit(), is.s.value) * s.getWeight();
393393
net += x;
394+
395+
net += s.computeRelationWeights(is.l);
396+
394397
if(!s.isNegative(CURRENT)) {
395398
posNet += x;
396399
}
@@ -441,7 +444,6 @@ public State computeValueAndWeight(int round) throws RecursiveDepthExceededExcep
441444

442445
public boolean isActiveable() {
443446
INeuron n = getINeuron();
444-
SynapseSummary ss = n.getSynapseSummary();
445447

446448
double net = n.getTotalBias(CURRENT);
447449

@@ -462,6 +464,8 @@ public boolean isActiveable() {
462464

463465
double x = iv * s.getWeight();
464466
net += x;
467+
468+
net += s.computeRelationWeights(l);
465469
}
466470

467471
for(Synapse s: n.getPassiveInputSynapses()) {
@@ -522,6 +526,10 @@ public void computeBounds() throws RecursiveDepthExceededException {
522526
} else {
523527
ub += Math.min(s.getLimit(), iAct.upperBound) * x;
524528
lb += Math.min(s.getLimit(), iAct.lowerBound) * x;
529+
530+
double rlw = s.computeRelationWeights(l);
531+
ub += rlw;
532+
lb += rlw;
525533
}
526534
}
527535

0 commit comments

Comments
 (0)