Learning Rules on Neuron Slices

Hello, I am trying to use oja and bcm learning rules on connections between individual neurons in nengo simulations.

After getting some errors initially, I modified the following lines in learning_rules.build_bcm and learning_rules.build_oja

pre_activities = model.sig[get_pre_ens(conn).neurons]['out']
post_activities = model.sig[get_post_ens(conn).neurons]['out']


from nengo.builder.connection import slice_signal
in_signal = model.sig[conn]['in']
pre_activities = slice_signal(model, in_signal, conn.pre_slice)
out_signal = model.sig[conn]['out']
post_activities = slice_signal(model, out_signal, conn.post_slice)

There is likely a better way to implement this, but I wanted to raise this issue to the group in case others are experiencing this issue or if a fix to this could be incorporated into the next nengo update

Hi. Welcome and thanks for the bug report and fix! We are tracking this issue here: https://github.com/nengo/nengo/issues/1526. I have added a comment documenting your suggestion. This will help us prioritize and resolve the issue. Thanks again.

Great, thanks - I didn’t see that existing issue previously. The suggested fix there solved the problem better than the modifications I posted above.

Oh that’s good to know! To clarify, what made the other fix better?

The fix that I posted did not make the correct connections