Neurons and Layers¶
Neurons in spikingnet
are grouped in layers. Here we document
the basic layer interface as well as the types of layers implemented
in spikingnet
.
The layer interface¶
All layers in spikingnet
share the same underlying interface.
When a layer is added to a SpikingNet
object through its
add_layer
method, it expects the layer to conform
to the following interface:
Layers should have a
__call__
method implemented returning one output.Layers should have
reset
andupdate
methods implemented. Thereset
method is called to return the network and the layer to its initial state.update
methods are triggered during learning.
Neuron models¶
- class spikelearn.neurons.LIFLayer(N, tau, v0=1, refr=True)¶
Implements a leaky integrate and fire
Implements a layer of LIF neurons. Its interface conforms to that of a Layer object.
- Parameters:
N – Neurons in the layer
tau – decay time, in timestep units
v0 – threshold value (optional, default 1)
refr – boolean, neuron has 1 timestep refractory period
- property N¶
Neurons in the layer
- __call__(*x)¶
Advances the neuron a single timestep
- Parameters:
x – a tuple of independent inputs
- Returns:
An array of spikes, 1 if a neuron spikes 0 otherwise
- property out¶
Output spikes
- reset()¶
Resets the neuron internal state
- property s¶
Output spikes
- step(*x)¶
Advances the neuron a single timestep
- Parameters:
x – a tuple of independent inputs
- Returns:
An array of spikes, 1 if a neuron spikes 0 otherwise
- property tau¶
Leakage time in timesteps
- property v¶
Membrane potential
- class spikelearn.neurons.SpikingRecLayer(N, tau, Wrec, v0=1)¶
Implements spiking neurons with an internal recurrent interaction.
Implements a layer of leaky integrate and fire (LIF) neurons with an additional static, recurrent interaction within the layer. This layer can be used to implement cross-inhibition between neurons within the layer. Its interface conforms to that of a Layer object.
- Parameters:
N – number of neurons in the layer
tau – decay time, in timestep units
Wrec – a 2D array with synaptic weights
v0 (optional, default 1) – threshold value
- property N¶
Neurons in the layer
- __call__(*x)¶
Advances the neuron a single timestep
- Parameters:
x – a tuple of independent inputs
- Returns:
An array of spikes, 1 if a neuron spikes 0 otherwise
- property out¶
Output spikes
- reset()¶
Resets the neuron internal state
- property s¶
Output spikes
- step(*x)¶
Advances the neuron a single timestep
- Parameters:
x – a tuple of independent inputs
- Returns:
An array of spikes, 1 if a neuron spikes 0 otherwise
- property tau¶
Leakage time in timesteps
- property v¶
Membrane potential