Repository navigation
fix: restrict amortized VI to rKL only - #2074
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2074 +/- ##
==========================================
+ Coverage 90.03% 90.04% +0.01%
==========================================
Files 142 142
Lines 14657 15704 +1047
==========================================
+ Hits 13196 14141 +945
- Misses 1461 1563 +102
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
@janfb could you please take a look at this PR when you have a moment thanks! |
train_amortized(params=VIPosteriorParameters(vi_method="IW")) still fitted rKL silently, because params.vi_method was never read. The guard now checks it too, and the error message no longer claims the method was set at construction. The test used the linear_gaussian_setup fixture, which trains NLE on 7000 simulations (80 s setup in fast CI) for a check that raises before any training. It now uses FakePotential and parametrizes over the method and over both ways of passing it. Update the VIPosteriorParameters.vi_method docstring and the VI how-to guide, which still said non-rKL methods are ignored in amortized VI.
|
@BHARATH0153 thanks for picking this up, and for posting your plan on the issue first. The check is in the right place, so I pushed one commit on top of yours to finish it.
thanks for fixing this, Jan |
What does this PR do?
Restricts
VIPosterior.train_amortized()to the reverse-KL objective. Whenself.vi_methodis not"rKL",train_amortized()now raisesNotImplementedErrorinstead of silently fitting the reverse KL. The single-observationtrain()remains unchanged and continues to support all fourvi_methodvalues (rKL,fKL,IW,alpha).Also updates docstrings to state that amortized training only supports
rKL, and adds a regression test. This implements Option 1 as suggested by @janfb in #2073.Does this close any issues?
Fixes #2073.
Anything else we should know?
The new test checks that
train_amortized()raisesNotImplementedErrorforfKL,IW, andalpha, while existing tests cover therKLcase.thanks to @janfb for options
Checklist
uv run pytest -n auto -m "not slow and not gpu"passes.uv run pre-commit run --all-filespasses (ruff and formatting).uv run pyright sbipasses.AI USAGE
Claude opus helped for the tests and for the right option
every thing tested locally