aesara-devs / aehmc

An HMC/NUTS implementation in Aesara
MIT License
33 stars 6 forks source link

add the HMC kernel #5

Closed rlouf closed 3 years ago

rlouf commented 3 years ago

This PR adds the HMC kernel to aeasa-hmc. I did not factor the code as much as I did with BlackJAX, I will do it when implementing NUTS.

rlouf commented 3 years ago

@brandonwillard this is ready for review.

rlouf commented 3 years ago

Should we cut a release with an example notebook and maybe the comparison with PyMC3's sampler or should we move on to NUTS immediately?

brandonwillard commented 3 years ago

Should we cut a release with an example notebook and maybe the comparison with PyMC3's sampler or should we move on to NUTS immediately?

Yeah, let's start with a simple example notebook. From there we can dig into the details and iron out any glaring performance issues before things get more involved.

brandonwillard commented 3 years ago

FYI: I just rebased this branch so that it picks up all the repository changes.

codecov-commenter commented 3 years ago

Codecov Report

Merging #5 (fff2571) into main (201082f) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head fff2571 differs from pull request most recent head af861b4. Consider uploading reports for the commit af861b4 to get more accurate results Impacted file tree graph

@@            Coverage Diff            @@
##              main        #5   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         5    +1     
  Lines           64        97   +33     
  Branches         3         3           
=========================================
+ Hits            64        97   +33     
Impacted Files Coverage Δ
aehmc/hmc.py 100.00% <100.00%> (ø)
aehmc/metrics.py 100.00% <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 201082f...af861b4. Read the comment docs.

rlouf commented 3 years ago

It does it well enough to recover the parameters of the linear regression, but that's not a very quantitative assessment. I think Stan and tfp have some good tests for that and we could get some inspiration there; HMC is simple enough to debug when there's something wrong, but errors in NUTS can be very subtle and hard to catch.

rlouf commented 3 years ago

You can review the notebook, good on my end. In the meantime I'm switching to NUTS.

rlouf commented 3 years ago

Can we merge this?