A constant-velocity Kalman filter running live, right now, in your browser — smoothing a noisy real-time signal into a trustworthy estimate. No server, no model download: this is the actual recursive filter, in JavaScript, updating every tick.
Drag these while it's running — the filter re-tunes in real time.
Each tick, a fresh noisy reading of an underlying trend arrives (in production this would be a polled
public API — station bike counts, sensor data, anything noisy and periodic). The filter predicts the
next state from a constant-velocity model, then corrects that prediction against the new measurement,
weighted by how much it trusts the model (Q) vs. the sensor (R). This is the exact algorithm in
python/kalman.py, reimplemented here in JS so it runs live client-side.
// core recursion, identical to the Python reference
predict(dt) { x = F(dt) @ x; P = F(dt) @ P @ F(dt).T + Q(dt) }
update(z) { y = z - H @ x; S = H @ P @ H.T + R;
K = P @ H.T / S; x += K * y; P -= K @ H @ P }