Open chongxi opened 5 years ago
Binner API
binner = Binner(bin_size=33.33, n_id=N, n_bin=B) # binner initialization (space and time)
binner.input(bmi_output, type='individual_spike') # internal state update triggered
Binner Process
For LSTM:
Binner Internal Parameters:
N
N neurons give rise to N spike count in each binB
B binsbin_size
The time span (ms) to compute the spike count of each bin Internal States:
count_vec
(+1 on with the input spike_id)nbins
(+1 when the input timestamps goes to the next bin, its number is the current bin
) output
(emitted variable to the decoder, N neuron's spike count in previous B bins)when nbins
grows, the binner
emits the decode
event with its property output
.
IMPORTANT: make sure that the bmi_output.spk_id
is orthogonal
def input(self, bmi_output, type='individual_spike'):
current_bin = bmi_output.timestamp//self.bin_size
if current_bin == self.nbins: # state integrate
self.count_vec[bmi_output.spk_id, self.nbins] += 1
elif current_bin > self.nbins: # state output
self.nbins += 1
self.count_vec[bmi_output.spk_id, self.nbins] += 1
self.count_vec = np.hstack((self.count_vec, self.new_empty_bin))
self.emit('decode', var=self.output)
@property
def output(self):
self._output = self.count_vec[:N, -B:]
return self._output
@property
def new_empty_bin(self):
return np.zeros((N,1))
binner
is supposed to take each individual spike and update its states, including the current bin number, the real-time updated spike count vector of N neurons etc.trigger
the decoder by emitting an event.#bin
is there, which includes the predefinedpre_bins
andcurrent_bin
.