summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tikz-bayesnet/model_lda.tex
blob: 92e9acc4a2f9eaa3ede52896d91aeca8e373f6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% model_lda.tex
%
% Copyright (C) 2010,2011 Laura Dietz
% Copyright (C) 2012 Jaakko Luttinen
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU General Public License.
%
% See the files LICENSE_LPPL and LICENSE_GPL for more details.

% Latent Diriclet allocation model

%\beginpgfgraphicnamed{model-lda}
\begin{tikzpicture}[x=1.7cm,y=1.8cm]

  % Nodes

  \node[obs]                   (X)      {$X$} ; %
  \node[latent, above=of X]    (T)      {$T$} ; %
  \node[latent, above=of T]    (theta)  {$\theta$}; %
  \node[const, above=of theta] (atheta) {$\alpha_\theta$};


  % Factors
  \factor[above=of X]     {X-f}     {Multi} {} {} ; %
  \factor[above=of T]     {T-f}     {left:Multi} {} {} ; %
  \factor[above=of theta] {theta-f} {left:Dir} {} {} ; %

  % More nodes
  \node[latent, right=of X-f] (phi)  {$\phi$}; %
  \node[const, above=of phi]  (aphi) {$\alpha_\phi$}; %

  \factor[above=of phi] {phi-f} {right:Dir} {} {} ; %

  \factoredge {theta}  {T-f}     {T} ; %
  \factoredge {atheta} {theta-f} {theta} ; %
  \factoredge {phi}    {X-f}     {X} ; %
  \factoredge {aphi}   {phi-f}   {phi} ; %

  \gate {X-gate} {(X-f)(X-f-caption)} {T}

  \plate {plate1} { %
    (X)(X-gate) %
    (T)(T-f)(T-f-caption) %
  } {$\forall 1 \leq i \leq n_d$}; %
  \plate {} { %
    (plate1) %
    (theta)(theta-f)(theta-f-caption) %
  } {$\forall d \in \mathcal{D}$} ; %
  \plate {} { %
    (phi)(phi-f)(phi-f-caption) %
  } {$\forall t \in \mathcal{T}$} ; %

\end{tikzpicture}
%\endpgfgraphicnamed

%%% Local Variables: 
%%% mode: tex-pdf
%%% TeX-master: "example"
%%% End: