Skip to content

Commit 96c430e

Browse files
authored
fixup (#4283)
1 parent 6ef0b2d commit 96c430e

File tree

5 files changed

+50
-51
lines changed

5 files changed

+50
-51
lines changed

docs/source/api/distributions/transforms.rst

-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ implemented as ``pm.distributions.transforms.``\*X*.
2424
ordered
2525
log
2626
sum_to_1
27-
t_stick_breaking
2827
circular
2928
CholeskyCovPacked
3029
Chain
@@ -93,10 +92,6 @@ below.
9392
:class:`~pymc3.distributions.transforms.Circular` :class:`~pymc3.distributions.transforms.Transform` class
9493
for use in the ``transform`` argument of a random variable.
9594

96-
97-
.. autofunction:: t_stick_breaking
98-
99-
10095
Transform Base Classes
10196
~~~~~~~~~~~~~~~~~~~~~~
10297

docs/source/api/plots.rst

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Plots
33
*****
44

55
.. currentmodule:: pymc3.plots
6+
67
Plots are delegated to the
78
`ArviZ <https://arviz-devs.github.io/arviz/index.html>`_.
89
library, a general purpose library for

pymc3/backends/base.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ class MultiTrace:
273273
274274
Attributes
275275
----------
276-
nchains: int
277-
Number of chains in the `MultiTrace`.
278-
chains: `List[int]`
279-
List of chain indices
280-
report: str
281-
Report on the sampling process.
282-
varnames: `List[str]`
283-
List of variable names in the trace(s)
276+
nchains: int
277+
Number of chains in the `MultiTrace`.
278+
chains: `List[int]`
279+
List of chain indices
280+
report: str
281+
Report on the sampling process.
282+
varnames: `List[str]`
283+
List of variable names in the trace(s)
284284
"""
285285

286286
def __init__(self, straces):

pymc3/distributions/transforms.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def jacobian_det(self, x):
430430
class StickBreaking(Transform):
431431
"""
432432
Transforms K - 1 dimensional simplex space (k values in [0,1] and that sum to 1) to a K - 1 vector of real values.
433-
This is a variant of the isometric logration transformation:
433+
This is a variant of the isometric logration transformation ::
434+
434435
Egozcue, J.J., Pawlowsky-Glahn, V., Mateu-Figueras, G. et al.
435436
Isometric Logratio Transformations for Compositional Data Analysis.
436437
Mathematical Geology 35, 279–300 (2003). https://doi.org/10.1023/A:1023818214614

pymc3/sampling.py

+39-37
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def sample(
253253
pickle_backend: str = "pickle",
254254
**kwargs,
255255
):
256-
"""Draw samples from the posterior using the given step methods.
256+
r"""Draw samples from the posterior using the given step methods.
257257
258258
Multiple step methods are supported via compound step methods.
259259
@@ -330,7 +330,6 @@ def sample(
330330
called with the trace and the current draw and will contain all samples for a single trace.
331331
the ``draw.chain`` argument can be used to determine which of the active chains the sample
332332
is drawn from.
333-
334333
Sampling can be interrupted by throwing a ``KeyboardInterrupt`` in the callback.
335334
return_inferencedata : bool, default=False
336335
Whether to return the trace as an :class:`arviz:arviz.InferenceData` (True) object or a `MultiTrace` (False)
@@ -353,7 +352,7 @@ def sample(
353352
Notes
354353
-----
355354
Optional keyword arguments can be passed to ``sample`` to be delivered to the
356-
``step_method``s used during sampling.
355+
``step_method``\ s used during sampling.
357356
358357
If your model uses only one step method, you can address step method kwargs
359358
directly. In particular, the NUTS step method has several options including:
@@ -368,49 +367,52 @@ def sample(
368367
If your model uses multiple step methods, aka a Compound Step, then you have
369368
two ways to address arguments to each step method:
370369
371-
A: If you let ``sample()`` automatically assign the ``step_method``s,
372-
and you can correctly anticipate what they will be, then you can wrap
373-
step method kwargs in a dict and pass that to sample() with a kwarg set
374-
to the name of the step method.
375-
e.g. for a CompoundStep comprising NUTS and BinaryGibbsMetropolis,
376-
you could send:
377-
1. ``target_accept`` to NUTS: nuts={'target_accept':0.9}
378-
2. ``transit_p`` to BinaryGibbsMetropolis: binary_gibbs_metropolis={'transit_p':.7}
379-
380-
Note that available names are:
381-
``nuts``, ``hmc``, ``metropolis``, ``binary_metropolis``,
382-
``binary_gibbs_metropolis``, ``categorical_gibbs_metropolis``,
383-
``DEMetropolis``, ``DEMetropolisZ``, ``slice``
384-
385-
B: If you manually declare the ``step_method``s, within the ``step``
386-
kwarg, then you can address the ``step_method`` kwargs directly.
387-
e.g. for a CompoundStep comprising NUTS and BinaryGibbsMetropolis,
388-
you could send:
389-
step=[pm.NUTS([freeRV1, freeRV2], target_accept=0.9),
390-
pm.BinaryGibbsMetropolis([freeRV3], transit_p=.7)]
370+
A. If you let ``sample()`` automatically assign the ``step_method``\ s,
371+
and you can correctly anticipate what they will be, then you can wrap
372+
step method kwargs in a dict and pass that to sample() with a kwarg set
373+
to the name of the step method.
374+
e.g. for a CompoundStep comprising NUTS and BinaryGibbsMetropolis,
375+
you could send:
376+
377+
1. ``target_accept`` to NUTS: nuts={'target_accept':0.9}
378+
2. ``transit_p`` to BinaryGibbsMetropolis: binary_gibbs_metropolis={'transit_p':.7}
379+
380+
Note that available names are:
381+
382+
``nuts``, ``hmc``, ``metropolis``, ``binary_metropolis``,
383+
``binary_gibbs_metropolis``, ``categorical_gibbs_metropolis``,
384+
``DEMetropolis``, ``DEMetropolisZ``, ``slice``
385+
386+
B. If you manually declare the ``step_method``\ s, within the ``step``
387+
kwarg, then you can address the ``step_method`` kwargs directly.
388+
e.g. for a CompoundStep comprising NUTS and BinaryGibbsMetropolis,
389+
you could send ::
390+
391+
step=[pm.NUTS([freeRV1, freeRV2], target_accept=0.9),
392+
pm.BinaryGibbsMetropolis([freeRV3], transit_p=.7)]
391393
392394
You can find a full list of arguments in the docstring of the step methods.
393395
394396
Examples
395397
--------
396398
.. code:: ipython
397399
398-
>>> import pymc3 as pm
399-
... n = 100
400-
... h = 61
401-
... alpha = 2
402-
... beta = 2
400+
In [1]: import pymc3 as pm
401+
...: n = 100
402+
...: h = 61
403+
...: alpha = 2
404+
...: beta = 2
403405
404-
.. code:: ipython
406+
In [2]: with pm.Model() as model: # context management
407+
...: p = pm.Beta("p", alpha=alpha, beta=beta)
408+
...: y = pm.Binomial("y", n=n, p=p, observed=h)
409+
...: trace = pm.sample()
405410
406-
>>> with pm.Model() as model: # context management
407-
... p = pm.Beta('p', alpha=alpha, beta=beta)
408-
... y = pm.Binomial('y', n=n, p=p, observed=h)
409-
... trace = pm.sample()
410-
>>> pm.summary(trace)
411-
mean sd mc_error hpd_2.5 hpd_97.5
412-
p 0.604625 0.047086 0.00078 0.510498 0.694774
411+
In [3]: pm.summary(trace, kind="stats")
413412
413+
Out[3]:
414+
mean sd hdi_3% hdi_97%
415+
p 0.609 0.047 0.528 0.699
414416
"""
415417
model = modelcontext(model)
416418
if start is None:
@@ -1982,7 +1984,7 @@ def init_nuts(
19821984
* map: Use the MAP as starting point. This is discouraged.
19831985
* adapt_full: Adapt a dense mass matrix using the sample covariances. All chains use the
19841986
test value (usually the prior mean) as starting point.
1985-
* jitter+adapt_full: Same as ``adapt_full`, but use test value plus a uniform jitter in
1987+
* jitter+adapt_full: Same as ``adapt_full``, but use test value plus a uniform jitter in
19861988
[-1, 1] as starting point in each chain.
19871989
19881990
chains : int

0 commit comments

Comments
 (0)