Debian Codegraph @

easel/esl_dirichlet.tex

raw
1
2 The dirichlet module contains routines for using Beta, Gamma, and
3 Dirichlet densities. In particular, it implements mixture Dirichlet
4 priors, which are useful in a variety of parameter estimation tasks.
5
6 The Dirichlet PDF is:
7
8 \begin{equation}
9 P(\vec{p}) = \frac{\Gamma{\sum_i \alpha_i}}{\prod_i \Gamma(\alpha_i)} \prod_i p_i^{\alpha_i-1}
10 \end{equation}
11
12
13 \subsection{The dirichlet API}
14
15 The module implements one object, \ccode{ESL\_MIXDCHLET}, which holds
16 a mixture Dirichlet prior.
17
18 The API consists of the following functions:
19
20 \vspace{1em}
21 \begin{tabular}{ll}\hline
22 \multicolumn{2}{c}{\textbf{mixture Dirichlet priors}}\\
23 \ccode{esl\_mixdchlet\_Create()} & Allocates a new mixture Dirichlet.\\
24 \ccode{esl\_mixdchlet\_Destroy()} & Free's a mixture Dirichlet.\\
25 \ccode{esl\_mixdchlet\_MPParameters()} & Mean posterior probability parameter estimation.\\
26 \multicolumn{2}{c}{\textbf{Dirichlet, Gamma density routines}}\\
27 \ccode{esl\_dirichlet\_LogProbData()} & $\log P( \mbox{count vector} \mid \mbox{mixture Dirichlet}$.\\
28 \ccode{esl\_dirichlet\_LogProbProbs()} & $\log P( \mbox{prob vector} \mid \mbox{mixture Dirichlet}$.\\
29 \ccode{esl\_dirichlet\_LogGamma()} & $\log \Gamma(x)$.\\
30 \multicolumn{2}{c}{\textbf{Sampling code}}\\
31 \ccode{esl\_dirichlet\_\{D,F\}Sample()} & Sample a probability vector from a Dirichlet.\\
32 \ccode{esl\_dirichlet\_\{D,F\}SampleUniform()} & Sample a probability vector uniformly.\\
33 \ccode{esl\_dirichlet\_SampleBeta()} & Sample from Beta$(\theta_1, \theta_2$).\\
34 \multicolumn{2}{c}{\textbf{Input from file}}\\
35 \ccode{esl\_mixdchlet\_Read()} & Input of a mixture Dirichlet from a file.\\ \hline
36 \end{tabular}
37
38 \subsection{Example of using the dirichlet API}
39
40 An example that reads a mixture Dirichlet prior from a file, samples a
41 probability vector from it, samples a count vector from the
42 probability vector, then infers which mixture component generated the
43 data and uses mean posterior estimation to reestimate the probability
44 vector from the counts:
45
46 \input{cexcerpts/dirichlet_example}
47
48 \subsection{Accessing information in the ESL\_MIXDCHLET object}
49
50 You may need to access the information in the \ccode{ESL\_MIXDCHLET}
51 object. The data fields inside this structure are:
52
53 \input{cexcerpts/dirichlet_mixdchlet}
54
55
56
57