-
Notifications
You must be signed in to change notification settings - Fork 0
/
lda.tex
68 lines (54 loc) · 1.99 KB
/
lda.tex
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
63
64
65
66
67
68
\documentclass{article}
\usepackage{algorithmic}
\usepackage{amstext}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,fit,positioning}
\newcommand{\dir}{\text{Dirichlet}}
\newcommand{\mult}{\text{Multinomial}}
\begin{document}
\section{Plate Diagram}
\begin{figure}[htp]
\centering
\begin{tikzpicture}
[
observed/.style={minimum size=15pt,circle,draw=blue!50,fill=blue!20},
unobserved/.style={minimum size=15pt,circle,draw},
hyper/.style={minimum size=1pt,circle,fill=black},
post/.style={->,>=stealth',semithick},
]
\node (w-j) [observed] at (0,0) {$w_w$};
\node (z-j) [unobserved] at (-1.5,0) {$z_w$};
\node (z-prior) [unobserved] at (-3,0) {$\theta_d$};
\node (z-hyper) [label=above:$\alpha$] at (-4.5,0) {};
\filldraw [black] (-4.5,0) circle (3pt);
\node (w-hyper) [label=above:$\beta$] at (-1.5,1.5) {};
\filldraw [black] (-1.5,1.5) circle (3pt);
\path
(z-j) edge [post] (w-j)
(z-hyper) edge [post] (z-prior)
(z-prior) edge [post] (z-j)
(w-hyper) edge [post] (w-j)
;
\node [draw,fit=(w-j) (z-prior), inner sep=14pt] (plate-context) {};
\node [above right] at (plate-context.south west) {$D$};
\node [draw,fit=(w-j) (z-j), inner sep=10pt] (plate-token) {};
\node [above right] at (plate-token.south west) {$N$};
\end{tikzpicture}
\caption{Plate Diagram of LDA. For more information, see \cite{Blei:2003:LDA:944919.944937} }
\label{fig:graphical-model}
\end{figure}
\section{Equations}
See~\cite{Blei:2003:LDA:944919.944937}.
\subsection{Generative Process}
\begin{algorithmic}[1]
\FOR{document $d_d$ in corpus $D$}
\STATE Choose $\theta_d \sim \dir(\alpha) $
\FOR{position $w$ in $d_d$}
\STATE Choose a topic $z_w \sim \mult(\theta_d)$
\STATE Choose a word $w_w$ from $p(w_w | z_w,\beta)$, a multinomial distribution over words conditioned on the topic and the prior $\beta$.
\ENDFOR
\ENDFOR
\end{algorithmic}
\bibliographystyle{plain}
\bibliography{tm}
\end{document}