superneuromat.SNN#
- class superneuromat.SNN[source]#
- Parameters:
num_neurons (int) – The number of neurons in the SNN.
neurons (NeuronList) – List of neurons in the SNN.
num_synapses (int) – The number of synapses in the SNN.
synapses (SynapseList) – List of synapses in the SNN.
spike_train (list) – List of output spike trains for each time step. Index by
spike_train[t][neuron_id]
.ispikes (numpy.ndarray[(int, int), bool]) – Binary numpy array of input spikes for each time step. Index by
ispikes[t, neuron_id]
.
STDP Parameters
- Parameters:
stdp (bool, default=True) – if
stdp
isFalse
, STDP will be disabled globally.apos (list, default=[]) – List of STDP parameters per time step for excitatory update of weights.
aneg (list, default=[]) – List of STDP parameters per time step for inhibitory update of weights.
stdp_positive_update (bool | Any, default=True) – If
False
, disable excitatory STDP update globally.stdp_negative_update (bool | Any, default=True) – If
False
, disable inhibitory STDP update globally.stdp_time_steps (int) – Number of time steps over which STDP updates will be made. This is determined from the length of apos or aneg.
Config Parameters
- Parameters:
default_dtype (type | numpy.dtype, default=numpy.float64) – Default data type for internal numpy representation of all floating-point arrays.
default_bool_dtype (type | numpy.dtype, default=bool) – Default data type for internal numpy representation of stdp_enabled values and spike vectors.
gpu (bool) – If
False
, disable GPU acceleration. By default, this isTrue
ifnumba.cuda.is_available()
.manual_setup (bool, default=False) – If
True
, disable automatic setup of SNN whensimulate()
is called.allow_incorrect_stdp_sign (bool, default=False) – If
True
, allow negative values inapos
and positive values inaneg
.allow_signed_leak (bool, default=False) – If
True
, allow negative values inneuron_leaks
. Normally, positive leak will result in charge decay.backend (str, default='auto') – The backend to use for simulation. Can be
'auto'
,'cpu'
,'jit'
, or'gpu'
. Can be overridden on a per-simulate()
basis.sparse (bool | str | Any, default=False) – If
True
, use sparse representation of SNN. If'auto'
, use sparse representation ifnum_neurons > 100
. Sparse representation is only available using the'cpu'
backend.last_used_backend (str, default=None) – The backend most recently used for simulation.
is_sparse (bool, default=False) – If
True
, the SNN is being internally represented using a sparse representation.
Data Attributes
These attributes are not intended to be modified directly by end users.
- Parameters:
neuron_thresholds (list) – List of neuron thresholds
neuron_leaks (list) – List of neuron leaks defined as the amount by which the internal states of the neurons are pushed towards the neurons’ reset states
neuron_reset_states (list) – List of neuron reset states
neuron_refractory_periods (list) – List of neuron refractory periods
pre_synaptic_neuron_ids (list) – List of pre-synaptic neuron IDs
post_synaptic_neuron_ids (list) – List of post-synaptic neuron IDs
synaptic_weights (list) – List of synaptic weights
synaptic_delays (list) – List of synaptic delays
enable_stdp (list) – List of Boolean values denoting whether STDP learning is enabled on each synapse
input_spikes (dict) – Dictionary of input spikes for each time step.
Warning
Delay is implemented by adding a chain of proxy neurons.
A delay of 10 between neuron A and neuron B would add 9 proxy neurons between A and B. This may result in severe performance degradation. Consider using sparse representation or agent-based SNN simulators in networks with high delay times.
Hint
Leak brings the internal state of the neuron closer to the reset state.
The leak value is the amount by which the internal state of the neuron is pushed towards its reset state.
Deletion of neurons may result in unexpected behavior.
Input spikes can have a value
All neurons are monitored by default
Methods#
Initialize the SNN |
Building the SNN
Adds an external spike in the SNN |
|
Create a neuron in the SNN. |
|
Creates a synapse in the SNN |
|
Setup the Spike-Time-Dependent Plasticity (STDP) parameters |
|
Set the synaptic weights from a matrix. |
Inspecting the SNN
Returns a DataFrame containing information about neurons. |
|
Returns a vector of the number of spikes emitted from each neuron since last reset. |
|
Returns the synapse that connects the given pre- and post-synaptic neurons. |
|
Returns a DataFrame containing information about synapses. |
|
Returns the synapses that connect the given post-synaptic neuron. |
|
Returns a list of synapses with the given pre-synaptic neuron. |
|
Returns the id of the synapse connecting the given pre- and post-synaptic neurons. |
|
Returns a list of synapse ids with the given post-synaptic neuron. |
|
Returns a list of synapse ids with the given pre-synaptic neuron. |
|
Returns a DataFrame containing information about synapse weights. |
|
Generate a description of the synapses in the SNN. |
|
Returns a DataFrame containing information about input spikes. |
|
Returns a DataFrame containing information about STDP enabled synapses. |
|
Get the last-used backend for simulation. |
|
Generates a text description of the model. |
|
Pretty-prints the model. |
|
Returns a pretty string of the spike train. |
|
Prints the spike train. |
|
Return a 1-line summary of the SNN. |
|
Generate a description of the neurons in the SNN. |
|
Generate a description of the current global STDP settings. |
|
Generate a description of the synapses in the SNN. |
|
Create a boolean dense matrix which indicates whether STDP is enabled on each synapse. |
|
Create a dense weight matrix from the synaptic weights. |
|
Create a sparse weight matrix from the synaptic weights. |
Managing Model State
Delete all stored copies of model variables. |
|
Consumes/deletes input spikes for the given number of time steps. |
|
Returns a copy of the SNN |
|
Copy the internal state variables back to the public-facing canonical representations. |
|
Store a copy of model variable(s) to be restored later. |
|
Recommend a backend to use based on network size and continuous sim time steps. |
|
Delete internal variables created during computation. |
|
Reset the SNN's neuron states, refractory periods, spike train, and input spikes. |
|
Restore model variables to their memoized states. |
|
Setup the SNN for simulation. |
|
Simulate the neuromorphic spiking neural network |
|
Simulate the neuromorphic circuit using the GPU backend. |
|
Delete stored copies of model variables. |
|
Exports the SNN to a JSON string. |
|
Exports the SNN to a JSON file. |
|
Update this SNN from a SuperNeuroMat JSON string. |
Attributes#
Attributes
Returns the number of neurons in the SNN. |
|
Returns the number of synapses in the SNN. |
|
Convert the output spike train to a dense binary |
|
Set the backend to be used for simulation. |
|
The list of public variables which define the SNN model. |
|
NumPy representation of the internal state variables used during simulation. |
|
Returns True if SNN is sparse internally. |
|
The user-requested sparsity setting for the SNN |
|
Returns the number of time steps over which STDP updates will be made. |
|