bat / BAT.jl

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

Add flat index support for bat_marginalize() #380

Closed Micki-D closed 1 year ago

Micki-D commented 2 years ago

Adds support for doing

marg_s = BAT.bat_marginalize(some_shaped_samples, i)

where i is an Integer, Vector or Tuple of Integers or Unit Range.

The new marginalized samples will have N ScalarShaped parameters with the keys being encoded according to the keys of the input data. N being the number of columns selected in the marginalization process.

If a range is input, Expressions corresponding to the selected columns will be generated up to a range of 5. For larger ranges strings will be used to create the encoded symbols to save memory.

oschulz commented 2 years ago

@Cornelius-G can you give this a test?

codecov-commenter commented 2 years ago

Codecov Report

Base: 54.71% // Head: 54.41% // Decreases project coverage by -0.30% :warning:

Coverage data is based on head (df9756e) compared to base (1f47ade). Patch coverage: 0.00% of modified lines in pull request are covered.

:exclamation: Current head df9756e differs from pull request most recent head 8875bb2. Consider uploading reports for the commit 8875bb2 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #380 +/- ## ========================================== - Coverage 54.71% 54.41% -0.31% ========================================== Files 118 118 Lines 5547 5576 +29 ========================================== - Hits 3035 3034 -1 - Misses 2512 2542 +30 ``` | [Impacted Files](https://codecov.io/gh/bat/BAT.jl/pull/380?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat) | Coverage Δ | | |---|---|---| | [src/plotting/MarginalDist\_utils.jl](https://codecov.io/gh/bat/BAT.jl/pull/380/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3Bsb3R0aW5nL01hcmdpbmFsRGlzdF91dGlscy5qbA==) | `0.00% <0.00%> (ø)` | | | [src/plotting/recipes\_prior\_overview.jl](https://codecov.io/gh/bat/BAT.jl/pull/380/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3Bsb3R0aW5nL3JlY2lwZXNfcHJpb3Jfb3ZlcnZpZXcuamw=) | `0.00% <0.00%> (ø)` | | | [src/plotting/vsel\_processing.jl](https://codecov.io/gh/bat/BAT.jl/pull/380/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3Bsb3R0aW5nL3ZzZWxfcHJvY2Vzc2luZy5qbA==) | `0.00% <0.00%> (ø)` | | | [src/samplers/mcmc/mh/mh\_tuner.jl](https://codecov.io/gh/bat/BAT.jl/pull/380/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat#diff-c3JjL3NhbXBsZXJzL21jbWMvbWgvbWhfdHVuZXIuamw=) | `94.11% <0.00%> (-1.48%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bat)

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

oschulz commented 2 years ago

@Cornelius-G, let me know when you're done checking this out?

Cornelius-G commented 1 year ago

@oschulz I did now check this with our examples and the flat indexing seems to work again! So from my side, this would be ready to be merged. Thanks @Micki-D

oschulz commented 1 year ago

Thanks @Micki-D and @Cornelius-G !