PyTwoDimSpikingCoreModel

Full Name

neuroptimiser.core.models.PyTwoDimSpikingCoreModel

Description

class PyTwoDimSpikingCoreModel[source]

Bases: AbstractPerturbationNHeuristicModel

Two-dimensional spiking core model for perturbation-based nheuristics

This model implements a two-dimensional spiking core for perturbation-based nheuristics, allowing for various dynamic systems and approximation methods.

See also

neuroptimiser.core.processes.TwoDimSpikingCore

Process that implements a two-dimensional spiking core for perturbation-based nheuristics.

__init__(proc_params)[source]

Initialises the two-dimensional spiking core model with the given parameters.

Parameters:

proc_params (dict) –

A dictionary containing the parameters for the process model. It should include:
  • alpha: float, scaling factor for the perturbation

  • max_steps: int, maximum number of steps for the dynamic system

  • noise_std: float, standard deviation of the noise added to the perturbation

  • name: str, name of the dynamic system (e.g., “linear”, “izhikevich”)

  • approx: str, approximation method for the dynamic system (e.g., “euler”, “rk4”)

  • dt: float, time step for the approximation

  • ref_mode: str, reference model for the perturbation (e.g., “p”, “g”, “pg”, “pgn”)

  • thr_mode: str, threshold mode for the spiking condition (e.g., “fixed”, “adaptive_time”, “adaptive_stag”, “diff_pg”, “diff_pref”, “random”)

  • thr_alpha: float, scaling factor for the threshold

  • thr_min: float, minimum threshold value

  • thr_max: float, maximum threshold value

  • thr_k: float, scaling factor for the threshold

  • spk_cond: str, spiking condition (e.g., “fixed”, “l1”, “l2”, “l2_gen”, “random”, “adaptive”, “stable”)

  • spk_alpha: float, scaling factor for the spiking condition

  • hs_operator: str, heuristic search operator (e.g., “fixed”, “random”, “directional”, “differential”)

  • hs_variant: str, variant of the heuristic search operator (e.g., “current-to-rand”, “best-to-rand”, “rand”, “current-to-best”)

  • is_bounded: bool, whether the perturbation is bounded (default: True)

implements_process

alias of TwoDimSpikingCore

implements_protocol

alias of LoihiProtocol

required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]
run_spk()[source]

Runs the spiking core process model.

The process is summarised as follows:
  1. If the process is not initialised, it generates random values for p and g, transforms them, and sets the initial state.

  2. If the process is initialised, it reads the inputs from the inports, transforms the variables, updates the threshold, and runs the core process. This core process involves:
    • Applying the heuristic search operator if the neuron fires or if it is compulsory to fire.

    • Applying the dynamic system model to update the state of the neuron.

    • Checking the bounds of the variables. (Only if is_bounded is True)

  3. Finally, it sends the updated state to the outports.

v1: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)
v2: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)