# Implementing a new learning rule

Hello!

I am looking to implement a simple learning rule that goes like this: $\Delta \omega_{ij} = \alpha(t) * \omega_{ij}$, where $\omega_[ij}$ are the connection weights between two neuron populations (say A and B) and $\alpha(t)$ is the (decoded) scalar output from a third neuron population (say C) – ignore the utility or theoretical soundness of such a rule for now.

Given that the PES rule also takes in an external signal, I was looking at how that rule is implemented in Nengo. I am somewhat confused about the part where the error signal is created in the function build_pes (see code below - nengo/builder/learning_rules.py).

# Create input error signal
error = Signal(shape=rule.size_in, name="PES:error")
model.sig[rule]["in"] = error  # error connection will attach here


I would like to use something similar for $\alpha(t)$, except it needs to be the decoded scalar value outputted by the ‘C’ population (my understanding is that the ‘error’ in PES is made up of neural activities). I am not sure how I could obtain the decoders of ‘C’ and construct the represented value.

Hi Nani,

I think you can do it in exactly the same way as PES. All that that “Create input error signal” code block is doing is creating a signal to hold the input to the learning rule; there’s nothing that’s specific to it being an error signal, it can really be any signal.

So if you do that, and then connect the decoded output of C into the learning rule like this:

A = nengo.Ensemble(10, 1)
B = nengo.Ensemble(10, 1)
C = nengo.Ensemble(10, 1)
conn = nengo.Connection(A, B, learning_rule_type=YourLearningRuleType())
nengo.Connection(C, conn.learning_rule)


then you should get the decoded output of C in model.sig[rule]["in"].

1 Like