Grouping multiple ensembles to act as one

Hi there!

I’ve been trying to create a model where some neurons within an ensemble have different properties. From reading the documentation, I don’t think this is possible.

So my question is, would it be possible to link together multiple ensembles so that they act as one (each ensemble would have slightly different parameters for the neurons, but they would all be connected together). Then, if I were to make a connection between the “Ensemble collection” and another ensemble, the collection would act like one Ensemble. Is this possible? Any way I could accomplish something similar?

I’m a bit new to nengo, so I might have some misconceptions, so please do correct them.

Any and all help is appreciated!

Thanks!

Try looking into EnsembleArray and subnetworks. Subnetworks can be any type of network, and you can define their interface very flexibly. This page has a good discussion.

EnsembleArray (example, API, code) is not perfectly what you are looking for in terms of varying parameters across Ensembles, but it will be good inspiration. Your subnetwork class will look a lot like that class, maybe even inherit it.

Hope that helps

2 Likes

Thank you so much! I created a class very similar to the EnsembleArray to modify (called EnsembleCollection), but I keep getting an error saying ‘BuildError: Cannot build object of type ‘EnsembleCollection’’. I’ve looked through the builder documentation, and I I’m unsure why the error is being thrown (the EnsembleCollection class inherits nengo.Network’s, just as EnsembleArray does). Any advice?

Edit: upon running it again, it says cannot build object of type ‘tuple’ instead

Hello! Thanks @atait, that’s exactly what I would recommend as well.
@questions it’s hard to say without seeing your code, but if you attach the script you’re trying to run I’m happy to try running it and see if I can spot the problem!

1 Like

Thanks again. I will post my code as soon as I’m back at my computer again. I had one slightly more ‘theoretical’ question about the proposed EnsembleCollection. By connecting all the ensembles on the inside together, would the collection act as one larger ensemble (each one would be connected to all the others in the collection), or would behave much differently. Also, is there a standard dimensionality reduction function that is employed in these cases (reducing from the all the ensembles inside to the dimensions of a single ensemble). Sorry for all the questions!

So, in a standard Nengo Ensemble, the neurons are not connected to each other unless you add a separate recurrent connection, i.e.

ens = nengo.Ensemble(n_n> eurons=10, dimensions=1)
nengo.Connection(ens, ens)

In an EnsembleArray, what happens is if you have a 10 dimensional input signal, and each Ensemble in the array is 1D, then 10 Ensembles get created. The 10 dimensional input signal is broken up to send a single dimension to each Ensemble and then the output of the Ensembles is combined on the output side so that you don’t need to make 10 separate connections to access the EnsembleArray output. It’s all in one place. There’s also some discussion of this in this thread: High-dimensional `Ensembles` vs. many low-dimensional `Ensembles`

Does that help?

1 Like

I think I had a fundamental misunderstanding as to how the EnsembleArray distributed the input values, so thanks for clearing that up!

My ultimate goal was something like this, where some neurons within the ensemble are have slightly different parameters from the others. One of the suggestions was to create multiple ensembles and connect them like in an EnsembleArray to simulate an ensemble with slightly different neurons on the inside. However, I’ve been struggling with how to make this ‘EnsembleCollection’ simulate a lower dimensional ensemble (input and output) even though it has more dimensions.

Would it be possible to modify this to decrease synaptic transmission for some neurons within the ensemble (or something to that effect)?

If the encoders can be thought of as a connection weight, wouldn’t modifying them be akin to ochanging synaptic weights?

Hmm, I’m not sure I understand your ultimate goal. When an ensemble is created, the parameters for each of the neurons are chosen randomly from a distribution. So by default in an ensemble the neurons will have slightly different parameters. But I think I’m misunderstanding, can you provide me more context of your problem?

Regarding changing the encoders, yes you can think of that as changing the connection weights to that neuron. The connection weight from neuron i in one ensemble to neuron j in another ensemble is calculated as w_ij = a_j * d_i * e_j where a_j is a gain term, d_i is the decoder for neuron i, and e_j is the encoder for neuron j.