anesthetic
anesthetic copied to clipboard
NDE implementation
Description
Adding in optional neural density estimator plot functions as an alternative to KDE and histogram plotters.
Fixes #334
Checklist:
- [ ] I have performed a self-review of my own code
- [ ] My code is PEP8 compliant (
flake8 anesthetic tests
) - [ ] My code contains compliant docstrings (
pydocstyle --convention=numpy anesthetic
) - [ ] New and existing unit tests pass locally with my changes (
python -m pytest
) - [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have appropriately incremented the semantic version number in both README.rst and anesthetic/_version.py
Just at a glance, you might want to have a look at how the optional dependency of fastkde
is handled so you can do something similar with margarine
Codecov Report
Attention: Patch coverage is 11.11111%
with 136 lines
in your changes are missing coverage. Please review.
Project coverage is 90.35%. Comparing base (
54170d8
) to head (f351caa
).
Files | Patch % | Lines |
---|---|---|
anesthetic/plot.py | 1.53% | 128 Missing :warning: |
anesthetic/plotting/_matplotlib/hist.py | 62.50% | 6 Missing :warning: |
anesthetic/plotting/_core.py | 50.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #353 +/- ##
===========================================
- Coverage 100.00% 90.35% -9.65%
===========================================
Files 36 36
Lines 3043 3195 +152
===========================================
- Hits 3043 2887 -156
- Misses 0 308 +308
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
tests now failing as expected (I'd forgotten to add margarine to the 'all' dependency!)
@AdamOrmondroyd Cant remember what needs doing here? is it just the tests need tidying? and master merging?
@AdamOrmondroyd Cant remember what needs doing here? is it just the tests need tidying? and master merging?
The tests need a rethink, because simply adding nde everywhere we previously saw kde slows everything down too much
Also at least one of them appears to have failed at the last time of running, and you're missing some coverage
Ahh yes the NDEs are not particularly quick... maybe like a few minutes for a few thousands of samples (dependent on the architecture). Has the potential to slow the tests down...
Looks like the test failed because of a version mismatch between TensorFlow and TensorFlow Probability. What does the extras
flag turn on in the tests?
@AdamOrmondroyd Cant remember what needs doing here? is it just the tests need tidying? and master merging?
This also needed waiting for the margarine docs to work, which is now the case. So now the NDE docstrings properly link to the margarine docs.
@AdamOrmondroyd pointed out that I might have set the code up to train a new NDE for every panel in the corner plot if I just replaced KDE with NDE in the plotting script. I think it should be possible to train an nD NDE and use this to plot contours on a corner plot. Need to check over the code though.