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-postK-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-priorget_K_value.- Parameters:
weight (
ArrayLikeorQuantity, optional) – Per-edge weight (pA; bare numbers are pA). Same sign asWmax. Default1.0pA.delay (
Quantity, optional) – Homogeneous axonal delay (> 0). Default1.0 ms.receptor_type (
int, optional) – Postsynaptic receptor port (>= 0). Default0.tau_plus (
Quantity, optional) – PresynapticK+trace constant (> 0). Default20.0 ms.tau_minus (
Quantity, optional) – PostsynapticK-trace constant (> 0). Default20.0 ms.lambda (
float, optional) – Learning rate \(\lambda\). Default0.01.alpha (
float, optional) – Depression asymmetry \(\alpha\). Default1.0.mu_plus (
float, optional) – Potentiation/depression exponents (0additive,1multiplicative soft-bound). Default1.0.mu_minus (
float, optional) – Potentiation/depression exponents (0additive,1multiplicative soft-bound). Default1.0.Wmax (
float, optional) – Weight bound (same sign asweight). Default100.0.Kplus (
float, optional) – InitialK+(>= 0). Default0.0(the substrate seeds traces at 0, the NEST default).
Notes
NEST divergence — ``tau_minus`` location. In NEST
tau_minusis a parameter of the postsynaptic neuron (ArchivingNode), not the synapse; here it is a synapse-spec attribute that drives the substrate’s per-postK-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