chainer.distributions.Independent¶
-
class
chainer.distributions.Independent(distribution, reinterpreted_batch_ndims=None)[source]¶ Independent distribution.
- Parameters
distribution (
Distribution) – The base distribution instance to transform.reinterpreted_batch_ndims (
int) – Integer number of rightmost batch dims which will be regarded as event dims. WhenNoneall but the first batch axis (batch axis 0) will be transferred to event dimensions.
Methods
-
cdf(x)[source]¶ Evaluates the cumulative distribution function at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Cumulative distribution function value evaluated at x.
- Return type
-
icdf(x)[source]¶ The inverse cumulative distribution function for multivariate variable.
Cumulative distribution function for multivariate variable is not invertible. This function always raises
RuntimeError.- Parameters
x (
Variableor N-dimensional array) – Data points in the codomain of the distribution- Raises
-
log_cdf(x)[source]¶ Evaluates the log of cumulative distribution function at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Logarithm of cumulative distribution function value evaluated at x.
- Return type
-
log_prob(x)[source]¶ Evaluates the logarithm of probability at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Logarithm of probability evaluated at x.
- Return type
-
log_survival_function(x)[source]¶ Evaluates the logarithm of survival function at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Logarithm of survival function value evaluated at x.
- Return type
-
perplexity(x)[source]¶ Evaluates the perplexity function at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Perplexity function value evaluated at x.
- Return type
-
prob(x)[source]¶ Evaluates probability at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Probability evaluated at x.
- Return type
-
sample(sample_shape=())[source]¶ Samples random points from the distribution.
This function calls sample_n and reshapes a result of sample_n to sample_shape + batch_shape + event_shape. On implementing sampling code in an inherited distribution class, it is not recommended that you override this function. Instead of doing this, it is preferable to override sample_n.
-
sample_n(n)[source]¶ Samples n random points from the distribution.
This function returns sampled points whose shape is (n,) + batch_shape + event_shape. When implementing sampling code in a subclass, it is recommended that you override this method.
-
survival_function(x)[source]¶ Evaluates the survival function at the given points.
- Parameters
x (
Variableor N-dimensional array) – Data points in the domain of the distribution- Returns
Survival function value evaluated at x.
- Return type
-
__eq__()¶ Return self==value.
-
__ne__()¶ Return self!=value.
-
__lt__()¶ Return self<value.
-
__le__()¶ Return self<=value.
-
__gt__()¶ Return self>value.
-
__ge__()¶ Return self>=value.
Attributes
-
batch_shape¶ Returns the shape of a batch.
- Returns
The shape of a sample that is not identical and independent.
- Return type
-
covariance¶ The covariance of the independent distribution.
By definition, the covariance of the new distribution becomes block diagonal matrix. Let \(\Sigma_{\mathbf{x}}\) be the covariance matrix of the original random variable \(\mathbf{x} \in \mathbb{R}^d\), and \(\mathbf{x}^{(1)}, \mathbf{x}^{(2)}, \cdots \mathbf{x}^{(m)}\) be the \(m\) i.i.d. random variables, new covariance matrix \(\Sigma_{\mathbf{y}}\) of \(\mathbf{y} = [\mathbf{x}^{(1)}, \mathbf{x}^{(2)}, \cdots, \mathbf{x}^{(m)}] \in \mathbb{R}^{md}\) can be written as
\[\begin{split}\left[\begin{array}{ccc} \Sigma_{\mathbf{x}^{1}} & & 0 \\ & \ddots & \\ 0 & & \Sigma_{\mathbf{x}^{m}} \end{array} \right].\end{split}\]Note that this relationship holds only if the covariance matrix of the original distribution is given analytically.
- Returns
The covariance of the distribution.
- Return type
-
distribution¶
-
entropy¶ Returns the entropy of the distribution.
- Returns
The entropy of the distribution.
- Return type
-
event_shape¶ Returns the shape of an event.
- Returns
The shape of a sample that is not identical and independent.
- Return type
-
mean¶ Returns the mean of the distribution.
- Returns
The mean of the distribution.
- Return type
-
mode¶ Returns the mode of the distribution.
- Returns
The mode of the distribution.
- Return type
-
params¶ Returns the parameters of the distribution.
- Returns
The parameters of the distribution.
- Return type
-
reinterpreted_batch_ndims¶
-
stddev¶ Returns the standard deviation of the distribution.
- Returns
The standard deviation of the distribution.
- Return type
-
support¶ Returns the support of the distribution.
- Returns
String that means support of this distribution.
- Return type
-
variance¶ Returns the variance of the distribution.
- Returns
The variance of the distribution.
- Return type