# Hebbian learning across two ensembles

Hi,

I have been trying to apply hebbian learning across two ensembles but the system shows a period of synchrony and desynchrony between the ensembles. I want to have synchrony behaviour in the system after learning. Here is the nengo code, is there anything which I am doing wrong?

``````import nengo
import numpy as np

model = nengo.Network('stngpeloop')
synapse=0.1
lam=3
wstn2gpe = 3
wstn2stn = 2

def dynamics(x):
return (synapse*(-x[0] + wstn2stn*np.tanh(lam * x[0]) - wstn2gpe*x[1]) + x[0]
, synapse*(-x[1] + wstn2gpe*np.tanh(lam * x[0])) + x[1])
with model:
stim = nengo.Node([0,0])
nengo.Connection(stim,stngpe)
nengo.Connection(stngpe,stngpe,function = dynamics)

nengo.Connection(stim,stngpe2)
nengo.Connection(stngpe2,stngpe2,function = dynamics)

nengo.Connection(stngpe[0],stngpe2[0],function = lambda x: 0,learning_rule_type = nengo.Oja(learning_rate = 1e-15,beta=0,pre_tau = 0.005),
solver=nengo.solvers.LstsqL2(weights = True))

nengo.Connection(stngpe2[0],stngpe[0],function = lambda x: 0,learning_rule_type = nengo.Oja(learning_rate = 1e-15,beta=0,pre_tau = 0.005),
solver=nengo.solvers.LstsqL2(weights = True))
``````

There’s no defined way to create synchrony (I’m assuming you mean synchrony between neurons and their spiking patterns) between Nengo Ensembles (let alone learn synchrony), because we don’t (and I would argue that no one does) have a really good understanding of what synchrony does computationally. There is one idea of how to implement it, proposed by Terry in our “Modelling Ideas” repository.