bundles / scipy 1.17.1 / scipy / stats / _multivariate / dirichlet_gen
class
scipy.stats._multivariate:dirichlet_gen
Signature
class dirichlet_gen ( seed = None ) Members
Summary
A Dirichlet random variable.
Extended Summary
The alpha keyword specifies the concentration parameters of the distribution.
Parameters
%(_dirichlet_doc_default_callparams)s%(_doc_random_state)s
Methods
pdf(x, alpha)Probability density function.
logpdf(x, alpha)Log of the probability density function.
rvs(alpha, size=1, random_state=None)Draw random samples from a Dirichlet distribution.
mean(alpha)The mean of the Dirichlet distribution
var(alpha)The variance of the Dirichlet distribution
cov(alpha)The covariance of the Dirichlet distribution
entropy(alpha)Compute the differential entropy of the Dirichlet distribution.
Notes
Each entry must be positive. The distribution has only support on the simplex defined by
where .
If the quantiles don't lie within the simplex, a ValueError is raised.
The probability density function for dirichlet is
where
and , the concentration parameters and is the dimension of the space where takes values.
Note that the dirichlet interface is somewhat inconsistent. The array returned by the rvs function is transposed with respect to the format expected by the pdf and logpdf.
Examples
import numpy as np from scipy.stats import dirichlet✓
quantiles = np.array([0.2, 0.2, 0.6]) # specify quantiles alpha = np.array([0.4, 5, 15]) # specify concentration parameters✓
dirichlet.pdf(quantiles, alpha)
✗dirichlet.logpdf(quantiles, alpha)
✗dirichlet.mean(alpha) # get the mean of the distribution dirichlet.var(alpha) # get variance dirichlet.entropy(alpha) # calculate the differential entropy✗
dirichlet.rvs(alpha, size=1, random_state=1) dirichlet.rvs(alpha, size=2, random_state=2)✗
rv = dirichlet(alpha)
✓Aliases
-
scipy.stats._multivariate.dirichlet_gen