Skip to content

feat(cadecon): kernel-RMSE convergence metric + reworked asymptote dashboard#170

Open
daharoni wants to merge 1 commit into
mainfrom
feat/cadecon-kernel-rmse-convergence
Open

feat(cadecon): kernel-RMSE convergence metric + reworked asymptote dashboard#170
daharoni wants to merge 1 commit into
mainfrom
feat/cadecon-kernel-rmse-convergence

Conversation

@daharoni

Copy link
Copy Markdown
Contributor

Summary

Replaces CaDecon's iterative convergence stopping criterion with a peak-normalized RMSE between successive iterations' kernels, and reworks the Asymptote dashboard so the two signals we actually watch for convergence read as a matched pair.

Previously convergence was gated on the max relative change of the kernel's (t_peak, FWHM). That over-penalized t_peak jitter on the poorly-constrained rising edge — a few-ms wobble read as ~8% relative change and reset the patience streak, delaying convergence over a change that barely altered the kernel. A whole-waveform RMSE weights each parameter's change by how much it actually moves the kernel (that same wobble now reads ~1%).

Metric

  • Computed on the analytic parametric kernel (peak = 1 by construction — no extra renormalization), not the un-normalized free-form h_free.
  • Both kernels sampled on a shared native-fs grid over [0, 5·max(τ_decay)] (the max never truncates a genuine tail difference), floored to 24 samples so a low-fs / fast kernel doesn't collapse to a handful of points.
  • convergenceTol default 0.02 → 0.005 (now a fraction of peak, ≈ a 2% τ change). Kernel RMSE remains the sole gate; the final kernel is still the median shape of the trailing window.
  • Activity-stability metric now uses a symmetric max(‖s_new‖, ‖s_old‖) denominator so a collapsing cell can't blow up the ratio.

Dashboard

Asymptote tab reworked into two rows:

  • Top (log-y, decay-toward-0): Kernel change (RMSE) with a reactive tolerance band + patience highlight; Activity change with a marker showing both the gate iteration and the +1 iteration where activity actually settles (structural lag — spikes are inferred from the prior kernel).
  • Bottom (linear, rise-to-plateau): kernel-fit R², reconstruction PVE.

Code quality

  • Convergence metric lives in @calab/compute (kernel-math.ts), sharing a sampleBiexp core with computeKernel, with direct unit tests.
  • Chart markers share a drawVerticalMarker primitive; the two trend panels share a TrendChart shell.
  • Docs, README, and tutorial steps updated to describe the RMSE criterion.

Testing

  • Typecheck passes across all apps (cadecon, catune, carank, admin) and packages.
  • Lint + Prettier clean.
  • Tests pass: compute 81 (incl. new kernelShapeRmse cases), cadecon 33, catune 26.
  • Manually exercised in the running app; convergence and activity now flatten within one iteration of each other with the gate/settles markers straddling.

🤖 Generated with Claude Code

…shboard

Replace the convergence stopping criterion — previously the max relative
change of the kernel's (t_peak, FWHM) — with the peak-normalized RMSE between
successive iterations' bi-exponential kernels. The relative shape delta
over-penalized t_peak jitter on the poorly-constrained rising edge, delaying
convergence over changes that barely alter the kernel; a whole-waveform RMSE
weights each parameter's change by how much it actually moves the kernel.

Metric details:
- Compute on the analytic parametric kernel (peak=1 by construction; no extra
  renormalization), not the un-normalized free-form h_free.
- Sample both kernels on a shared native-fs grid over [0, 5*max(tau_decay)] so
  neither decay tail is truncated; floor to 24 samples for low-fs/fast kernels.
- convergenceTol default 0.02 -> 0.005 (now a fraction of peak, ~2% tau change).
- Kernel RMSE remains the sole convergence gate; the final kernel is still the
  median shape of the trailing window.

Activity-stability metric now uses a symmetric max(||s_new||,||s_old||)
denominator so a collapsing cell can't blow up the ratio.

Asymptote dashboard reworked into two rows: the two convergence signals
(kernel RMSE, activity change) on a shared log-y axis that decays toward 0,
with a reactive tolerance band on the kernel panel; R²/PVE stay linear
plateau panels. The activity panel marks both the gate iteration and the
one-iteration-later point where activity settles (structural lag: spikes are
inferred from the prior iteration's kernel).

The metric lives in @calab/compute (kernel-math.ts) sharing a sampleBiexp core
with computeKernel, with direct unit tests. Chart marker drawing shares a
drawVerticalMarker primitive; the two trend panels share a TrendChart shell.
Docs and tutorials updated to describe the RMSE criterion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daharoni
daharoni requested a review from kaghi July 22, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant