Debian Codegraph @

texmf-dist/doc/latex/tikz-bayesnet/model_lda.tex

raw
1 % model_lda.tex
2 %
3 % Copyright (C) 2010,2011 Laura Dietz
4 % Copyright (C) 2012 Jaakko Luttinen
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU General Public License.
10 %
11 % See the files LICENSE_LPPL and LICENSE_GPL for more details.
12
13 % Latent Diriclet allocation model
14
15 %\beginpgfgraphicnamed{model-lda}
16 \begin{tikzpicture}[x=1.7cm,y=1.8cm]
17
18 % Nodes
19
20 \node[obs] (X) {$X$} ; %
21 \node[latent, above=of X] (T) {$T$} ; %
22 \node[latent, above=of T] (theta) {$\theta$}; %
23 \node[const, above=of theta] (atheta) {$\alpha_\theta$};
24
25
26 % Factors
27 \factor[above=of X] {X-f} {Multi} {} {} ; %
28 \factor[above=of T] {T-f} {left:Multi} {} {} ; %
29 \factor[above=of theta] {theta-f} {left:Dir} {} {} ; %
30
31 % More nodes
32 \node[latent, right=of X-f] (phi) {$\phi$}; %
33 \node[const, above=of phi] (aphi) {$\alpha_\phi$}; %
34
35 \factor[above=of phi] {phi-f} {right:Dir} {} {} ; %
36
37 \factoredge {theta} {T-f} {T} ; %
38 \factoredge {atheta} {theta-f} {theta} ; %
39 \factoredge {phi} {X-f} {X} ; %
40 \factoredge {aphi} {phi-f} {phi} ; %
41
42 \gate {X-gate} {(X-f)(X-f-caption)} {T}
43
44 \plate {plate1} { %
45 (X)(X-gate) %
46 (T)(T-f)(T-f-caption) %
47 } {$\forall 1 \leq i \leq n_d$}; %
48 \plate {} { %
49 (plate1) %
50 (theta)(theta-f)(theta-f-caption) %
51 } {$\forall d \in \mathcal{D}$} ; %
52 \plate {} { %
53 (phi)(phi-f)(phi-f-caption) %
54 } {$\forall t \in \mathcal{T}$} ; %
55
56 \end{tikzpicture}
57 %\endpgfgraphicnamed
58
59 %%% Local Variables:
60 %%% mode: tex-pdf
61 %%% TeX-master: "example"
62 %%% End: