stdp_synapse

Contents

stdp_synapse#

class brainpy.state.stdp_synapse(*args, **kwargs)#

Pair-based spike-timing-dependent plasticity synapse spec (NEST stdp_synapse).

On the substrate the per-pre K+ and per-post K- traces decay-then-add each step; this kernel gates its own weight writeback:

\[ \begin{align}\begin{aligned}\hat w \leftarrow \hat w + \lambda (1-\hat w)^{\mu_+} K^+ \quad\text{(post spike)}\\\hat w \leftarrow \hat w - \alpha \lambda \hat w^{\mu_-} K^- \quad\text{(pre spike)}\end{aligned}\end{align} \]

with \(\hat w = w/W_{\max}\), the weight clamped to \([0, W_{\max}]\) inside each update (matching NEST facilitate_/depress_). Each side excludes the current step’s own spike from the opposite trace (K+ = pre_trace - pre_spike, K- = post_trace - post_spike), the simultaneous-spike convention that mirrors NEST’s half-open window + strictly-prior get_K_value.

Parameters:
  • weight (ArrayLike or Quantity, optional) – Per-edge weight (pA; bare numbers are pA). Same sign as Wmax. Default 1.0 pA.

  • delay (Quantity, optional) – Homogeneous axonal delay (> 0). Default 1.0 ms.

  • receptor_type (int, optional) – Postsynaptic receptor port (>= 0). Default 0.

  • tau_plus (Quantity, optional) – Presynaptic K+ trace constant (> 0). Default 20.0 ms.

  • tau_minus (Quantity, optional) – Postsynaptic K- trace constant (> 0). Default 20.0 ms.

  • lambda (float, optional) – Learning rate \(\lambda\). Default 0.01.

  • alpha (float, optional) – Depression asymmetry \(\alpha\). Default 1.0.

  • mu_plus (float, optional) – Potentiation/depression exponents (0 additive, 1 multiplicative soft-bound). Default 1.0.

  • mu_minus (float, optional) – Potentiation/depression exponents (0 additive, 1 multiplicative soft-bound). Default 1.0.

  • Wmax (float, optional) – Weight bound (same sign as weight). Default 100.0.

  • Kplus (float, optional) – Initial K+ (>= 0). Default 0.0 (the substrate seeds traces at 0, the NEST default).

Notes

NEST divergence — ``tau_minus`` location. In NEST tau_minus is a parameter of the postsynaptic neuron (ArchivingNode), not the synapse; here it is a synapse-spec attribute that drives the substrate’s per-post K- trace, so STDP runs standalone.

Online vs deferred: the substrate applies potentiation eagerly at post-spike steps, whereas NEST defers it to the next pre spike; the two coincide at pre-spike (send) times, so parity is asserted there.

Parity note. The consolidated NEST vs. brainpy.state divergence reference — trace-storage move, the family parameter-location map, and the parity-test links — is in STDP parity: where state lives and how spikes pair (Trace storage: tau_minus is a synapse parameter here, a neuron parameter in NEST).

References

Examples

>>> import brainunit as u
>>> from brainpy.state import stdp_synapse
>>> s = stdp_synapse(weight=1.0, tau_plus=20.0 * u.ms)
>>> s.is_homogeneous_weight, s.edge_state_init()
(False, {})
>>> float(u.Quantity(s.pre_trace_tau).to_decimal(u.ms))
20.0