Models

The GLM and LNP models are implemented as classes that inherit from the MessagePassing class from the PyTorch Geometric library. We represent the network as a graph, where each node corresponds to a neuron and each edge corresponds to a synapse. The nodes are connected according to a weight matrix \(\mathbf{W_0}\), where the element \((W_0)_{i,j}\) is the weight of the synapse between neuron \(i\) and neuron \(j\). The state of the network at time step \(t\) is represented by a vector \(\mathbf{X}_t\) where each element corresponds to the spike count of a neuron at time step \(t\).

While there are many different types of GLM and LNP models, they all share a common structure. For each neuron \(i\), the state at time step \(t+1\) is computed in three steps:

  1. The input stage

    The first step is to compute the synaptic input \(g_i(t+1)\) to neuron \(i\) at time step \(t+1\). Input can come from several sources.

    • If a neuron \(j\) that is connected to \(i\) has recently fired, \(i\) will receive some input as a function of the synaptic weight \(W_{ji}\) between the two neurons and how long it has been since \(j\) fired.

    • If \(i\) itself has recently fired, it will be in a refractory period and will receive some self-inhibiting input.

    • There might also be some background input that is independent of the network state.

    • Finally, \(i\) may receive an external input, for example from an optogenetic stimulus.

  2. The non-linear stage

    The second step is to compute the response of the neuron to the synaptic input by applying a non-linear function to it. In the GLM, the non-linearity is the inverse link function, for example the inverse logit function (sigmoid) for the Bernoulli model. In the LNP, the non-linearity might for example be the rectified linear unit (ReLU) function. The output of this step is often interpreted as the expected spike count of the neuron.

  3. The spike emission stage

    The final step is to draw a spike count from a probability distribution that depends on the output of the non-linear stage. The probability distribution is often a Poisson distribution, but it can also be a Bernoulli distribution for the GLM.

These three steps form the core of the GLM and LNP models, and each class must implement them in the input(), non_linearity() and emit_spikes() functions, respectively.

The BaseModel class implements the core functionality of the GLM and LNP models, and the SAModel class implements the core functionality of the activation-based models.

Base models

BaseModel

Base class for all spiking neural networks.

SAModel

The Synaptic Activation model (SAModel) is a base model for models that use the synaptic activation as the state of the network and has an update rule for based on previous synaptic activation and spikes.

Spike-based models

RectifiedLNP

The Rectified LNP model from section S.6 of the paper "Systematic errors in connectivity inferred from activity in strongly coupled recurrent circuits".

PoissonGLM

The Poisson GLM model from section S.7 of the paper "Systematic errors in connectivity inferred from activity in strongly coupled recurrent circuits".

BernoulliGLM

The Bernoulli GLM from "Inferring causal connectivity from pairwise recordings and optogenetics".

Activation-based models

RectifiedSAM

The Rectified Synaptic Activation Model from section S.5 of the paper "Systematic errors in connectivity inferred from activity in strongly coupled recurrent circuits".

ThresholdSAM

The generative model used in the paper "Systematic errors in connectivity inferred from activity in strongly coupled recurrent circuits".