ReactiveBayes / RxInfer.jl

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

Improve documentation involving distributions #115

Closed bratslavia closed 10 months ago

bratslavia commented 1 year ago

(Apologies if this exists somewhere and I've missed it, but I've looked many times across the github and doc pages of this and all the component projects, and can't find anything.)

I am very interested in trying out this package for some projects of mine, but it's a bit hard finding out what distributions, exactly, are supported. I can see the list in /ReactiveMP.jl/src/distributions, but it's not clear to me if those are the only distributions that can be used, or if those distributions are only the ones that support a particular inference algorithm, analytic posteriors, etc.

For example, if I wanted to use a multinomial distribution in RxInfer.jl, can I just import from Distributions.jl and use it (but perhaps with limitations)? Or am I out of luck because it's not in the list in /ReactiveMP.jl/src/distributions? I can't find anything in the docs to tell me that.

From a documentation standpoint, it would be very helpful if there were an easy-to-look-up list of supported distributions, and maybe some additional information about how other parts of the ecosystem (e.g., Distributions.jl distributions) relate to the ones used here (e.g., if someone wanted to add distributions, where would one start?)

bvdmitri commented 1 year ago

Hey! We can improve the documentation part, but it is mentioned here. You can see the list of available factor nodes and/or distributions by calling the help mode for the make_node function, like

?make_node

As for now, it is not possible to use any other distribution, which is not in the list.

bvdmitri commented 1 year ago

If you want to add you own custom distribution you can refer to this guide: https://biaslab.github.io/RxInfer.jl/stable/manuals/custom-node/

bratslavia commented 1 year ago

Thanks for clarifying! I had indeed missed the section you linked. I figured nodes were restricted to the distributions listed in the ReactiveMP.jl directory, but couldn't find anything to actually verify that.

For what it's worth, even after reading the text you linked above, I still had difficulty knowing the answer to my original question above. I think the use of the word "compatible" was throwing me off -- when I read that, it makes me think that you can use any of the Distributions.jl distributions, and that the ones in the project are merely more "optimized" somehow.

It might be helpful to edit that section (node creation) to make it clearer what you said here. E.g., something like:

RxInfer.jl uses Distributions.jl as a back end where possible, but not all distributions are implemented, and some distributions use versions specialized for computational efficiency and/or stability. A list of currently implemented distributions (in addition to information on other available types of nodes) can be found by calling ?make_node. For information on creating custom nodes (including nodes implementing custom distributions), see the section on creating your own custom nodes.

bvdmitri commented 1 year ago

Thanks for the feedback, we shall take it into account for the next update.