Spike Encoding Zoo + Auto-Optimizer¶
7 encoding schemes + automatic selection based on data characteristics.
Encoders¶
sc_neurocore.encoding.encoders
¶
7 spike encoding schemes: rate, latency, delta, phase, burst, rank-order, sigma-delta.
No framework provides all 7 in one place with consistent API.
rate_encode(values, T, seed=42)
¶
Rate coding: spike probability proportional to value.
Parameters¶
values : ndarray of shape (N,) Input values in [0, 1]. T : int Number of timesteps. seed : int
Returns¶
ndarray of shape (T, N), binary
Source code in src/sc_neurocore/encoding/encoders.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
latency_encode(values, T)
¶
Latency (Time-to-First-Spike) coding: higher value = earlier spike.
Parameters¶
values : ndarray of shape (N,) Input values in [0, 1]. T : int
Returns¶
ndarray of shape (T, N), binary
Source code in src/sc_neurocore/encoding/encoders.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
delta_encode(values, threshold=0.1)
¶
Delta coding: spike when change exceeds threshold.
Parameters¶
values : ndarray of shape (T,) or (T, N) Time-varying input signal. threshold : float
Returns¶
ndarray of same shape, binary
Source code in src/sc_neurocore/encoding/encoders.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
phase_encode(values, T, n_phases=8)
¶
Phase coding: value encoded as spike phase within oscillation cycle.
Parameters¶
values : ndarray of shape (N,) Input values in [0, 1]. T : int n_phases : int Number of phase bins per cycle.
Returns¶
ndarray of shape (T, N), binary
Source code in src/sc_neurocore/encoding/encoders.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
burst_encode(values, T, max_burst=5)
¶
Burst coding: value encoded as burst length (consecutive spikes).
Parameters¶
values : ndarray of shape (N,) Input values in [0, 1]. T : int max_burst : int Maximum burst length for value=1.
Returns¶
ndarray of shape (T, N), binary
Source code in src/sc_neurocore/encoding/encoders.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
rank_order_encode(values, T)
¶
Rank-order coding: neurons fire in order of decreasing value.
Parameters¶
values : ndarray of shape (N,) T : int
Returns¶
ndarray of shape (T, N), binary
Source code in src/sc_neurocore/encoding/encoders.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
sigma_delta_encode(values, threshold=0.1)
¶
Sigma-delta coding: integrate error, spike when threshold exceeded.
Parameters¶
values : ndarray of shape (T,) or (T, N) Time-varying signal. threshold : float
Returns¶
ndarray of same shape, binary
Source code in src/sc_neurocore/encoding/encoders.py
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 | |
Optimizer¶
sc_neurocore.encoding.optimizer
¶
Auto-select optimal encoding scheme based on data characteristics.
Profiles input data (sparsity, temporal structure, dynamic range) and scores each encoding scheme. Returns ranked recommendations.
No framework provides automatic encoding selection.
EncodingOptimizer
¶
Profile data and recommend optimal spike encoding.
Parameters¶
T : int Number of simulation timesteps.
Source code in src/sc_neurocore/encoding/optimizer.py
36 37 38 39 40 41 42 43 44 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 | |
profile(data)
¶
Compute data statistics relevant to encoding selection.
Parameters¶
data : ndarray of shape (N,) or (T_data, N) Input data (values should be in [0, 1] or will be normalized).
Returns¶
dict with: mean, std, sparsity, temporal_autocorrelation, dynamic_range
Source code in src/sc_neurocore/encoding/optimizer.py
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 | |
recommend(data)
¶
Recommend encoding schemes ranked by suitability.
Parameters¶
data : ndarray of shape (N,) or (T_data, N)
Returns¶
list of EncodingRecommendation, sorted by score descending
Source code in src/sc_neurocore/encoding/optimizer.py
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 | |
EncodingRecommendation
dataclass
¶
Recommendation for one encoding scheme.
Source code in src/sc_neurocore/encoding/optimizer.py
25 26 27 28 29 30 31 32 33 | |