Dirichlet distribution - Wikipedia

Below is example Python code to draw the sample: params = [ a1 , a2 , ... , ak ] sample = [ random . gammavariate ( a , 1 ) for a in params ] sample = [ v / sum ( sample ) for v in sample ] This formulation is correct regardless of how the Gamma distributions are parameterized (shape/scale vs. shape/rate) because they are equivalent when scale ...

Посещение visit
copy Копирано
copy copy

Виж кешираната версия

Вашето търсене и този резултат

  • Този търсен термин се появява в резултата: example of simple python code
  • Уебсайтът съответства на една или повече от вашите търсени думи
  • Други уебсайтове, които включват вашите търсени думи, сочат към този резултат
  • Резултатът е на български
Dirichlet distribution

Below is example Python code to draw the sample: params = sample = sample = This formulation is correct regardless of how the Gamma distributions are parameterized (shape/scale vs. shape/rate) because they are equivalent when scale ...

Уикипедия
image

Информационен лист

Бета
Dirichlet distribution

Parameters

K ≥ 2 {\displaystyle K\geq 2} number of categories (integer) α = (α 1, …, α K) {\displaystyle {\boldsymbol {\alpha }}=(\alpha _{1},\ldots,\alpha _{K})} concentration parameters, where α i > 0 {\displaystyle \alpha _{i}>0}

Support

x 1, …, x K {\displaystyle x_{1},\ldots,x_{K}} where x i ∈ {\displaystyle x_{i}\in } and ∑ i = 1 K x i = 1 {\displaystyle \sum _{i=1}^{K}x_{i}=1}

PDF

1 B (α) ∏ i = 1 K x i α i − 1 {\displaystyle {\frac {1}{\mathrm {B} ({\boldsymbol {\alpha }})}}\prod _{i=1}^{K}x_{i}^{\alpha _{i}-1}} where B (α) = ∏ i = 1 K Γ (α i) Γ (α 0) {\displaystyle \mathrm {B} ({\boldsymbol {\alpha }})={\frac {\prod _{i=1}^{K}\Gamma (\alpha _{i})}{\Gamma {\bigl (}\alpha _{0}{\bigr)}}}} where α 0 = ∑ i = 1 K α i {\displaystyle \alpha _{0}=\sum _{i=1}^{K}\alpha _{i}}

Mean

E = α i α 0 {\displaystyle \operatorname {E} ={\frac {\alpha _{i}}{\alpha _{0}}}} E = ψ (α i) − ψ (α 0) {\displaystyle \operatorname {E} =\psi (\alpha _{i})-\psi (\alpha _{0})} (where ψ {\displaystyle \psi } is the digamma function)

Mode

x i = α i − 1 α 0 − K, α i > 1. {\displaystyle x_{i}={\frac {\alpha _{i}-1}{\alpha _{0}-K}},\quad \alpha _{i}>1.}

Variance

Var = α ~ i (1 − α ~ i) α 0 + 1, {\displaystyle \operatorname {Var} ={\frac {{\tilde {\alpha }}_{i}(1-{\tilde {\alpha }}_{i})}{\alpha _{0}+1}},} Cov = δ i j α ~ i − α ~ i α ~ j α 0 + 1 {\displaystyle \operatorname {Cov} ={\frac {\delta _{ij}\,{\tilde {\alpha }}_{i}-{\tilde {\alpha }}_{i}{\tilde {\alpha }}_{j}}{\alpha _{0}+1}}} where α ~ i = α i α 0 {\displaystyle {\tilde {\alpha }}_{i}={\frac {\alpha _{i}}{\alpha _{0}}}}, and δ i j {\displaystyle \delta _{ij}} is the Kronecker delta

Entropy

H (X) = log B (α) {\displaystyle H(X)=\log \mathrm {B} ({\boldsymbol {\alpha }})} + (α 0 − K) ψ (α 0) − {\displaystyle +(\alpha _{0}-K)\psi (\alpha _{0})-} ∑ j = 1 K (α j − 1) ψ (α j) {\displaystyle \sum _{j=1}^{K}(\alpha _{j}-1)\psi (\alpha _{j})} with α 0 {\displaystyle \alpha _{0}} defined as for variance, above; and ψ {\displaystyle \psi } is the digamma function

Method of moments

α i = E (E (1 − E) V − 1) {\displaystyle \alpha _{i}=E\left({\frac {E(1-E)}{V}}-1\right)} where j {\displaystyle j} is any index, possibly i {\displaystyle i} itself