ReactiveBayes / RxInfer.jl

Julia package for automated Bayesian inference on a factor graph with reactive message passing
MIT License
237 stars 24 forks source link

Enhance the autoupdates macro #306

Closed bvdmitri closed 2 months ago

bvdmitri commented 2 months ago

This PR reimplements the @autoupdates macro by

This PR fixes https://github.com/ReactiveBayes/RxInfer.jl/issues/61

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 90.36145% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 84.51%. Comparing base (29061e5) to head (10c6648).

Files Patch % Lines
src/inference/autoupdates.jl 90.82% 21 Missing :warning:
src/model/model.jl 66.66% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #306 +/- ## ========================================== + Coverage 83.19% 84.51% +1.32% ========================================== Files 18 18 Lines 1297 1466 +169 ========================================== + Hits 1079 1239 +160 - Misses 218 227 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

wouterwln commented 2 months ago

@bvdmitri what if we make the autoupdates macro recursive such as constraints, meta and init? Might be nice to also update prior distributions for variables hidden in some submodel.

bvdmitri commented 2 months ago

I like the idea @wouterwln , I think we can accomplish this in a separate PR, since we really need a generic code for those

for _something_ in submodel 

end

pattern. As far as I understand now its mostly copy-pasted for all macros, lets not do that again. Also, this would require to extend the VarDict, which now looks only at the top-level.

bvdmitri commented 2 months ago

I've also come to realize that to support this feature in submodels, we'll need a more integrated approach with GraphPPL. This is because the autoupdates requires that certain arguments remain unspecified. However, I don't believe we can create a submodel with certain arguments underspecified.