Closed shreshth-29 closed 9 months ago
Hi, in case you haven't done so yet, please check Sec. 2.1 of this paper. It explains the math behind this rate encoding.
In short, a presynaptic spike causes a value to be added to the membrane potential that's proportional to the synaptic strength (the weight in the convolution kernel). This increase or decrease can happen at every time step in which you get a presynaptic spike, hence the integer-multiples in your observation. If you ANN activation is 0.1, then you'll get a spike every tenth time step, resulting in a spike rate of 0.1 if you run it long enough. So the 'average spike rates' are calculated from the 1s and 0s in the output spike train, not the other way around.
Hope the paper helps clear things up further.
I used the SNN toolbox to convert a CNN into a spiking network. In the config file, I set the encoding as 'temporal_mean_rate', threshold as 1mv and dt as 1ms. The time constants are the default values. The simulation time is 200 ms.
I saved the model as a .h5 file and after loading the model, I wanted to inspect it's outputs. I made a prediction for an input tensor and I tried to observe the membrane potential values and the spiketrains for the first layer (which was a conv layer).
The membrane potential values seem to be very closely related to the values we get after a normal convolution, with analog/continuous values. For example, the values after convolution which were supposed to be
1, -0.21174717,-0.45101094, 0.8199355
, were0, -0.423494, -0.90202188, 0.639871
in the membrane potential. The values seemed to have doubled, and the last value, which exceed the threshold (1) ,is obtained after subtracting 1(threshold) from the doubled value. However, the threshold was subtracted twice for 1. (1*2-1-1 =0). I experimented with some other values of the threshold and each time, the membrane potential values were obtained by multiplying the normal convolution values, by some integer (2,3,4 etc), and for values that exceed the threshold, the threshold was subtracted: sometimes once, sometimes multiple times. Thespiktrain
array had 1s whenever the value exceeded the threshold.I have 2 basic questions pertaining to these observations:
What is the mathematical model followed to calculate the membrane potential values, which can explain these observations? I tried a simple Integrate and Fire neuron model but that could not explain these observations properly.
From the description in the documentation I take 'temporal_mean_encoding' to be a form of rate encoding. An average over time for the number of spikes is calculated. How are these 'average spike rates' eventually converted to 1s and 0s in the output spiketrain? Is there a threshold mean rate to compare it with?
@rbodo