Skip to content

Comments

Refactor vectorfield kwargs#1777

Merged
janfb merged 5 commits intomainfrom
refactor-vectorfield-kwargs
Feb 24, 2026
Merged

Refactor vectorfield kwargs#1777
janfb merged 5 commits intomainfrom
refactor-vectorfield-kwargs

Conversation

@janfb
Copy link
Contributor

@janfb janfb commented Feb 21, 2026

fixing kwargs issues in VF methods and adds a couple of edge case fixes for the time schedules.

See #1775 for context

closing #1775

Note: I introduce a new config dataclass for all VF parameters. it is used only internally and basically only for validating user-passed args and raising errors on typos or unknown args. Alternatively, we could do this manually by defining a dict or sequence of known args for each option, but I like the dataclass approach better and we could eventually use it a public config at a later point.

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 93.50649% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.77%. Comparing base (d41efa6) to head (aa3e824).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sbi/inference/trainers/vfpe/npse.py 57.14% 3 Missing ⚠️
sbi/neural_nets/__init__.py 0.00% 1 Missing ⚠️
sbi/neural_nets/estimators/score_estimator.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1777      +/-   ##
==========================================
+ Coverage   87.65%   87.77%   +0.12%     
==========================================
  Files         140      140              
  Lines       12178    12224      +46     
==========================================
+ Hits        10675    10730      +55     
+ Misses       1503     1494       -9     
Flag Coverage Δ
fast 83.42% <93.50%> (?)

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

Files with missing lines Coverage Δ
sbi/inference/trainers/vfpe/base_vf_inference.py 92.76% <100.00%> (-0.05%) ⬇️
sbi/inference/trainers/vfpe/fmpe.py 91.30% <100.00%> (+0.82%) ⬆️
sbi/neural_nets/estimators/base.py 74.60% <100.00%> (ø)
sbi/neural_nets/factory.py 93.24% <100.00%> (+11.31%) ⬆️
sbi/neural_nets/net_builders/vector_field_nets.py 94.03% <100.00%> (+0.72%) ⬆️
sbi/neural_nets/__init__.py 60.00% <0.00%> (+0.90%) ⬆️
sbi/neural_nets/estimators/score_estimator.py 91.89% <94.11%> (+0.35%) ⬆️
sbi/inference/trainers/vfpe/npse.py 84.61% <57.14%> (-5.87%) ⬇️

Copy link
Contributor

@manuelgloeckler manuelgloeckler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, makes sense to change this!

I think one can do a few changes (see comments), especially I would adapt the downstream code to now actually use the introduced dataclass instead of the kwargs.

Copy link
Contributor

@manuelgloeckler manuelgloeckler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Maybe it is already an issue, but I feel like a it would make sense to rewrite all the factories like this (i.e. replace the kwargs with dataclasses internally) so maybe makes sense to add an issue for that.

@janfb janfb merged commit 7e31b4a into main Feb 24, 2026
9 checks passed
@janfb janfb deleted the refactor-vectorfield-kwargs branch February 24, 2026 14:26
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.

2 participants