pymc-devs / nuts-rs

A implementation of NUTS in rust
MIT License
57 stars 3 forks source link

Use 1. as initial mass matrix if grad is zero #7

Closed aseyboldt closed 1 year ago

aseyboldt commented 1 year ago

We initialize the mass matrix using 1/grad at the initial point. If the gradient is exactly zero, this will not work however. I'm not exactly sure what we should do in this case (maybe actually just reject that initial point?), but in this fix I just set those initial values to 1.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (73cc0b3) 87.84% compared to head (98d4d34) 87.84%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7 +/- ## ======================================= Coverage 87.84% 87.84% ======================================= Files 8 8 Lines 1752 1753 +1 ======================================= + Hits 1539 1540 +1 Misses 213 213 ``` | [Impacted Files](https://app.codecov.io/gh/pymc-devs/nuts-rs/pull/7?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymc-devs) | Coverage Δ | | |---|---|---| | [src/adapt\_strategy.rs](https://app.codecov.io/gh/pymc-devs/nuts-rs/pull/7?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymc-devs#diff-c3JjL2FkYXB0X3N0cmF0ZWd5LnJz) | `87.26% <100.00%> (+0.02%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.