SpiNNakerManchester / sPyNNaker

The SpiNNaker implementation of the PyNN neural networking language
Apache License 2.0
101 stars 43 forks source link

Weight scaling corrupts STDP parameters #419

Open chanokin opened 6 years ago

chanokin commented 6 years ago

In synaptic_manager.py - line 476 - and with densely connected networks

total_weights[synapse_type] += spikes_per_tick * (weight_max * n_connections)

can lead to STDP parameters having reduced precision or even being zeroed, thus corrupting weights.

I belive the line is saying:

If all synapses of this type receive a spike during the same time step and all have the maximum weight, what's the largest number we need so that synapses don't saturate?

But every synapse receiving a spike at the same time step is an unlikely scenario; also if weights are random, not all connections will have the maximum weight.

rowleya commented 6 years ago

So the code would only use this value if the delays are not distributed; I think we were unsure of what would happen when the delays are fixed with Micheal's maximum weight calculation. If you are using fixed delays, we could try to use Michael's function in any case and see what happens.

Note that working out the maximum summed weight in any position is quite hard in general, as this has a temporal element which is hard to predict.

Note that with STDP, there will always be a contention between the maximum summed weight and the minimum changed value. A better overall solution might therefore be to look at stochastic rounding, where the smallest possible change is made randomly with a probability proportional to the ratio of the desired weight update and the smallest possible weight update e.g. if the smallest weight change is 0.1 and you want to add or subtract a weight of 0.01, add or subtract 0.1 with a probability of (0.01 / 0.1). This is a general solution that should then give reasonable values in long enough running simulations.