Skip to content

Commit 4034738

Browse files
springcoiltwiecki
authored andcommitted
Based on review
1 parent 03576d9 commit 4034738

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

docs/source/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ API Reference
1616
api/diagnostics
1717
api/backends
1818
api/math
19+
api/data

docs/source/api/inference.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,11 @@ ADVI minibatch
6565

6666
.. automodule:: pymc3.variational.advi_minibatch
6767
:members:
68+
69+
ADVI approximations
70+
^^^^^^^^^^^^^^^^^^^
71+
72+
.. currentmodule:: pymc3.variational.approximations
73+
74+
.. automodule:: pymc3.variational.approximations
75+
:members:

docs/source/api/sampling.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

pymc3/sampling.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,29 +150,25 @@ def sample(draws, step=None, init='ADVI', n_init=200000, start=None,
150150
trace : pymc3.backends.base.MultiTrace
151151
A `MultiTrace` object that contains the samples.
152152
153-
Examples
153+
Examples
154154
--------
155155
.. code:: ipython
156156
157157
>>> import pymc3 as pm
158-
... import numpy as np
159-
... np.random.seed(20090425)
160-
... n = 20
161-
... X = np.sort(3*np.random.rand(n))
162-
163-
Now let's set up a model and sample from it.
158+
... n = 100
159+
... h = 61
160+
... alpha = 2
161+
... beta = 2
164162
165163
.. code:: ipython
166-
>>> with pm.Model() as model:
167-
... b0 = pm.Normal('b0', mu=0, sd=100)
168-
... yest = b0 * X
169-
...
170-
>>> with model:
171-
... trc = pm.sample(100)
172-
...
173-
>>> pm.df_summary(trc)
174-
mean sd mc_error hpd_2.5 hpd_97.5
175-
b0 7.004575 76.547562 7.654756 -161.098322 136.327346
164+
165+
>>> with pm.Model() as model: # context management
166+
... p = pm.Beta('p', alpha=alpha, beta=beta)
167+
... y = pm.Binomial('y', n=n, p=p, observed=h)
168+
... trace = pm.sample(2000, tune=1000, njobs=4)
169+
>>> pm.df_summary(trace)
170+
mean sd mc_error hpd_2.5 hpd_97.5
171+
p 0.604625 0.047086 0.00078 0.510498 0.694774
176172
"""
177173
model = modelcontext(model)
178174

0 commit comments

Comments
 (0)