Skip to content

Commit 9cfd114

Browse files
authored
Merge pull request #646 from stan-dev/doc/release-110
Update documentation for 1.1.0
2 parents b98a7fd + 26d7615 commit 9cfd114

File tree

6 files changed

+35
-16
lines changed

6 files changed

+35
-16
lines changed

cmdstanpy/model.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,18 +1600,17 @@ def log_prob(
16001600
Calculate the log probability and gradient at the given parameter
16011601
values.
16021602
1603-
NOTE: This function is **NOT** an efficient way to evaluate the log
1604-
density of the model. It should be used for diagnostics ONLY.
1605-
Please, do not use this for other purposes such as testing new
1606-
sampling algorithms!
1607-
1608-
Parameters
1609-
----------
1610-
:param data: Values for all parameters in the model, specified
1603+
.. note:: This function is **NOT** an efficient way to evaluate the log
1604+
density of the model. It should be used for diagnostics ONLY.
1605+
Please, do not use this for other purposes such as testing new
1606+
sampling algorithms!
1607+
1608+
:param params: Values for all parameters in the model, specified
16111609
either as a dictionary with entries matching the parameter
16121610
variables, or as the path of a data file in JSON or Rdump format.
16131611
16141612
These should be given on the constrained (natural) scale.
1613+
16151614
:param data: Values for all data variables in the model, specified
16161615
either as a dictionary with entries matching the data variables,
16171616
or as the path of a data file in JSON or Rdump format.

cmdstanpy/stanfit/gq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def draws(
198198
:param concat_chains: When ``True`` return a 2D array flattening all
199199
all draws from all chains. Default value is ``False``.
200200
201-
:param inc_sample: When ``True`` include all columns in the mcmc_sample
201+
:param inc_sample: When ``True`` include all columns in the previous_fit
202202
draws array as well, excepting columns for variables already present
203203
in the generated quantities drawset. Default value is ``False``.
204204

docsrc/changes.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ What's New
77

88
For full changes, see the `Releases page <https://github.com/stan-dev/cmdstanpy/releases>`__ on GitHub.
99

10+
11+
CmdStanPy 1.1.0
12+
---------------
13+
- **New functionality**
14+
15+
- :meth:`CmdStanModel.generate_quantities` can now accept samples from optimization and variational inference.
16+
The argument ``mcmc_sample`` has been renamed ``previous_fit`` to reflect this; the former name is still accepted
17+
but deprecated.
18+
- :meth:`CmdStanModel.log_prob` is able to return the log probability and its gradient with respect to a set of parameters.
19+
**Note** that this is *not* an efficient way of calculating this in general and should be reserved for debugging
20+
and model development.
21+
- **Other changes**
22+
23+
- Improved some of the type hints in the package.
24+
- Ensure draws are serialized if a fit object is pickled.
25+
- :meth:`~CmdStanModel.src_info` now raises an error if the command fails, rather than returning ``{}``.
26+
- CmdStanPy has transitioned all unit tests from the ``unittest`` library to use ``pytest``.
27+
1028
CmdStanPy 1.0.8
1129
---------------
1230

docsrc/community.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Software
2929
interface <https://julia.arviz.org/stable/>`_) for exploratory analysis of
3030
Bayesian models. Includes functions for posterior analysis, data storage,
3131
model checking, comparison and diagnostics.
32-
33-
- `BridgeStan <https://github.com/roualdes/bridgestan>`_ A project which provides efficient
34-
in-memory access through Python, Julia, and R to the methods of a Stan model, including
32+
33+
- `BridgeStan <https://github.com/roualdes/bridgestan>`_ A project which provides efficient
34+
in-memory access through Python, Julia, and R to the methods of a Stan model, including
3535
log densities, gradients, Hessians, and constraining and unconstraining transforms.
36+

docsrc/users-guide/examples/Run Generated Quantities.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@
129129
]
130130
},
131131
{
132+
"attachments": {},
132133
"cell_type": "markdown",
133134
"metadata": {},
134135
"source": [
135136
"We run the `generate_quantities` method on `bernoulli_ppc` using existing sample `fit` as input. The `generate_quantities` method takes the values of `theta` in the `fit` sample as the set of draws from the posterior used to generate the corresponsing `y_rep` quantities of interest.\n",
136137
"\n",
137138
"The arguments to the `generate_quantities` method are:\n",
138139
" + `data` - the data used to fit the model\n",
139-
" + `mcmc_sample` - either a `CmdStanMCMC` object or a list of stan-csv files\n"
140+
" + `previous_fit` - either a `CmdStanMCMC`, `CmdStanVB`, or `CmdStanMLE` object or a list of stan-csv files\n"
140141
]
141142
},
142143
{
@@ -145,7 +146,7 @@
145146
"metadata": {},
146147
"outputs": [],
147148
"source": [
148-
"new_quantities = model_ppc.generate_quantities(data=data_file, mcmc_sample=fit)"
149+
"new_quantities = model_ppc.generate_quantities(data=data_file, previous_fit=fit)"
149150
]
150151
},
151152
{

docsrc/users-guide/workflow.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ An example of each is provided in the `next section <examples.rst>`__
149149

150150
* The :meth:`~CmdStanModel.generate_quantities` method runs Stan's
151151
`generate_quantities method <https://mc-stan.org/docs/cmdstan-guide/standalone-generate-quantities.html>`_
152-
which generates additional quantities of interest from a mode. Its take an existing sample as input and
153-
uses the parameter estimates in the sample to run the Stan program's `generated quantities block <https://mc-stan.org/docs/reference-manual/program-block-generated-quantities.html>`__.
152+
which generates additional quantities of interest from a mode. Its take an existing fit as input and
153+
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>`__.
154154

155155
It returns a :class:`CmdStanGQ` object.
156156

0 commit comments

Comments
 (0)