Skip to content

Commit 2381a1a

Browse files
committed
update docstrings
1 parent bd0e26f commit 2381a1a

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

edward/inferences/inference.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@
1313

1414
@six.add_metaclass(abc.ABCMeta)
1515
class Inference(object):
16-
"""Base class for Edward inference methods.
16+
"""Abstract base class for inference. All inference algorithms in
17+
Edward inherit from ``Inference``, sharing common methods and
18+
properties via a class hierarchy.
19+
20+
Specific algorithms typically inherit from other subclasses of
21+
``Inference`` rather than ``Inference`` directly. For example, one
22+
might inherit from the abstract classes ``MonteCarlo`` or
23+
``VariationalInference``.
24+
25+
To build an algorithm inheriting from ``Inference``, one must at the
26+
minimum implement ``initialize`` and ``update``: the former builds
27+
the computational graph for the algorithm; the latter runs the
28+
computational graph for the algorithm.
1729
"""
1830
def __init__(self, latent_vars=None, data=None):
1931
"""Initialization.

edward/inferences/monte_carlo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
@six.add_metaclass(abc.ABCMeta)
1616
class MonteCarlo(Inference):
17-
"""Base class for Monte Carlo inference methods.
17+
"""Abstract base class for Monte Carlo. Specific Monte Carlo methods
18+
inherit from ``MonteCarlo``, sharing methods in this class.
19+
20+
To build an algorithm inheriting from ``MonteCarlo``, one must at the
21+
minimum implement ``build_update``: it determines how to assign
22+
the samples in the ``Empirical`` approximations.
1823
"""
1924
def __init__(self, latent_vars=None, data=None):
2025
"""Initialization.
@@ -143,7 +148,7 @@ def print_progress(self, info_dict):
143148
@abc.abstractmethod
144149
def build_update(self):
145150
"""Build update rules, returning an assign op for parameters in
146-
the Empirical random variables.
151+
the ``Empirical`` random variables.
147152
148153
Any derived class of ``MonteCarlo`` **must** implement this method.
149154

edward/inferences/variational_inference.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919

2020
@six.add_metaclass(abc.ABCMeta)
2121
class VariationalInference(Inference):
22-
"""Base class for variational inference methods.
22+
"""Abstract base class for variational inference. Specific
23+
variational inference methods inherit from ``VariationalInference``,
24+
sharing methods such as a default optimizer.
25+
26+
To build an algorithm inheriting from ``VariaitonalInference``, one
27+
must at the minimum implement ``build_loss_and_gradients``: it
28+
determines the loss function and gradients to apply for a given
29+
optimizer.
2330
"""
2431
def __init__(self, *args, **kwargs):
2532
super(VariationalInference, self).__init__(*args, **kwargs)

0 commit comments

Comments
 (0)