[PR] fix(tui): smooth noisy chart curves (EMA) + scale to the live run #142

Closed
opened 2026-07-30 22:30:23 +00:00 by vxfemboy · 0 comments
Owner

Mirrored from GitHub — originally by @vxfemboy. https://github.com/femboyisp/emry/pull/122

Bug

TUI loss/val_loss charts render as scattered confetti (or invisible), not a readable line — worse with a --compare baseline.

Root cause (reproduced from the user's real run over SSH)

Two issues, in priority order:

  1. Noise (primary). Per-step training loss is genuinely noisy — it oscillates across its full range every step (1.44, 0.65, 1.12, 0.86, 0.71…). The chart plotted every raw point via a spike-preserving min/max band, so the noise filled the whole panel as confetti.
  2. Scale (secondary). The y-axis was the union of the live curve and the baseline; a wide-range baseline (prior loss 0.001–5.5 vs live 0.6–2.0) crushed the live curve.

Fix

  • Smooth the displayed curve with an EMA trend line (adaptive span ≈ 8% of visible points, clamped 3–64), like wandb/tensorboard. Baseline smoothed the same way for a like-for-like overlay. (ema_smooth, adaptive_ema_span + tests.)
  • Scale to the live curve, drawing the baseline only where it overlaps (off-scale hidden, title notes it). (chart_yscale + tests.)

Verified locally against the actual run data: raw = confetti (matches the report), EMA = clean descending line. Full rust gate green (fmt, clippy, tests, ≥90% coverage).

<!-- gitbitch --> > _Mirrored from GitHub — originally by `@vxfemboy`._ [https://github.com/femboyisp/emry/pull/122](https://github.com/femboyisp/emry/pull/122) ## Bug TUI loss/val_loss charts render as scattered confetti (or invisible), not a readable line — worse with a `--compare` baseline. ## Root cause (reproduced from the user's real run over SSH) Two issues, in priority order: 1. **Noise (primary).** Per-step training loss is genuinely noisy — it oscillates across its full range every step (`1.44, 0.65, 1.12, 0.86, 0.71…`). The chart plotted every raw point via a spike-preserving min/max band, so the noise filled the whole panel as confetti. 2. **Scale (secondary).** The y-axis was the *union* of the live curve and the baseline; a wide-range baseline (prior loss 0.001–5.5 vs live 0.6–2.0) crushed the live curve. ## Fix - **Smooth the displayed curve** with an EMA trend line (adaptive span ≈ 8% of visible points, clamped 3–64), like wandb/tensorboard. Baseline smoothed the same way for a like-for-like overlay. (`ema_smooth`, `adaptive_ema_span` + tests.) - **Scale to the live curve**, drawing the baseline only where it overlaps (off-scale hidden, title notes it). (`chart_yscale` + tests.) Verified locally against the actual run data: raw = confetti (matches the report), EMA = clean descending line. Full rust gate green (fmt, clippy, tests, ≥90% coverage).
vxfemboy 2026-07-30 22:30:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
femboy/emry#142
No description provided.