diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-12-24 08:41:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-24 08:41:35 +0200 |
commit | df9992f09dc529f53f2d943c0057b94fa62b62d3 (patch) | |
tree | 0c7ed6a4546665bcc9be78e42dbe0ba1124cbc17 /numpy | |
parent | e2694759a21c948aa5be26a7e4ac65b7b8b8a8da (diff) | |
parent | 75939e55bee57e2689a72e6f507dd3a6818dcb48 (diff) | |
download | numpy-df9992f09dc529f53f2d943c0057b94fa62b62d3.tar.gz |
Merge pull request #12333 from tuelwer/master
DOC: update description of the Dirichlet distribution
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index e4a401b24..2a6daa88c 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -4673,8 +4673,9 @@ cdef class RandomState: Draw `size` samples of dimension k from a Dirichlet distribution. A Dirichlet-distributed random variable can be seen as a multivariate - generalization of a Beta distribution. Dirichlet pdf is the conjugate - prior of a multinomial in Bayesian inference. + generalization of a Beta distribution. The Dirichlet distribution + is a conjugate prior of a multinomial distribution in Bayesian + inference. Parameters ---------- @@ -4698,13 +4699,24 @@ cdef class RandomState: Notes ----- - .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i} - Uses the following property for computation: for each dimension, - draw a random sample y_i from a standard gamma generator of shape - `alpha_i`, then - :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is - Dirichlet distributed. + The Dirichlet distribution is a distribution over vectors + :math:`x` that fulfil the conditions :math:`x_i>0` and + :math:`\\sum_{i=1}^k x_i = 1`. + + The probability density function :math:`p` of a + Dirichlet-distributed random vector :math:`X` is + proportional to + + .. math:: p(x) \\propto \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}, + + where :math:`\\alpha` is a vector containing the positive + concentration parameters. + + The method uses the following property for computation: let :math:`Y` + be a random vector which has components that follow a standard gamma + distribution, then :math:`X = \\frac{1}{\\sum_{i=1}^k{Y_i}} Y` + is Dirichlet-distributed References ---------- |