Skip to content

Commit 9c535bd

Browse files
committed
checkpointing
1 parent 2d42d55 commit 9c535bd

4 files changed

Lines changed: 53 additions & 34 deletions

File tree

docsrc/api.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ A CmdStanModel object encapsulates the Stan program. It manages program compilat
2525
:meth:`~CmdStanModel.sample`
2626
runs the HMC-NUTS sampler to produce a set of draws from the posterior distribution.
2727

28-
:meth:`~CmdStanModel.pathfinder`
29-
runs the Pathfinder variational inference parameters to recieve approximate draws from the posterior.
30-
3128
:meth:`~CmdStanModel.optimize`
3229
produce a penalized maximum likelihood estimate or maximum a posteriori estimate (point estimate) of the model parameters.
3330

3431
:meth:`~CmdStanModel.laplace_sample`
3532
draw from a Laplace approximatation centered at the posterior mode found by ``optimize``.
3633

34+
:meth:`~CmdStanModel.pathfinder`
35+
runs the Pathfinder variational inference parameters to recieve approximate draws from the posterior.
36+
3737
:meth:`~CmdStanModel.variational`
3838
run CmdStan’s automatic differentiation variational inference (ADVI) algorithm to approximate the posterior distribution.
3939

@@ -43,30 +43,28 @@ A CmdStanModel object encapsulates the Stan program. It manages program compilat
4343
.. autoclass:: cmdstanpy.CmdStanModel
4444
:members:
4545

46-
4746
CmdStanMCMC
4847
===========
4948

5049
.. autoclass:: cmdstanpy.CmdStanMCMC
5150
:members:
5251

53-
54-
CmdStanPathfinder
55-
=================
56-
57-
.. autoclass:: cmdstanpy.CmdStanPathfinder
58-
:members:
59-
6052
CmdStanMLE
6153
==========
6254

6355
.. autoclass:: cmdstanpy.CmdStanMLE
6456
:members:
6557

66-
CmdStanGQ
67-
=========
58+
CmdStanLaplace
59+
==============
6860

69-
.. autoclass:: cmdstanpy.CmdStanGQ
61+
.. autoclass:: cmdstanpy.CmdStanLaplace
62+
:members:
63+
64+
CmdStanPathfinder
65+
=================
66+
67+
.. autoclass:: cmdstanpy.CmdStanPathfinder
7068
:members:
7169

7270
CmdStanVB
@@ -75,10 +73,10 @@ CmdStanVB
7573
.. autoclass:: cmdstanpy.CmdStanVB
7674
:members:
7775

78-
CmdStanLaplace
79-
==============
76+
CmdStanGQ
77+
=========
8078

81-
.. autoclass:: cmdstanpy.CmdStanLaplace
79+
.. autoclass:: cmdstanpy.CmdStanGQ
8280
:members:
8381

8482
*********

docsrc/internal_api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ OptimizeArgs
4848
.. autoclass:: cmdstanpy.cmdstan_args.OptimizeArgs
4949
:members:
5050

51+
PathfinderArgs
52+
==============
53+
54+
.. autoclass:: cmdstanpy.cmdstan_args.PathfinderArgs
55+
:members:
56+
5157
VariationalArgs
5258
===============
5359

docsrc/users-guide/examples/Variational Inference.ipynb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@
5757
"metadata": {},
5858
"source": [
5959
"The class [`CmdStanVB`](https://mc-stan.org/cmdstanpy/api.html#cmdstanvb) provides the following properties to access information about the parameter names, estimated means, and the sample:\n",
60-
" + `column_names` - list of column names\n",
61-
" + `columns` - number of columns\n",
62-
" + `eta` - step size scaling parameter\n",
63-
" + `variational_params_dict` - inferred parameter means as a Dict.\n",
64-
" + `variational_params_np` - inferred parameter means as a numpy.ndarray.\n",
65-
" + `variational_params_pd` - inferred parameter means as a pandas.DataFrame.\n",
66-
" + `variational_sample` - the set of approximate posterior output draws ad a numpy.ndarray.\n",
67-
" + `variational_sample_pd` - the set of approximate posterior output draws ad a pandas.DataFrame."
60+
"\n",
61+
" + `column_names` - list of column names\n",
62+
" + `columns` - number of columns\n",
63+
" + `eta` - step size scaling parameter\n",
64+
" + `variational_params_dict` - inferred parameter means as a Dict.\n",
65+
" + `variational_params_np` - inferred parameter means as a numpy.ndarray.\n",
66+
" + `variational_params_pd` - inferred parameter means as a pandas.DataFrame.\n",
67+
" + `variational_sample` - the set of approximate posterior output draws ad a numpy.ndarray.\n",
68+
" + `variational_sample_pd` - the set of approximate posterior output draws ad a pandas.DataFrame."
6869
]
6970
},
7071
{

docsrc/users-guide/workflow.rst

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,34 @@ An example of each is provided in the `next section <examples.rst>`__.
134134
It returns a :class:`CmdStanMCMC` object which contains
135135
a sample from the posterior distribution of the model conditioned on the data.
136136

137-
* The :meth:`~CmdStanModel.variational` method runs Stan's
138-
`Automatic Differentiation Variational Inference (ADVI) algorithm <https://mc-stan.org/docs/reference-manual/vi-algorithms-chapter.html>`__.
139-
140-
It returns a :class:`CmdStanVB` object which contains
141-
an approximation the posterior distribution in the unconstrained variable space.
142-
143-
* The :meth:`~CmdStanModel.optimize` runs one of
137+
* The :meth:`~CmdStanModel.optimize` method runs one of
144138
`Stan's optimization algorithms <https://mc-stan.org/docs/reference-manual/optimization-algorithms-chapter.html>`__.
145139
to find a mode of the density specified by the Stan program.
146140

147141
It returns a :class:`CmdStanMLE` object.
148142

143+
* The :meth:`~CmdStanModel.laplace` method runs Stan's
144+
`Laplace approximation algorithm <https://mc-stan.org/docs/reference-manual/laplace.html>`__.
145+
and returns a sample from a Laplace approximatation centered at the posterior mode found by optimization.
146+
147+
It returns a :class:`CmdStanLaplace` object.
148+
149+
* The :meth:`~CmdStanModel.pathfinder` method runs Stan's
150+
`Pathfinder Variational Inference algorithm <https://mc-stan.org/docs/reference-manual/pathfinder.html>`__.
151+
152+
It returns a :class:`CmdStanPathfinder` object which contains a sample from a Guassian approximation to the posterior.
153+
154+
* The :meth:`~CmdStanModel.variational` method runs Stan's
155+
`Automatic Differentiation Variational Inference (ADVI) algorithm <https://mc-stan.org/docs/reference-manual/vi-algorithms-chapter.html>`__.
156+
157+
It returns a :class:`CmdStanVB` object which contains
158+
an approximation to the posterior distribution in the unconstrained variable space.
159+
149160
* The :meth:`~CmdStanModel.generate_quantities` method runs Stan's
150161
`generate_quantities method <https://mc-stan.org/docs/cmdstan-guide/standalone-generate-quantities.html>`__.
151162
which generates additional quantities of interest from a mode. Its take an existing fit as input and
152-
uses the parameter estimates in the fit to run the Stan program's `generated quantities block <https://mc-stan.org/docs/reference-manual/program-block-generated-quantities.html>`__.
163+
uses the parameter estimates in the fit to run the Stan program's
164+
`generated quantities block <https://mc-stan.org/docs/reference-manual/program-block-generated-quantities.html>`__.
153165

154166
It returns a :class:`CmdStanGQ` object.
155167

@@ -170,8 +182,10 @@ Output data
170182
The resulting Stan CSV file or set of files are assembled into an inference result object.
171183

172184
+ :class:`CmdStanMCMC` object contains the :meth:`~CmdStanModel.sample` outputs
173-
+ :class:`CmdStanVB` object contains the :meth:`~CmdStanModel.variational` outputs
174185
+ :class:`CmdStanMLE` object contains the :meth:`~CmdStanModel.optimize` outputs
186+
+ :class:`CmdStanLaplace` object contains the :meth:`~CmdStanModel.laplace` outputs
187+
+ :class:`CmdStanPathfinder` object contains the :meth:`~CmdStanModel.pathfinder` outputs
188+
+ :class:`CmdStanVB` object contains the :meth:`~CmdStanModel.variational` outputs
175189
+ :class:`CmdStanGQ` object contains the :meth:`~CmdStanModel.generate_quantities` outputs
176190

177191

0 commit comments

Comments
 (0)