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

1D marginals #600

Merged
merged 6 commits into from
Jan 27, 2022
Merged

1D marginals #600

merged 6 commits into from
Jan 27, 2022

Conversation

gmoss13
Copy link
Contributor

@gmoss13 gmoss13 commented Jan 24, 2022

Added functions to plot just the 1D marginals. Using same interface as pairplot functions.

@gmoss13 gmoss13 linked an issue Jan 24, 2022 that may be closed by this pull request
Copy link
Contributor

@janfb janfb 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 tackling this, looks great!

I added some comments about black and isort and I have two high level comments / questions: 1) why do we separate the code into the analysis module and the utils module? 2) we now have a lot of code repetition between marginal_plot and pairplot, e.g., how the limits are set up, how the diag_fun is built. Whenever there is such a repetition I think it makes sense to outsource the code to a function, which is then called by pairplot and marginal_plot, i.e., a function get_limits(samples...) and a function get_diag_fun(samples...) -> Callable.

Let's discuss this later in the meeting.

sbi/analysis/__init__.py Show resolved Hide resolved
sbi/analysis/plot.py Outdated Show resolved Hide resolved
sbi/utils/plot.py Outdated Show resolved Hide resolved
sbi/utils/plot.py Outdated Show resolved Hide resolved
@gmoss13 gmoss13 marked this pull request as ready for review January 25, 2022 15:15
@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2022

Codecov Report

Merging #600 (222bd1f) into main (0800e8b) will decrease coverage by 0.27%.
The diff coverage is 45.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #600      +/-   ##
==========================================
- Coverage   66.94%   66.67%   -0.28%     
==========================================
  Files          67       66       -1     
  Lines        4251     4267      +16     
==========================================
- Hits         2846     2845       -1     
- Misses       1405     1422      +17     
Flag Coverage Δ
unittests 66.67% <45.42%> (-0.28%) ⬇️

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

Impacted Files Coverage Δ
sbi/analysis/sensitivity_analysis.py 15.48% <0.00%> (ø)
sbi/utils/sbiutils.py 76.32% <ø> (ø)
sbi/analysis/plot.py 46.00% <44.63%> (-34.00%) ⬇️
sbi/analysis/__init__.py 100.00% <100.00%> (ø)
sbi/inference/base.py 77.53% <100.00%> (ø)
sbi/utils/__init__.py 100.00% <100.00%> (ø)
sbi/utils/tensorboard_output.py 86.25% <100.00%> (ø)

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 8f0a2d5...222bd1f. Read the comment docs.

@gmoss13
Copy link
Contributor Author

gmoss13 commented Jan 26, 2022

Everything is added and refactored now - only question is do we want the keywords passed to 1D marginal plots to keep the "diag" terminology for consistency, or change it to something like "col"?

Also need to add some comments to new functions.

Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! I added small comments and it needs a rebase on main to resolve some small conflicts.

sbi/analysis/plot.py Show resolved Hide resolved
sbi/analysis/plot.py Show resolved Hide resolved
sbi/analysis/plot.py Outdated Show resolved Hide resolved
sbi/analysis/plot.py Outdated Show resolved Hide resolved
sbi/analysis/plot.py Show resolved Hide resolved
sbi/analysis/plot.py Show resolved Hide resolved
@janfb janfb merged commit 4b3d260 into main Jan 27, 2022
@janfb janfb deleted the 1D_marginals branch January 27, 2022 13:46
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.

plot 1D marginals
3 participants