# chainer.distributions.Dirichlet¶

class chainer.distributions.Dirichlet(alpha)[source]

Dirichlet Distribution.

The probability density function of the distribution is expressed as

$p(x) = \frac{\Gamma(\sum_{i=1}^{K} \alpha_i)} {\prod_{i=1}^{K} \Gamma (\alpha_i)} \prod_{i=1}^{K} {x_i}^{\alpha_i-1}$
Parameters: alpha (Variable or N-dimensional array) – Parameter of distribution.

Methods

cdf(x)[source]

Evaluates the cumulative distribution function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Cumulative distribution function value evaluated at x. Variable
icdf(x)[source]

Evaluates the inverse cumulative distribution function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Inverse cumulative distribution function value evaluated at x. Variable
log_cdf(x)[source]

Evaluates the log of cumulative distribution function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Logarithm of cumulative distribution function value evaluated at x. Variable
log_prob(x)[source]

Evaluates the logarithm of probability at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Logarithm of probability evaluated at x. Variable
log_survival_function(x)[source]

Evaluates the logarithm of survival function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Logarithm of survival function value evaluated at x. Variable
perplexity(x)[source]

Evaluates the perplexity function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Perplexity function value evaluated at x. Variable
prob(x)[source]

Evaluates probability at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Probability evaluated at x. Variable
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 ditribution class, it is not recommended to override this function. Instead of doing this, it is preferable to override sample_n.

Parameters: sample_shape (tuple of int) – Sampling shape. Sampled random points. Variable
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 to override this method.

Parameters: n (int) – Sampling size. sampled random points. Variable
survival_function(x)[source]

Evaluates the survival function at the given points.

Parameters: x (Variable or N-dimensional array) – Data points in the domain of the distribution Survival function value evaluated at x. Variable

Attributes

alpha
alpha0
batch_shape

Returns the shape of a batch.

Returns: The shape of a sample that is not identical and independent. tuple
covariance

Returns the covariance of the distribution.

Returns: The covariance of the distribution. Variable
entropy

Returns the entropy of the distribution.

Returns: The entropy of the distribution. Variable
event_shape

Returns the shape of an event.

Returns: The shape of a sample that is not identical and independent. tuple
mean

Returns the mean of the distribution.

Returns: The mean of the distribution. Variable
mode

Returns the mode of the distribution.

Returns: The mode of the distribution. Variable
params

Returns the parameters of the distribution.

Returns: The parameters of the distribution. dict
stddev

Returns the standard deviation of the distribution.

Returns: The standard deviation of the distribution. Variable
support

Returns the support of the distribution.

Returns: String that means support of this distribution. str
variance

Returns the variance of the distribution.

Returns: The variance of the distribution. Variable
xp

Array module for the distribution.

Depending on which of CPU/GPU this distribution is on, this property returns numpy or cupy.