Repository navigation
Select production epoch from pooled EMA validation curve - #36
MaxLinCode wants to merge 1 commit into
Conversation
Track an EMA of the full model state during fold training and validate the averaged weights each epoch. Pool the per-fold validation BCE curves, smooth the pooled curve with a centered three-epoch moving average, and train the all-sources production checkpoint for the argmin epoch instead of the median of per-fold minima. Record the pooled, smoothed, and per-fold curves in the fold and production checkpoints and metrics, persist EMA state in recovery checkpoints, and cover EMA validation plus pooled selection with tests.
|
Follow-up: the cross-decoder check changes the diagnosis. I re-decoded the same saved held-out test predictions with the baseline decoder and with the new per-fold decoders (30 fps, same rows, same evaluation code):
The new model predictions are better when decoded with the baseline decoder: +0.054 interval F1, -1.68 boundary MAE, false splits 2.75 -> 1.50. Conversely, the old predictions with the new decoder are much worse. So the interval regression is almost entirely decoder calibration/selection, not EMA or pooled epoch selection. Per camera with the fixed baseline decoder: Bothell 0.698 -> 0.699 (wash, boundary MAE 12.57 -> 14.45), Malaysia 0.783 -> 0.837, Max-vs-Lucas 0.796 -> 0.889, Max-vs-Nik 0.805 -> 0.872. Why the decoder moved:
Corrected conclusion: do not reject EMA/pooled selection because of the interval regression. Under a fixed decoding rule the model is better. The decoder needs a robust calibration policy: pooled/leave-one-camera-out tuning instead of per-fold validation tuning, no Also, for the record: held-out frame BCE did not get worse. Macro raw BCE improved 0.2934 -> 0.2232; only Max-vs-Nik worsened (0.2092 -> 0.2277). The higher production train BCE is the earlier stop, not a worse held-out objective. |
Summary
metrics.json; persist EMA state in recovery checkpoints.ema_decayin the training recipe and CLI (default 0.999 with warm-up).Per-fold checkpoints still select their own best EMA validation epoch for the single held-out-camera evaluation; only production epoch selection is pooled.
Test plan
PYTHONPATH=. .venv/bin/python -m pytest -q— 460 passed.