RectifiedSAM

class spikeometric.models.RectifiedSAM(lambda_0: float, theta: float, tau: float, dt: float, r: float, b: float, rng=None)[source]

Bases: spikeometric.models.sa_model.SAModel

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

This is a Linear-Nonlinear-Poisson model that uses a rectified linear non-linearity and Poisson spiking. It can be descibed as a mixture of the ThresholdSAM and the RectifiedLNP models. It uses activation as state like the ThresholdSAM, but uses a rectified non-linearity and Poisson spiking like the RectifiedLNP. Unlike the ThresholdSAM, the RectifiedSAM is tunable.

It is defined by the following equations:

  1. \[g_i(t+1) = r \: \sum_j (W_0)_{j,i}\: s_j(t) + b_i + \mathcal{E}_i(t+1)\]
  2. \[\mu_i(t+1) = \lambda_0\Delta t[g_i(t+1)) - \theta]_+\]
  3. \[X_i(t+1) \sim \text{Pois}(\mu_i(t+1))\]

The first equation is implemented in the input() method. It computes the input to neuron \(i\) at time \(t+1\) by adding the synaptic input from neighbouring neurons, weighted by the connectivity matrix \(W_0\) and scaled by \(r\), along with the background input \(b_i\) and the stimulus input \(\mathcal{E}_i(t+1)\).

The second equation is implemented in the non_linearity() method. It computes the expected firing rate of neuron \(i\) at time \(t+1\) by applying a rectified linear non-linearity to the input.

The third equation is implemented in the emit_spikes() method. It generates a spike from a Poisson process with rate \(\mu_i(t+1)\).

Between each time step, the activation is decayed decayed by a factor of \((1 - \Delta t/\tau)\) if no spikes are emitted and incremented by \(\Delta t\) otherwise.

Parameters
  • lambda_0 (float) – The scaling of the rectified non-linearity.

  • theta (float) – The threshold of the rectified non-linearity.

  • tau (float) – The time constant of the neurons.

  • dt (float) – The time step of the simulation.

  • r (float) – The scaling of the recurrent connections.

  • b (float) – The baseline strength of the background input.

  • rng (torch.Generator, optional) – The random number generator to use for the Poisson process.

input(edge_index: torch.Tensor, W: torch.Tensor, state: torch.Tensor, t=- 1) torch.Tensor[source]

The input to the network at time t+1.

\[g_i(t+1) = r \: \sum_j (W_0)_{j,i}\: s_j(t) + b_i + \mathcal{E}_i(t+1)\]
Parameters
  • edge_index (torch.Tensor[int]) – The edge index of the network.

  • W (torch.Tensor[float]) – The weights of the network.

  • state (torch.Tensor[int]) – The state of the network at time t.

  • t (int) – The time step of the simulation.

Returns

The input to the network at time t+1.

Return type

torch.Tensor

non_linearity(input: torch.Tensor) torch.Tensor[source]

Computes the response to the input through a rectified linear nonlinearity:

\[\mu_i(t+1) = \lambda_0\Delta t[g_i(t+1)) - \theta]_+\]
Parameters

input (torch.Tensor) – The input to the network at time \(t+1\)

Returns

The response to the input at time \(t+1\)

Return type

torch.Tensor

emit_spikes(rates: torch.Tensor) torch.Tensor[source]

Samples the spikes from a Poisson distribution with rate \(\mu_i(t+1)\).

\[X_i(t+1) \sim \text{Pois}(\mu_i(t+1))\]
Parameters

rates (torch.Tensor[float]) – The expected spike count of the network at time t+1.

Returns

The state of the network at time t+1.

Return type

torch.Tensor

update_activation(spikes: torch.Tensor, activation: torch.Tensor) torch.Tensor[source]

Update the activation of the neurons according to the formula:

\[s_i(t+1) = s_i(t)(1 - \frac{\Delta t}{\tau}) + X_i(t)\Delta t\]

where \(s_i(t)\) is the activation of neuron \(i\) at time \(t\), \(X_i(t)\) indicates whether the neuron spiked at time t or not, and \(\tau\) is the time constant of the neurons.

Parameters
  • spikes (torch.Tensor [n_neurons, 1]) – The spikes of the network at the current time step.

  • activation (torch.Tensor [n_neurons, 1]) – The activation of the neurons at the previous time step.

Returns

activation – The activation of the neurons at the current time step.

Return type

torch.Tensor [n_neurons, 1]