A classifier throws away time
In Volume I you learned to map a window of neural features to a label or a reach direction with a static classifier. That is exactly right for discrete choices — pick a letter, select a target. But fluent, continuous control of a cursor or a robotic arm is different: the state you are decoding at time k is tightly coupled to the state at k-1. Velocity is smooth, limbs have inertia, and intentions do not teleport. A per-window classifier treats each moment as an independent guess and discards that structure, which is why naive continuous decoders look jittery and lag-prone.
The two equations of a state-space model
A state-space model is written as two equations. The state (process) equation says how the hidden kinematic state x_k (say position and velocity) evolves; the observation equation says how the neural measurement y_k (firing rates or band-power features) reflects that state.
x_k = A\,x_{k-1} + w_k, \qquad y_k = C\,x_k + v_kA is the dynamics (transition) matrix, C the observation (tuning) matrix; the noises are Gaussian, w_k ~ N(0, W) and v_k ~ N(0, Q).
Two rules describe the system: how the hidden state (say, intended cursor velocity) evolves step to step, and how that state shows up in the neural recording. Everything after is inferring the hidden state from noisy observations.
- x_k
- The hidden state at time k, e.g. intended velocity.
- A
- The dynamics (transition) matrix — how the state carries forward.
- C
- The observation (tuning) matrix — how the state maps to the neural signal y_k.
- w_k,\ v_k
- Gaussian process noise and measurement noise.
This is the state-space model behind cursor-control BCIs.
Read the two equations as two beliefs. A and W encode a prior about how the state moves — a physics-of-intention model. C and Q encode a likelihood, an encoding model, of how neurons light up for a given movement. Everything in state-space decoding is a disciplined way of combining those two beliefs.
Recursive Bayesian estimation
The quantity we actually want is the posterior over the state given every measurement so far, p(x_k \mid y_{1:k}). Recursive Bayesian estimation computes it in two alternating moves: predict (push the previous posterior through the dynamics, which spreads it out) and update (multiply by the likelihood of the new measurement and renormalize, which sharpens it).
\begin{aligned} \text{predict:}\quad & p(x_k \mid y_{1:k-1}) = \int p(x_k \mid x_{k-1})\,p(x_{k-1} \mid y_{1:k-1})\,dx_{k-1} \\ \text{update:}\quad & p(x_k \mid y_{1:k}) \propto p(y_k \mid x_k)\,p(x_k \mid y_{1:k-1}) \end{aligned}The Bayes filter: a prediction integral (Chapman–Kolmogorov) followed by a Bayes-rule correction.
Track a belief (a probability) about the hidden state in two steps: predict where it moves next, then correct that guess using the new measurement. Repeat at every time step.
- p(x_k \mid y_{1:k-1})
- The predicted belief before seeing y_k.
- p(x_k \mid y_{1:k})
- The updated belief after seeing y_k.
- p(x_k \mid x_{k-1})
- The dynamics model driving the prediction integral.
- p(y_k \mid x_k)
- The likelihood — how well a state explains the data.
This is recursive Bayesian estimation; the Kalman filter is its linear-Gaussian special case.
This recursion is exact but, in general, the integral is intractable. The entire zoo of decoders in this track are different ways of making it computable: under linear-Gaussian assumptions the posterior stays Gaussian forever and the recursion collapses to the Kalman filter; if the state is discrete you get a hidden Markov model; if it is nonlinear or non-Gaussian you reach for the particle filter.
The predict–update loop, running in real time
- Predict: propagate the state estimate through the dynamics A; the uncertainty (covariance) grows.
- Acquire: read the newest neural feature vector y_k from the amplifier.
- Update: compare the prediction against y_k, and pull the estimate toward the evidence in proportion to how much you trust it.
- Emit: send the corrected state (velocity command) to the effector and loop.
Why this reframing pays off
Casting decoding as state estimation buys four things at once: smoothness for free (the dynamics prior filters out jitter), principled fusion of prior and evidence rather than ad-hoc averaging, an explicit uncertainty you can act on, and two interpretable knobs — how much to trust the dynamics versus the neurons. The rest of the track cashes those in: the velocity Kalman filter that drives real intracortical cursors, the encoding models that put neuroscience into C, the nonlinear filters for when linearity fails, and the closed-loop tricks such as ReFIT that make it all actually work on a person.