ml_genn.readouts package

Readouts are used to convert the internal state of an output neuron population into a form that can be used for classification. Unlike ANNs where this this is typically just the activation of the neurons, with SNNs it can be some function of their internal state over time or the spike times.

class ml_genn.readouts.AvgVar

Bases: Readout

Read out per-neuron average of neuron model’s output variable

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.AvgVarExpWeight

Bases: Readout

Read out per-neuron average of neuron model’s output variable with exponential weighting as described by [Nowotny2024].

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.FirstSpikeTime

Bases: Readout

Read out time of first spike emitted by population. Spike times are negated so standard metrics and loss functions can be employed.

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.MaxVar

Bases: Readout

Read out per-neuron maximum value of neuron model’s output variable

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.Readout

Bases: ABC

Base class for all readouts

abstract add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

abstract get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars: List[Tuple[str, str, Number]]

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.SpikeCount

Bases: Readout

Read out number of spikes emitted by population

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.SumVar

Bases: Readout

Read out per-neuron sum of neuron model’s output variable

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray

property reset_vars

Get list of tuples describing name, type and value to reset any state variables added by readout to

class ml_genn.readouts.Var

Bases: Readout

Read out instantaneous value of neuron model’s output variable

add_readout_logic(model, **kwargs)

Create a copy of a neuron model with any additional state and functionality required to implement this readout added.

Parameters:

model (NeuronModel) – Base neuron model

Return type:

NeuronModel

get_readout(genn_pop, batch_size, shape)

Read out the value from the state of a compiled neuron group.

Parameters:
  • genn_pop – GeNN NeuronGroup object population with readout has been compiled into

  • batch_size (int) – Batch size of model readout is part of

  • shape – Shape of population

Return type:

ndarray