Skip to content

test: drop flaky joint-vs-single assertion in LPV multi-dataset test - #199

Merged
baggepinnen merged 1 commit into
masterfrom
fix/lpv-multidataset-flaky-test
Jun 5, 2026
Merged

test: drop flaky joint-vs-single assertion in LPV multi-dataset test#199
baggepinnen merged 1 commit into
masterfrom
fix/lpv-multidataset-flaky-test

Conversation

@baggepinnen

Copy link
Copy Markdown
Owner

Summary

  • Removes the flaky final assertion in the LPV PEM multi-dataset testset (test/test_lpv.jl:145), which has been failing intermittently on CI.

Root cause

The failing assertion was @test e1 < e2_only1, comparing the joint-fit's training error on d1 against the single-d1-fit's held-out error on d2 — apples-to-oranges. Even after fixing the names to the obviously-intended e2 < e2_only1, the comparison would remain flaky:

  • σy = 0.005 ⟹ noise floor ~2.5e-5.
  • The true LPV system is identical for d1 and d2 (same simulate_affine_lpv factory, different seeds for input/noise/λ trajectory only).
  • A 2-state, ~22-parameter model fit to 1200 samples already recovers θ to within noise.
  • Both e_joint and e_only1 therefore saturate at the noise floor, and the relative ordering is just BFGS/optimizer noise.

Sample failure (deterministic on Julia 1.12 / ubuntu-latest):

Expression: e1 < e2_only1
Evaluated:  4.32e-5 < 2.38e-5

What remains

The multi-dataset path is still adequately covered by:

  • size(x0_mat) == (2, 2) — one initial-state column per experiment.
  • all(isfinite, x0_mat) — optimizer didn't blow up.
  • e1 < 0.05 and e2 < 0.05 — joint fit explains both datasets within bound.

To revive a genuine joint-beats-single signal we'd need disjoint λ-coverage across experiments (so a single-dataset fit is data-poor in the other half) — happy to do that in a follow-up if useful.

Test plan

  • CI green on this branch.

The final assertion `e1 < e2_only1` was both apples-to-oranges (joint-fit
training error on d1 vs single-d1-fit held-out error on d2) and, even
after fixing the names to `e2 < e2_only1`, would still be flaky: with
σy = 0.005 the noise floor is ~2.5e-5, and both quantities saturate
there because the true LPV system is identical across d1 and d2 and a
2-state, 22-parameter model fit to 1200 samples already recovers θ to
within noise. The "joint beats single" signal does not exist in this
regime — the relative ordering is just BFGS noise.

The remaining assertions (shape of x0_mat, per-dataset MSE bounds)
still validate that the multi-dataset path runs to completion, gives
each dataset its own initial state, and explains both datasets well.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.49%. Comparing base (970f1cf) to head (1ad09d8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #199   +/-   ##
=======================================
  Coverage   89.49%   89.49%           
=======================================
  Files          15       15           
  Lines        2722     2722           
=======================================
  Hits         2436     2436           
  Misses        286      286           
Flag Coverage Δ
unittests 89.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@baggepinnen
baggepinnen merged commit f1af47c into master Jun 5, 2026
4 checks passed
@baggepinnen
baggepinnen deleted the fix/lpv-multidataset-flaky-test branch June 5, 2026 06:01
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