For the frozen interop data-shape contract (Float32 rates in [0,1], readout length
n_out, routing_weights length n_regions summing ~1, no owned spike trains), see
interop.md.
This document summarizes the exported API as it exists today.
Preferred (generic) names:
ActivityRegion
RegionRouter
RoutingConfig
update_routing!
routing_diagnostics
adapt_leak!
save_state
load_state!Legacy aliases (same objects):
LobeState # === ActivityRegion
NeroOrchestrator # === RegionRouter
update_relevance! # === update_routing!
nero_diagnostics # === routing_diagnostics
load_state # === load_state! (mutating compatibility alias)ActivityRegion(last_spike_rate::Float32, output::Vector{Float32})
ActivityRegion(n_out::Int)Compact per-region state consumed by update_routing!.
Fields:
last_spike_rate: normalized activity estimate in[0, 1]output: readout vector used for EMA/surprise tracking
Notes:
outputwidth should match the router'sn_outActivityRegion(n_out)creates a zeroed placeholderLobeStateis a constant alias ofActivityRegion
RegionRouter(; n_regions=4, n_out=16, region_names=DEFAULT_REGION_NAMES,
inhibition_matrix=nothing, config=RoutingConfig())Mutable routing state. NeroOrchestrator is a constant alias of RegionRouter
(same constructor keywords — there is no n_lobes / lobe_names kwarg).
Important fields:
n_regions,n_outinhibition_matrix—n_regions × n_regionslateral inhibition weightsconfig— per-router scoring knobs (RoutingConfig)routing_weightsreadout_emaspike_densityprev_routing_weightsprev_relevancesurprisetick_count
Notes:
- the hot path is preallocated and in-place
- default names are historical/example defaults, not required semantics
- callers can provide custom
region_names - if
inhibition_matrixisnothing, a default matrix is built forn_regions(INHIBIT[1:n,1:n]whenn ≤ 4; scaled lateral matrix whenn > 4); a custom matrix must ben_regions × n_regions config.min_scoremust be≤ 1/n_regionsin Float32 (constructor rejects impossible floors)
RoutingConfig()
RoutingConfig(alpha, beta, gamma, ema_decay, min_score, epsilon)Per-router scoring knobs used by update_routing!. Defaults match the module-level
ALPHA…EPSILON constants. All values must be finite; alpha/beta/gamma/
min_score ≥ 0, ema_decay ∈ [0,1], epsilon > 0.
update_routing!(router::RegionRouter, regions::Vector{ActivityRegion})Per-tick routing update.
Behavior:
- increments
tick_count - updates per-region EMA state
- computes surprise and momentum
- applies inhibition
- updates
routing_weights
Expected caller guarantees:
length(regions) == router.n_regions- each
region.outputmatchesrouter.n_out - spike-rate values are already normalized to a meaningful scale for the caller
routing_diagnostics(router::RegionRouter)::StringReturns a short string summary including:
- current tick
- per-region routing weights
- dominant region
- surprise scores
Useful for logs, debugging, and lightweight monitoring.
adapt_leak!(leak_rate::Ref{Float32}, stress::Real;
min_leak::Real=0.01f0,
max_leak::Real=0.25f0,
stress_adapter=nothing)Optional helper that maps a generic stress signal to a leak-rate range.
The second argument is Real (not only Float32) so ordinary numeric literals work.
Default adapter: stress is percent-scale in [0, 100] → unit interval, then
lerped between min_leak and max_leak. Pass stress_adapter to map any other
stress domain into [0, 1]; the adapter output is clamped before interpolation.
Notes:
- this function is optional convenience logic
- it is not required for the core routing algorithm
- custom
stress_adapteris preferred when stress is not percent-scale
These are current limitations, not hidden behavior:
- the package name is generalized (
TemporalFocus); some exported symbols still carry NERO naming - module-level
ALPHA…EPSILONremain as defaults /NERO_*aliases; preferRoutingConfigfor per-router tuning - defaults still imply a four-component example layout for names / historical
INHIBIT - inhibition is configurable via
RegionRouter(; inhibition_matrix=...)(see field notes above) - there is not yet a first-class generic
ComponentState/RouterStatenaming pass
That is part of the package's current stage: usable now, but not yet the final API shape.