3

I can't find any mentioning of variational inference in PyStan documentation, even though it has been added in Stan itself. Am I missing something, or is the Python API just not implementing it yet?

pavel
  • 360
  • 1
  • 8

2 Answers2

3

It is not in PyStan 2.9.0, but we're working on integrating it.

Bob Carpenter
  • 3,613
  • 1
  • 20
  • 13
  • 1
    It's available now, as of PyStan 2.14. http://pystan.readthedocs.io/en/latest/api.html#pystan.StanModel.vb – chmullig Mar 27 '17 at 19:58
1

Currently (PyStan 2.14), it's available under the StanModel.vb() call.

>>> from pystan import StanModel
>>> m = StanModel(model_code='parameters {real y;} model {y ~ normal(0,1);}')
>>> results = m.vb()
>>> # results saved on disk in format inspired by CSV
>>> print(results['args']['sample_file'])
chmullig
  • 13,006
  • 5
  • 35
  • 52