Repository navigation
docs: fix stale method names and defaults in inference docstrings - #2144
aniketpandey05 wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2144 +/- ##
==========================================
- Coverage 90.69% 90.06% -0.63%
==========================================
Files 142 142
Lines 14855 17733 +2878
==========================================
+ Hits 13472 15971 +2499
- Misses 1383 1762 +379
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
FAQ is out of date (
should i update that as well ? another note a number of public docstring doesn't list all their args |
There was a problem hiding this comment.
Thanks @aniketpandey05 — cleaning up stale docstring references is unglamorous but genuinely useful, and the self_default_x → set_default_x catch is one users would have hit.
Two notes, neither blocking. The spaces one is attached as an inline suggestion on both lines.
The .map() deprecation message still concatenates without a space
Since you're editing these exact lines anyway: the two adjacent string literals keep no space between them, so the emitted message reads ...has been deprecated.Use .set_default_x()to setx, ....
This appears in both copies:
sbi/inference/posteriors/base_posterior.py:392-393sbi/inference/posteriors/vector_field_posterior.py:810-811
Pre-existing rather than introduced here, but it's a one-character fix in a spot you're already touching — see the two inline suggestions.
Stale MCMC guidance in the FAQ (follow-up, not this PR)
docs/faq/question_01_leakage.md:35 still shows:
samples = posterior((num_samples,), x=x_o, sample_with_mcmc=True)sample_with_mcmc no longer exists anywhere under sbi/, so that snippet raises TypeError. Line 9 also quotes the old rejection-sampler warning, which sbi/samplers/rejection/rejection.py:430 has since rewritten to talk about leakage_correction_params / norm_posterior=False instead.
This file isn't in your diff and you already flagged it in the thread, so I'd leave it for a separate issue rather than widen this PR.
Nothing here needs to block the merge — happy to approve once you've had a look.
There was a problem hiding this comment.
Thanks @aniketpandey05 — this is the kind of cleanup that never gets prioritised, and stale docstrings are worse than missing ones because people trust them.
Two nits worth to incoperate, both non-blocking; the space one is attached as an inline suggestion on both occurrences.
- Missing space in the
.map()deprecation message —base_posterior.py:392-393andvector_field_posterior.py:810-811. The adjacent literals concatenate as...has been deprecated.Use.set_default_x().... Pre-existing, but you're editing both lines anyway so it's a one-character fix. - Stale MCMC guidance in the FAQ (follow-up, not this PR) —
docs/faq/question_01_leakage.md:35still showsposterior(..., sample_with_mcmc=True), which exists nowhere undersbi/, so the snippet raisesTypeError. Line 9 also quotes the old rejection-sampler warning thatsbi/samplers/rejection/rejection.py:430has since rewritten to talk aboutleakage_correction_params/norm_posterior=False. You already flagged this yourself, so I'd file it separately rather than widen this diff.
docs: add missing space in .map() deprecation message Co-authored-by: manuelgloeckler <38903899+manuelgloeckler@users.noreply.github.com>
docs: add missing space in .map() deprecation message Co-authored-by: manuelgloeckler <38903899+manuelgloeckler@users.noreply.github.com>
|
@manuelgloeckler thanks for the review, Applied both suggestions, While at it I checked the rest of |
|
@manuelgloeckler I also ran a spell check over |
Fixes docstrings and an error message that refer to arguments, methods or defaults that no longer match the code.
BNRE.train()/NRE_C.train(): removeexclude_invalid_xfrom Args; neither method accepts it..map()error message (NeuralPosterior,VectorFieldPosterior):.self_default_x()->.set_default_x().num_candidate_samplesis10000(not1000), andresampleis the default init strategy (not SIR).ImportanceSamplingPosterior: SIR samples are drawn with.sample(method="sir");.sir_sample()does not exist.NeuralInference.__setstate__:__get_state__->__getstate__.Found by checking docstrings against function signatures and defaults; each change verified by against the code.