Skip to content

Commit

Permalink
DOC Add advi-minibatch, diagnostics and backends to docs. Fix some do…
Browse files Browse the repository at this point in the history
…c string math problems.
  • Loading branch information
twiecki committed Oct 18, 2016
1 parent ce225df commit 1889b46
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 17 deletions.
52 changes: 44 additions & 8 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ Multivariate
.. automodule:: pymc3.distributions.multivariate
:members:

Mixture
^^^^^^^

.. currentmodule:: pymc3.distributions.mixture
.. autosummary::
Mixture
NormalMixture

.. automodule:: pymc3.distributions.mixture
:members:

Plots
-----

Expand All @@ -89,6 +100,16 @@ Stats
.. automodule:: pymc3.stats
:members:

Diagnostics
-----------

.. currentmodule:: pymc3.diagnostics
:members:

.. automodule:: pymc3.diagnostics
:members:



Inference
---------
Expand Down Expand Up @@ -142,14 +163,6 @@ Hamiltonian Monte Carlo
.. automodule:: pymc3.step_methods.hmc
:members:

ATMCMC
""""""

.. currentmodule:: pymc3.step_methods.ATMCMC
:members:

.. automodule:: pymc3.step_methods.ATMCMC
:members:

Variational
^^^^^^^^^^^
Expand All @@ -162,3 +175,26 @@ ADVI

.. automodule:: pymc3.variational.advi
:members:

ADVI minibatch
""""""""""""""

.. currentmodule:: pymc3.variational.advi_minibatch
:members:

.. automodule:: pymc3.variational.advi_minibatch
:members:

Backends
--------

.. currentmodule:: pymc3.backends
:members:

.. automodule:: pymc3.backends
:members:





15 changes: 7 additions & 8 deletions pymc3/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@statfunc
def geweke(x, first=.1, last=.5, intervals=20):
"""Return z-scores for convergence diagnostics.
R"""Return z-scores for convergence diagnostics.
Compare the mean of the first % of series with the mean of the last % of
series. x is divided into a number of segments for which this difference is
Expand Down Expand Up @@ -96,7 +96,7 @@ def geweke(x, first=.1, last=.5, intervals=20):


def gelman_rubin(mtrace):
""" Returns estimate of R for a set of traces.
R"""Returns estimate of R for a set of traces.
The Gelman-Rubin diagnostic tests for lack of convergence by comparing
the variance between multiple chains to the variance within each chain.
Expand Down Expand Up @@ -160,25 +160,24 @@ def gelman_rubin(mtrace):


def effective_n(mtrace):
""" Returns estimate of the effective sample size of a set of traces.
R"""Returns estimate of the effective sample size of a set of traces.
Parameters
----------
mtrace : MultiTrace
A MultiTrace object containing parallel traces (minimum 2)
of one or more stochastic parameters.
A MultiTrace object containing parallel traces (minimum 2)
of one or more stochastic parameters.
Returns
-------
n_eff : float
Return the effective sample size, :math:`\hat{n}_{eff}`
Return the effective sample size, :math:`\hat{n}_{eff}`
Notes
-----
The diagnostic is computed by:
.. math:: \hat{n}_{eff} = \frac{mn}}{1 + 2 \sum_{t=1}^T \hat{\rho}_t}
.. math:: \hat{n}_{eff} = \frac{mn}{1 + 2 \sum_{t=1}^T \hat{\rho}_t}
where :math:`\hat{\rho}_t` is the estimated autocorrelation at lag t, and T
is the first odd positive integer for which the sum
Expand Down
2 changes: 1 addition & 1 deletion pymc3/distributions/mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class NormalMixture(Mixture):
R"""
Normal mixture log-likelihood
.. math:: f(x \mid w, \mu, \sigma^2) = \sum_{i = 1}^n w_i N(x \mid \mu_i, \sigma^2_i
.. math:: f(x \mid w, \mu, \sigma^2) = \sum_{i = 1}^n w_i N(x \mid \mu_i, \sigma^2_i)
======== =======================================
Support :math:`x \in \mathbb{R}`
Expand Down

0 comments on commit 1889b46

Please sign in to comment.