superneuromat package
Module contents
- class superneuromat.NeuromorphicModel(backend='cpu')[source]
Bases:
object
Defines a neuromorphic model with neurons and synapses
- num_neurons
Number of neurons in the neuromorphic model
- Type:
int
- neuron_thresholds
List of neuron thresholds
- Type:
list
- neuron_leaks
List of neuron leaks, defined as the amount by which the internal states of the neurons are pushed towards the neurons’ reset states
- Type:
list
- neuron_reset_states
List of neuron reset states
- Type:
list
- neuron_refractory_periods
List of neuron refractory periods
- Type:
list
- num_synapses
Number of synapses in the neuromorphic model
- Type:
int
- pre_synaptic_neuron_ids
List of pre-synaptic neuron IDs
- Type:
list
- post_synaptic_neuron_ids
List of post-synaptic neuron IDs
- Type:
list
- synaptic_weights
List of synaptic weights
- Type:
list
- synaptic_delays
List of synaptic delays
- Type:
list
- enable_stdp
List of Boolean values denoting whether STDP learning is enabled on each synapse
- Type:
list
- input_spikes
Dictionary of input spikes indexed by time
- Type:
dict
- spike_train
List of spike trains for each time step
- Type:
list
- stdp
Boolean parameter that denotes whether STDP learning has been enabled in the neuromorphic model
- Type:
bool
- stdp_time_steps
Number of time steps over which STDP updates are made
- Type:
int
- stdp_Apos
List of STDP parameters per time step for excitatory update of weights
- Type:
list
- stdp_Aneg
List of STDP parameters per time step for inhibitory update of weights
- Type:
list
- add_spike()[source]
Add an external spike at a particular time step for a given neuron with a given value
Caution
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.
Leak brings the internal state of the neuron back 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 is not permitted
Input spikes can have a value
All neurons are monitored by default
- add_spike(time: int, neuron_id: int, value: float = 1.0) None [source]
Adds an external spike in the neuromorphic model
- Parameters:
time (int) – The time step at which the external spike is added
neuron_id (int) – The neuron for which the external spike is added
value (float) – The value of the external spike (default: 1.0)
- Raises:
TypeError if –
time is not an int 2. neuron_id is not an int 3. value is not an int or float
- create_neuron(threshold: float = 0.0, leak: float = inf, reset_state: float = 0.0, refractory_period: int = 0) int [source]
Create a neuron
- Parameters:
threshold (float) – Neuron threshold; the neuron spikes if its internal state is strictly greater than the neuron threshold (default: 0.0)
leak (float) – Neuron leak; the amount by which by which the internal state of the neuron is pushed towards its reset state (default: np.inf)
reset_state (float) – Reset state of the neuron; the value assigned to the internal state of the neuron after spiking (default: 0.0)
refractory_period (int) – Refractory period of the neuron; the number of time steps for which the neuron remains in a dormant state after spiking
- Returns:
Returns the neuron ID
- Raises:
TypeError if –
threshold is not an int or a float 2. leak is not an int or a float 3. reset_state is not an int or a float 4. refractory_period is not an int
ValueError if –
leak is less than 0.0 2. refractory_period is less than 0
- create_synapse(pre_id: int, post_id: int, weight: float = 1.0, delay: int = 1, stdp_enabled: bool = False) None [source]
Creates a synapse in the neuromorphic model from a pre-synaptic neuron to a post-synaptic neuron with a given set of synaptic parameters (weight, delay and enable_stdp)
- Parameters:
pre_id (int) – ID of the pre-synaptic neuron
post_id (int) – ID of the post-synaptic neuron
weight (float) – Synaptic weight; weight is multiplied to the incoming spike (default: 1.0)
delay (int) – Synaptic delay; number of time steps by which the outgoing signal of the syanpse is delayed by (default: 1)
enable_stdp (bool) – Boolean value that denotes whether or not STDP learning is enabled on the synapse (default: False)
- Raises:
TypeError if –
pre_id is not an int 2. post_id is not an int 3. weight is not a float 4. delay is not an int 5. enable_stdp is not a bool
ValueError if –
pre_id is less than 0 2. post_id is less than 0 3. delay is less than or equal to 0
- simulate(time_steps: int = 1000) None [source]
Simulate the neuromorphic spiking neural network
- Parameters:
time_steps (int) – Number of time steps for which the neuromorphic circuit is to be simulated
backend (string) – Backend is either cpu or frontier
- Raises:
TypeError if –
time_steps is not an int 2. backend is not a string
ValueError if –
time_steps is less than or equal to zero 2. backend is not one of the following values: cpu, frontier
- stdp_setup(time_steps: int = 3, Apos: list = [1.0, 0.5, 0.25], Aneg: list = [1.0, 0.5, 0.25], positive_update: bool = True, negative_update: bool = True) None [source]
Setup the Spike-Time-Dependent Plasticity (STDP) parameters
- Parameters:
time_steps (int) – Number of time steps over which STDP learning occurs (default: 3)
Apos (list) – List of parameters for excitatory STDP updates (default: [1.0, 0.5, 0.25]); number of elements in the list must be equal to time_steps
Aneg (list) – List of parameters for inhibitory STDP updates (default: [1.0, 0.5, 0.25]); number of elements in the list must be equal to time_steps
positive_update (bool) – Boolean parameter indicating whether excitatory STDP update should be enabled
negative_update (bool) – Boolean parameter indicating whether inhibitory STDP update should be enabled
- Raises:
TypeError if –
time_steps is not an int 2. Apos is not a list 3. Aneg is not a list 4. positive_update is not a bool 5. negative_update is not a bool
ValueError if –
time_steps is less than or equal to zero 2. Number of elements in Apos is not equal to the time_steps 3. Number of elements in Aneg is not equal to the time_steps 4. The elements of Apos are not int or float 5. The elements of Aneg are not int or float 6. The elements of Apos are not greater than or equal to 0.0 7. The elements of Apos are not greater than or equal to 0.0
RuntimeError if –
enable_stdp is not set to True on any of the synapses