Tutorial 74: Auto-Critical Reservoir Computing¶
Zero-hyperparameter Liquid State Machine with mean-field auto-criticality. The reservoir self-tunes to edge-of-chaos dynamics for maximum computational capacity. Only the readout layer needs training.
AutoCriticalReservoir¶
import numpy as np
from sc_neurocore.reservoir import AutoCriticalReservoir
# Create reservoir: 64 inputs, 1000 recurrent neurons, 10 outputs
reservoir = AutoCriticalReservoir(
n_inputs=64,
n_neurons=1000,
n_outputs=10,
)
# Train readout on data (reservoir weights are fixed)
train_x = np.random.randn(500, 64)
train_y = np.eye(10)[np.random.randint(0, 10, 500)]
test_x = np.random.randn(100, 64)
predictions = reservoir.train_and_predict(train_x, train_y, test_x)
# Criticality metrics
metrics = reservoir.metrics(test_x)
print(metrics.summary())
Why Auto-Criticality¶
Standard reservoirs require manual tuning of spectral radius, input scaling, and leak rate. The auto-critical reservoir adjusts these automatically using mean-field theory to maintain the edge of chaos — the regime where computational capacity is maximized.
API Reference¶
sc_neurocore.reservoir
¶
Liquid State Machine with mean-field auto-criticality tuning.
AutoCriticalReservoir
¶
Spiking Liquid State Machine with automatic criticality tuning.
Parameters¶
n_inputs : int n_neurons : int Reservoir size. n_outputs : int Readout dimension. threshold : float LIF spike threshold. leak : float Membrane leak factor (0-1). Higher = faster decay. connectivity : float Fraction of possible synapses that exist (sparsity). seed : int
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
step(x)
¶
Process one timestep, return reservoir state (spikes).
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
112 113 114 115 116 117 118 | |
run(inputs)
¶
Run input sequence through reservoir, return state matrix.
Parameters¶
inputs : ndarray of shape (T, n_inputs)
Returns¶
ndarray of shape (T, n_neurons)
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
fit_readout(states, targets, ridge=0.0001)
¶
Train readout via ridge regression.
Parameters¶
states : ndarray of shape (T, n_neurons) targets : ndarray of shape (T, n_outputs) ridge : float Regularization strength.
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
predict(states)
¶
Predict from reservoir states.
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
153 154 155 | |
train_and_predict(train_inputs, train_targets, test_inputs)
¶
Full pipeline: run train, fit readout, run test, predict.
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
157 158 159 160 161 162 163 164 | |
metrics(inputs)
¶
Compute reservoir quality metrics.
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
ReservoirMetrics
dataclass
¶
Reservoir quality metrics.
Source code in src/sc_neurocore/reservoir/auto_reservoir.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |