MLE and "optimize" in PyStan3

Hey PyStan Team,

My team is still on PyStan 2.x and we often use the model.optimize() function to find a point estimate using MLE. I don’t see an equivalent function in PyStan3, was this left out intentionally?

I understand that running MLE is not a true bayesian approach, but we have found it very helpful in practice so we’d be sad to see it go. Is there any equivalent to the optimize function in PyStan3?

I am not a developer, but it looks like from the documentation optimization is not supported in PyStan 3.0 (Upgrading to Newer Releases — pystan 3.7.0 documentation)

The default, recommended HMC sampler is fully supported. Variational inference, maximization algorithms, and other sampling algorithms are not supported. Users who need these features should consider using different software (e.g., CmdStan, CmdStanPy, jax, PyTorch).

My guess is that CmdStanPy would be easiest to implement without disrupting your workflow too much.

No support for optimization is planned right now. PyStan 3 is narrowly focused on supporting sampling-based workflows.

That said, I do very much want to add a tutorial about how to use jax or pytorch and pystan 3 to do MAP estimation. Such a tutorial would be sufficiently concise that it could fit in an FAQ item.

2 Likes