362ae1c3创建于 2022年6月24日历史提交

Dirichlet distribution

A Dirichlet random variable.

Notes

The probability density function for dirichlet distribution is:

.. math::

f(x) = \frac{1}{B(\alpha )} \prod_{i=1}^{K}x_{i}^{\alpha _{i}-1} 

where

.. math:: B(\alpha )=\frac{ {\textstyle \prod_{i=1}^{K} \Gamma(\alpha_i)} }{\Gamma ({\textstyle \sum_{i=1}^{K}\alpha _i})}

and :math:\sum_{i=1}^{K} x_i=1, :math:0<x_{i}<1; :math:\alpha =(\alpha_1, ...,\alpha _K), :math:\alpha_{i}> 0 where :math:K is the dimension of the space where :math:x takes values..

Examples

Given quantile :math:[0.2, 0.2, 0.6] and concentration parameters :math:[0.4, 5.0, 15.0], compute the logpdf of dirichlet distribution.

::

let quantiles = vector([0.2, 0.2, 0.6])
let alpha = vector([0.4, 5.0, 15.0])
dirichletLogPDF(quantiles, alpha)

Result: :math:-1.2574327653159187

Compute pdf of dirichlet distribution.

::

dirichletPDF(quantiles, alpha)

Result: :math:0.2843831684937255

Compute mean of dirichlet distribution.

::

dirichletMean(alpha)

Result: :math:[0.01960784, 0.24509804, 0.73529412]

Compute variance of dirichlet distribution.

::

dirichletVar(alpha)

Result: :math:[0.00089829, 0.00864603, 0.00909517]

Methods

============================== =================================== Method Description ============================== =================================== dirichletLogPDF(x, alpha) Log of probability density function dirichletPDF(x, alpha) Probability density function dirichletMean(alpha) Mean dirichletVar(alpha) Variance ============================== ===================================