20 comments

[ 4.7 ms ] story [ 51.1 ms ] thread
Great, congrats!

What's the equivalent in python?

> What's the equivalent in python?

You might start with Stan for which Python bindings are available if I recall correctly.

A closer library is Infer.NET: https://dotnet.github.io/infer.

It includes a really mature compiler that generates very efficient message passing and variational inference, with support for online inference, which is the main focus on Rxinfer.

You can call Infer.NET from Python in a number of ways, despite it is not a CPython library.

The reason Stan, Nimble, PyMC fit via simulation is because joint distributions generally don’t have an analytical form and require global fitting methods to identify.

I’d hazard to guess that if this package fits incrementally without simulation that either it doesn’t aim for a global optimum or that it places substantial limits on the form models can take.

Belief propagagation (i.e. message passing) has a long history and has been pretty successful. It's not always applicable, but it can have a lot of advantages when it is.
I would use one of those for scenarios when I need proper measures of uncertainty like credible regions.

The methods listed in this project (EM algorithm, VI) tend not to provide this as well but usually produce something that looks like a good posterior mean (global optimum under mean square loss) in my experience.

There inevitable drawbacks of both approaches. Nothing particularly wrong with the simulation, but it is really really slow and is not applicable in real-time or close to real-time applications, where situation may change rapidly. Also it usually requires high-end CPUs, which are not available on edge devices like drones.

RxInfer tries to be as efficient as possible in running inference, but it does indeed places limits on the form of the models it can run inference for. The team has long-term plans and solutions under research, which should expand the set of available models substantially. Message passing has a long history, it is not only belief propagation on simple models, but also nowadays the variational inference is possible with message passing on sophisticated hierarchical models.

Moreover, a lot of those methods are hard to parallelize. I’m not up on state of the art HMC for example, but the standard formulation isn’t easy to parallelize beyond the basic linear algebra operations.
Tangential but anyone have links for open source projects that use inference for real world use cases?
This can be used for building thousands of models that depends on each other? For example, traffic or weather prediction
In principle, yes. The team is working on nested models definition that will allow seamless fusion of many models into one.
I would love to build a massive global macroeconomic model (vector autoregressions for exchange rates/ securities, spatiotemporal processes for raw materials like crop yields, etc) using something like this. It would just take way too long with Monte Carlo.
There are workarounds to build latent VARs, but it's not available right off the box. There'll be more developments on these type of models early next year! Reactive aspect of the toolbox makes the inference in these models fast
Also do you have any functionality for recognizing graph structure (I.e. marginalizing out variables, identifying conjugacy, automatic reparameterization)?
RxInfer.jl does some analysis, but it is quite limited atm. The main library for specifying the graph structure (GraphPPL.jl) is being rewritten, refactored and overhauled from grounds and should do much much better job in automatically recognising the graph structure in the future!
I’m a diehard MCMC advocate but love that the is system is built for real-time applications. Hope I get a chance to try this out sometime!
What’s your favourite MCMC method/technique atm? I know this can be quite domain dependent, but curious. From my experience, it can seem more of an art than a science at times.
Definitely Hamiltonian Monte Carlo / NUTS for the last few years. From both a practical standpoint and theoretical perspective, I see no reason why it doesn't scale to millions of parameters if you have enough GPUs. Stuff like Gibbs samplers and Metropolis-Hastings tends to run into issues once you get beyond ~100 parameters, sometimes more with clever graph structure.

I am also really interested to see if CHEES HMC (https://proceedings.mlr.press/v130/hoffman21a.html) makes it as a viable in-the-wild inference technique since it gets around the nastiness of writing NUTS as a recursive algorithm on hardware (GPU / TPU) generally not friendly to that type of control flow.