Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor nsf #537

Merged
merged 2 commits into from
Jan 18, 2022
Merged

Refactor nsf #537

merged 2 commits into from
Jan 18, 2022

Conversation

janfb
Copy link
Contributor

@janfb janfb commented Aug 26, 2021

refactoring the usage of nsf. Importantly, in case of a one-dimensional x we are currently warning that in this case it wouldn't help to have more than one transform.
However, I think it still makes sense to have multiple transforms. In this case the spline parameters are learned from the conditioning variables only, because there is no "other" dimension in x to learn from. But we can still use multiple transforms to stack conditioners and get more flexibility.

Maybe I am missing something here? But in my current view this makes sense and we should remove the warning.

@janfb janfb self-assigned this Aug 26, 2021
@janfb janfb force-pushed the refactor-nsf branch 2 times, most recently from 2b9a0fc to 5eabd5f Compare August 26, 2021 10:01
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2021

Codecov Report

Merging #537 (d2557b2) into main (4be9fa2) will decrease coverage by 0.02%.
The diff coverage is 32.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #537      +/-   ##
==========================================
- Coverage   66.80%   66.77%   -0.03%     
==========================================
  Files          67       67              
  Lines        4187     4199      +12     
==========================================
+ Hits         2797     2804       +7     
- Misses       1390     1395       +5     
Flag Coverage Δ
unittests 66.77% <32.25%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
sbi/neural_nets/flow.py 41.09% <32.25%> (+3.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4be9fa2...d2557b2. Read the comment docs.

Copy link
Contributor

@michaeldeistler michaeldeistler left a comment

Choose a reason for hiding this comment

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

Thanks for the refactor!

Regarding the warning: I think you're right, stacking multiple rational-quadratics will be non-rational-quadratic, so it might be more flexible. Out of interest: do you have empirical evidence that it improves performance?

@janfb
Copy link
Contributor Author

janfb commented Jan 17, 2022

thanks for the review @michaeldeistler and sorry, I extended the refactor just now.

Regarding empirical evidence, yes! when optimising the MNLE architectures we found that more transforms performed much better. Of course they were slower too, so we found a good trade-off of two transforms in the end.

@michaeldeistler
Copy link
Contributor

Ah, interesting, thanks!

Feel free to merge once tests are passing.

janfb and others added 2 commits January 18, 2022 08:18
- refactor building of transform into lists
- allow multiple nfs transforms for 1d x.
- refactor spline context class
- add tail_bound and hidden_layers kwargs.
- remove nsf transforms warning for 1D x.
@janfb janfb merged commit b8551d0 into main Jan 18, 2022
@janfb janfb deleted the refactor-nsf branch January 18, 2022 07:55
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.

None yet

3 participants