fix(hebbian): symmetric learning — both active and inactive outputs learn
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
@@ -48,6 +48,6 @@ proc learn*(net: var HebbianNet, trace: EligibilityTrace, reward: float) =
|
||||
for i in 0..<N_IN:
|
||||
if trace.input[i] == 1:
|
||||
for j in 0..<N_OUT:
|
||||
if trace.output[j] == 1:
|
||||
net.W[i * N_OUT + j] += LEARNING_RATE * decayedReward
|
||||
net.W[i * N_OUT + j] = clamp(net.W[i * N_OUT + j], -W_CLAMP, W_CLAMP)
|
||||
let sign = if trace.output[j] == 1: 1.0 else: -1.0
|
||||
net.W[i * N_OUT + j] += LEARNING_RATE * sign * decayedReward
|
||||
net.W[i * N_OUT + j] = clamp(net.W[i * N_OUT + j], -W_CLAMP, W_CLAMP)
|
||||
|
||||
Reference in New Issue
Block a user