Noisy Sensor Denoising
Each row is five noisy samples of a triangle-wave sensor ending at time t. Beat the trailing moving average on MSE.
Your goal
Beat the moving average baseline — score lower MSE than 0.2575 on the hidden 30 test rows. The first winning run records 25 points in this browser.
- Train
- 60 × 5
- Hidden test
- 30 rows
- Metric
- MSE · lower
- Baseline score
- 0.2575
Data
A period-20 triangle wave with slope +0.25 for ten steps and -0.25 for the next ten, plus independent uniform noise in [-0.5, 0.5]. Every row holds the last five noisy samples (t-4 … t) and the label is the clean signal at t. 60 train rows (t = 4 … 63) and 30 hidden test rows (t = 64 … 93) share one LCG stream (seed 44).
accent: clean signal (the label) · muted: last sample of each noisy window
The five-sample noisy windows (muted) against the clean wave each window ends on (accent).
Method & theory
read before you submitEvery row is a five-sample window of a noisy triangle wave, and the label is the clean value at the end of the window. The trailing average lags; a smarter filter should not.
The wave under the noise
The generator walks 94 steps of a period-20 triangle wave: +0.25 per step for ten steps, then -0.25 for ten, plus independent uniform noise in [-0.5, 0.5] (variance 1/12, about 0.0833, so the noise standard deviation 0.289 is larger than one step of the wave). Every row holds the five noisy samples t-4 through t, and the label is the clean wave value at t. The 60 training rows cover t = 4 to 63 and the 30 hidden rows t = 64 to 93 from one random stream.
The baseline lags by exactly two steps
Averaging the five window samples estimates the centre of the window, t-2, not its end. On a ramp of slope 0.25 that is a bias of 2 * 0.25 = 0.5, so the squared bias alone is 0.25 before noise - which is why the moving-average baseline records MSE 0.2575 on the hidden rows despite the label being comparatively clean.
Two filters that remove the lag
Fit a least-squares line to each five-point window and evaluate it at the last sample: hidden MSE drops to about 0.053. Or learn five weights plus a bias on the 60 training rows; the fit comes out near (-0.005, -0.101, 0.111, 0.290, 0.683), heavily weighting the most recent sample, and reaches about 0.049. Both beat the noise floor of a single sample because the estimate borrows information from all five points.
Where the residuals bunch up
Windows that straddle a turning point (t mod 20 near 9, 10, 19, or 0) are not linear, so a straight-line fit overshoots there and the largest residuals sit at the peaks. The wave's two slope regimes are symmetric, which is why one set of weights works for both the up and down ramps.
Pitfalls
- Keeping a symmetric weight vector such as the five-point mean. Symmetric weights estimate the window centre and reproduce the two-step lag the challenge is designed to punish.
- Using a one-step finite difference (last sample minus the previous one) as the estimate. Its error variance is 2 * 0.0833 = 0.167, about triple the error of a least-squares line over the whole window.
- Learning weights on the first 60 rows and then feeding windows in reversed order at predict time. The weights are asymmetric, so index order t-4 ... t is part of the model contract.
Takeaway. Denoising is estimation with structure: once you know the signal is piecewise linear, the filter is a line fit, not an average.
Hint
A trailing mean lags a ramp by two steps. Fit a least-squares line to each window and evaluate it at the last point — or learn the five filter weights (plus a bias) from the training rows.