Propagation¶
APPNP spreading activation, STDP edge updates, and LIF pressure decay.
compute_propagation ¶
compute_propagation(graph: DiGraph, source_id: str, grade: Grade, plasticity: Plasticity) -> dict[str, float]
Run APPNP propagation from a fired neuron, return pressure deltas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
DiGraph
|
The circuit's NetworkX DiGraph. |
required |
source_id
|
str
|
The neuron that was just reviewed. |
required |
grade
|
Grade
|
The review grade (affects propagation strength). |
required |
plasticity
|
Plasticity
|
Plasticity parameters. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dict of {neuron_id: pressure_delta} for all affected neurons. |
dict[str, float]
|
The source neuron is NOT included (it gets reset separately). |
compute_stdp ¶
compute_stdp(graph: DiGraph, fired_id: str, grade: Grade, fired_at: datetime, plasticity: Plasticity) -> list[tuple[str, str, float, bool]]
Compute STDP weight updates for edges adjacent to the fired neuron.
For each edge connecting fired_id to a neighbor: - If neighbor fired recently (within tau_stdp), compute timing-dependent weight change using exponential STDP window. - Pre→post (LTP): Δw = +a_plus * exp(-|Δt| / tau_stdp) - Post→pre (LTD): Δw = -a_minus * exp(-|Δt| / tau_stdp)
MISS grade does not trigger co-fire or LTP (only LTD if applicable).
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, float, bool]]
|
List of (pre, post, new_weight, is_co_fire) for each updated edge. |
decay_all_pressure ¶
Apply LIF leak to all neuron pressures.
Pressure decays exponentially: u(t) = u * exp(-dt / tau_m)