Hi,
For a school project of mine i want to introduce a distribution of synaptic values to a connection between ensembles. ens2 activity should be the same as ens1 activity if no synaptic variance is used (as in the code below). The first method (neuron to neurons) i tried is by clustering the neurons from both the pre and post ensemble and then to fully connect all pre clusters to all post clusters. The second method (neuron to ensemble) uses a connection from neuron cluster from the pre ensemble to the entire post ensemble. Option 1 for both methods (full connect, no clustering) gives the result i expect; ens2 activity looks very similar, if not the same, as ens1 activity. However when i try the clustering, for both methods, without any synaptic variance (yet). i find that ens2 shows either no or very minor activity. Does any one of you have any experience with connecting clusters like this? i can get some activity by scalng up the weight in the clustered connection and then i find that how larger the number of clusters the poorer the connection gets.
simplified code:
import nengo
import numpy as np
## neuron to neuron
model=nengo.Network()
with model:
ens1 = nengo.Ensemble(1000, 24, encoders=enc, seed=1)
ens2 = nengo.Ensemble(1000, 24, seed=2)
# Make temporary connection and use it to retrieve weights, then delete the Connection.
conn = nengo.Connection(ens1 , ens2, solver=nengo.solvers.LstsqL2(weights=True), seed=3)
with nengo.simulator.Simulator(model) as sim:
weights = sim.data[conn].weights / sim.data[ens2].gain[:, None]
model.connections.remove(conn)
# Divide ens1 and ens2 ensemble into clusters
Ncluster=50 # number of neurons per cluster
clusters=np.arange(0, 1000, Ncluster) #result: (0, 50 ,100, ..., 900, 950)
### OPTION 1: fully connect en1 to ens2 using the found weights
nengo.Connection(ens1.neurons, ens2.neurons, transform=weights)
### OPTION 2: Fully connect all neuron clusters using found weights
for i in range(clusters.size):
begin1=clusters[i]
end1=(begin1+Ncluster)
for j in range(clusters.size):
begin2=clusters[j]
end2=(begin2+Ncluster)
nengo.Connection(ens1.neurons[begin1:end1],ens2.neurons[begin2:end2],
transform = weights[begin2:end2,begin1:end1])
### neuron to ensemble
model=nengo.Network()
with model:
ens1 = nengo.Ensemble(1000, 24, encoders=enc, seed=1)
ens2 = nengo.Ensemble(1000, 24, seed=2)
# Make temporary connection and use it to retrieve weights, then delete the Connection.
conn = nengo.Connection(ens1 , ens2, function= lambda x: x, seed=3)
with nengo.simulator.Simulator(model) as sim:
weights = sim.data[conn].weights
model.connections.remove(conn)
# Divide ens1 ensemble into clusters
Ncluster=50 # number of neurons per cluster
clusters=np.arange(0, 1000, Ncluster) #result: (0, 50 ,100, ..., 900, 950)
### OPTION 1: fully connect en1 neurons to ens2 using the found weights
nengo.Connection(ens1.neurons, ens2, transform=weights)
### OPTION 2: Fully connect all ens1 neuron clusters to ens2 using found weights
for i in range(clusters.size):
begin=clusters[i]
end=(begin+Ncluster)
nengo.Connection(ens1.neurons[begin:end], ens2, transform=weights[:,begin:end])