TAGS :Viewed: 1 - Published at: a few seconds ago

[ Generalized Hebbian Algorithm in ruby or python ]

Have you a Generalized Hebbian Algorithm written in ruby or python? I have it implemented from this wiki article, but it computes crazy large numbers.

This is the formula in ruby:

@alpha * out[j] * (input[i] - out[j] * sum(@koef.times.map{|k| @weights[k][i] * out[k]})) = -2.97697080169534e+15

Is this wrong? thx

Answer 1


As it seems, you have out[j] once too much. Try:

@alpha*out[j]*(input[i] - sum(@koef.times.map{|k| @weights[k][i] * out[k]}))

Also, notice that alpha should be decreasing with time.