bat / BAT.jl

A Bayesian Analysis Toolkit in Julia
Other
209 stars 30 forks source link

Use AutoDiffOperators and add BATContext #411

Closed oschulz closed 1 year ago

oschulz commented 1 year ago

Pass BATContext objects around as the optional last argument of bat_... functions, instead of rng as the optional first argument. The context contains both an RNG and AD selection.

oschulz commented 1 year ago

409 should be fairly easy to adapt, mainly be changing bat_..._impl(rng::AbstractRNG, ...) to bat_..._impl(..., contect::BATContext).

get_rng(context) will return an AbstractRNG where needed.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 68.46% and project coverage change: +0.21 :tada:

Comparison is base (3080556) 54.57% compared to head (c9d7fd9) 54.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #411 +/- ## ========================================== + Coverage 54.57% 54.78% +0.21% ========================================== Files 119 115 -4 Lines 5737 5689 -48 ========================================== - Hits 3131 3117 -14 + Misses 2606 2572 -34 ``` | [Impacted Files](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat) | Coverage Δ | | |---|---|---| | [ext/BATUltraNestExt.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-ZXh0L0JBVFVsdHJhTmVzdEV4dC5qbA==) | `0.00% <ø> (ø)` | | | [src/BAT.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL0JBVC5qbA==) | `100.00% <ø> (ø)` | | | [src/algodefaults/default\_initval\_algorithm.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2FsZ29kZWZhdWx0cy9kZWZhdWx0X2luaXR2YWxfYWxnb3JpdGhtLmps) | `100.00% <ø> (ø)` | | | [src/algodefaults/default\_mode\_estimator.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2FsZ29kZWZhdWx0cy9kZWZhdWx0X21vZGVfZXN0aW1hdG9yLmps) | `100.00% <ø> (ø)` | | | [src/algodefaults/default\_sampling\_algorithm.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2FsZ29kZWZhdWx0cy9kZWZhdWx0X3NhbXBsaW5nX2FsZ29yaXRobS5qbA==) | `50.00% <ø> (-10.00%)` | :arrow_down: | | [src/algodefaults/default\_transform\_algorithm.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2FsZ29kZWZhdWx0cy9kZWZhdWx0X3RyYW5zZm9ybV9hbGdvcml0aG0uamw=) | `53.84% <ø> (+10.09%)` | :arrow_up: | | [src/densities/abstract\_density.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2RlbnNpdGllcy9hYnN0cmFjdF9kZW5zaXR5Lmps) | `72.32% <ø> (+5.35%)` | :arrow_up: | | [src/densities/generic\_density.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL2RlbnNpdGllcy9nZW5lcmljX2RlbnNpdHkuamw=) | `37.14% <ø> (+1.03%)` | :arrow_up: | | [src/plotting/MarginalDist.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3Bsb3R0aW5nL01hcmdpbmFsRGlzdC5qbA==) | `0.00% <0.00%> (ø)` | | | [src/samplers/mcmc/mcmc\_algorithm.jl](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3NhbXBsZXJzL21jbWMvbWNtY19hbGdvcml0aG0uamw=) | `48.00% <ø> (ø)` | | | ... and [25 more](https://app.codecov.io/gh/bat/BAT.jl/pull/411?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat) | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/bat/BAT.jl/pull/411/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat)

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