When I am using the BCM learning rule to generate error signals, there is a
ValidationError: Connection.post: '<LearningRule modifying <Connection from <Ensemble (unlabeled) at 0x11872be50> to <Ensemble (unlabeled) at 0x11872ba60>> with type BCM()>' must have size_in > 0.
I don’t know where I set the size_in to be less than 0.
My code is below:
with model:
sin = nengo.Node(WhiteSignal(700, high=5), size_out=1)
pre = nengo.Ensemble(700, dimensions=1)
post = nengo.Ensemble(20, dimensions=1)
nengo.Connection(sin, pre)
conn = nengo.Connection(pre, post, solver=nengo.solvers.LstsqL2(weights=True))
sin_p = nengo.Probe(sin)
pre_p = nengo.Probe(pre, synapse=0.01)
post_p = nengo.Probe(post, synapse=0.01)
conn.learning_rule_type = nengo.BCM(learning_rate=5e-10)
with model:
weights_p = nengo.Probe(conn, "weights", synapse=0.01, sample_every=0.01)
with model:
error = nengo.Ensemble(700, dimensions=1)
error_p = nengo.Probe(error, synapse=0.03)
# Error = actual - target = post - pre
nengo.Connection(post, error)
nengo.Connection(pre, error, transform=-1)
# Add the learning rule to the connection
conn.learning_rule_type = nengo.BCM()
# Connect the error into the learning rule
nengo.Connection(error, conn.learning_rule)
Thank you for your heip!