Skip to content

Commit

Permalink
update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
ganow committed Feb 26, 2019
1 parent e547b5a commit f986b2d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
33 changes: 23 additions & 10 deletions chainer/distributions/independent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@


class Independent(distribution.Distribution):
def __init__(self, distribution, reinterpreted_batch_ndims=None):
'''Construct a `Independent` distribution.
Args:
distribution (:class:`~chainer.Distribution`): The base
distribution instance to transform.
reinterpreted_batch_ndims (:class:`int`): Integer number of
rightmost batch dims which will be regarded as event dims.
When ``None`` all but the first batch axis (batch axis 0) will
be transferred to event dimensions.
'''

"""Independent distribution.
Args:
distribution (:class:`~chainer.Distribution`): The base distribution
instance to transform.
reinterpreted_batch_ndims (:class:`int`): Integer number of rightmost
batch dims which will be regarded as event dims. When ``None`` all
but the first batch axis (batch axis 0) will be transferred to
event dimensions.
"""

def __init__(self, distribution, reinterpreted_batch_ndims=None):
super(Independent, self).__init__()
self.__distribution = distribution
if reinterpreted_batch_ndims is None:
Expand Down Expand Up @@ -106,6 +108,17 @@ def cdf(self, x):
return self._reduce(prod.prod, self.distribution.cdf(x))

def icdf(self, x):
'''Cumulative distribution function for multivariate variable is not
invertible. This function always raises :class:`RuntimeError`.
Args:
x (:class:`~chainer.Variable` or :ref:`ndarray`): Data points in
the codomain of the distribution
Raises:
:class:`RuntimeError`
'''

raise RuntimeError(
'Cumulative distribution function for multivariate variable '
'is not invertible.')
Expand Down
5 changes: 3 additions & 2 deletions docs/source/reference/distributions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Distributions
.. autosummary::
:toctree: generated/
:nosignatures:

chainer.distributions.Bernoulli
chainer.distributions.Beta
chainer.distributions.Categorical
Expand All @@ -24,6 +24,7 @@ Distributions
chainer.distributions.Gamma
chainer.distributions.Geometric
chainer.distributions.Gumbel
chainer.distributions.Independent
chainer.distributions.Laplace
chainer.distributions.LogNormal
chainer.distributions.MultivariateNormal
Expand All @@ -42,7 +43,7 @@ Functionals of distribution
.. autosummary::
:toctree: generated/
:nosignatures:

chainer.cross_entropy
chainer.kl_divergence
chainer.register_kl
Expand Down

0 comments on commit f986b2d

Please sign in to comment.