Group - network interaction : How to update neurons and synapses separately

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Group - network interaction : How to update neurons and synapses separately

bagjohn
I try to add both neurons and synapses to a network by creating groups and then adding the groups to the network (via script). I notice this output from the relative functions :

this.getFlatSynapseList().size() : 172
this.getSynapseList().size() : 0
this.getSynapseCount() : 0
this.getFlatNeuronList().size() : 16
this.getNeuronList().size() : 0
this.getNeuronCount() : 0

Then I try to track the network.update() method where it says ...

int i = 0; for (int n = updateManager.getActionList().size(); i < n;  i++) {
((NetworkUpdateAction)updateManager.getActionList().get(i)).invoke();}

which I guess means it invokes all the actions of the updatemanager one by one.

Then I track the network constructor method and I find ...

updateManager = new NetworkUpdateManager(this);

and the NetworkUpdateManager constructor method ...

addAction(new BufferedUpdate(network));

and the invoke() method of the BufferedUpdate NetworkUpdateAction ...

network.bufferedUpdateAllNeurons();
network.updateAllSynapses();

and then for example the ...

public void updateAllSynapses(){
     for (Synapse s : synapseList) {
          s.update();
     }
}

But the synapseList contains only the synapses added straight to the network and it differs from the FlatSynapseList where the synapses of the synapseGroups are also present.

So by using network.update() are the neurons and synapses of the groups also updated ? And by which NetworkUpdateAction if not by the default BufferedUpdate created when the Network -> NetworkUpdateManager is created ?

Finally, (and this is why I started looking at this) how can I update the neurons of the network (from all groups) first, and at a separate time point update all the synapses (from all groups). If I do it by using

network.bufferedUpdateAllNeurons
---do something else here e.g. give reward for reinforcement learning---
network.updateAllSynapses

will it work ? And what about the listeners, firesynapsesupdated, fireneuronsupdates in the default network.update() method? Or do i have to use

network.updateAllGroups

to update synapses and neurons within groups? But then it gets complicated to update neurons and synapses separately.

What if I just

iterate the FlatNeuronList and update all neurons there
---do something else---
iterate the FlatSynapseList and update all synapses there

wouldn't I miss something (e.g. listeners etc)?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Group - network interaction : How to update neurons and synapses separately

jyoshimi
Administrator
Hi there,

Most of what you say looks ok to me.    Regarding bufferedupdate, you can check out the documentation here

https://github.com/simbrain/simbrain/blob/master/src/org/simbrain/network/update_actions/BufferedUpdate.java

It is indeed loose neurons and synapses only.  When new groups are added in the GUI update actions for them are added as well. To see this you can add some groups to a network and go to edit update sequence.  The purpose of this is to give users control over what is updated in what order.  There is no simple way to prescribe this once we are dealing with groups, so we simply add an action for each group and the user can decide what to do.

Updating loose neurons and synapses directly should be fine.   In terms of notifying listeners, it's up to you which events to fire.   They are mostly at the network level and start with "fire".   If you don't do this and you are using a GUI, the changes you make might not be visible.

The code we're talking about is going to receive close scrutiny this summer and we hope by summer's end to have a 3.1 beta out.   One goal is to make the API easier to use.

Best,

- Jeff