summaryrefslogtreecommitdiff
path: root/report/pyp_clustering/acl09-short/slides.tex
blob: af1db1fce8da77417329b7d189a6c13e9ec1e1e4 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
\documentclass{beamer}
%\documentclass[serif]{beamer}


\mode<presentation>
{
% \usetheme{Warsaw}
%  \usetheme{Madrid}
 \usetheme{Boadilla}

  \setbeamercovered{transparent}
}


\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}

\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{subfigure}
\usepackage{CJK}

% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% abbreviations

%% for tables
\newcommand{\mc}{\multicolumn}
\newcommand{\lab}[1]{\multicolumn{1}{c}{#1}}
\newcommand{\ind}[1]{{\fboxsep1pt\raisebox{-.5ex}{\fbox{{\tiny #1}}}}}

%% for dcolumn
%\newcolumntype{d}{D{.}{.}{1.4}}
%\newcolumntype{s}{D{.}{.}{0.3}}

%% markup
%\renewcommand{\key}[1]{\alert{\textit{#1}}}
\newcommand{\buffer}[1]{{\color{blue}\textbf{#1}}}
\newcommand{\pred}[1]{\code{#1}}

%% colors
\newcommand{\textred}[1]{\alert{#1}}
\newcommand{\textblue}[1]{\buffer{#1}}
\definecolor{tablecolor}{cmyk}{0,0.3,0.3,0}
\newcommand{\keytab}[1]{\mc{1}{>{\columncolor{tablecolor}}d}{#1}}

% rules
\newcommand{\psr}[2]{#1 $\rightarrow \langle $ #2 $\rangle$}

\newenvironment{unpacked_itemize}{
\begin{itemize}
  \setlength{\itemsep}{10pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}

\newcommand{\condon}{\hspace{0pt} | \hspace{1pt}}
\definecolor{darkblue}{rgb}{0,0,0.6}
\newcommand{\blueexample}[1]{\textcolor{darkblue}{\rm #1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\bx}{\mathbf{x}}
\newcommand{\bz}{\mathbf{z}}
\newcommand{\bd}{\mathbf{d}}
\newcommand{\by}{\mathbf{y}}
\newcommand\bleu{${B{\scriptstyle LEU}}$}


\title[A Note on the Implemention of HDPs]{A Note on the Implementation of Hierarchical Dirichlet Processes}

\author[Blunsom et al.]{{\bf Phil Blunsom}$^*$, Trevor Cohn$^*$, \\Sharon
Goldwater$^*$ and Mark Johnson$^\dagger$}

\institute[Uni. of Edinburgh] % (optional, but mostly needed)
{
  $^*$School of Informatics, University of Edinburgh \\
  $^\dagger$Department of Cognitive and Linguistic Sciences, Brown University \\
}

\date{August 4, 2009}


\subject{Hierarchical Dirichlet Processes}


\pgfdeclareimage[height=1.0cm]{university-logo}{logo}
\logo{\pgfuseimage{university-logo}}

\AtBeginSection[]
{
  \begin{frame}<beamer>{Outline}
    %\tableofcontents[currentsection,currentsubsection]
    \tableofcontents[currentsection]
  \end{frame}
}


%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}


\begin{frame}[t]{Outline}
%\begin{exampleblock}{An example}
\vspace{0.5in}
\Large
\begin{unpacked_itemize}
\onslide<1-> \item GGJ06\footnote{S. Goldwater, T. Griffiths, M. Johnson.
Contextual dependencies in unsupervised word segmentation. ACL/COLING-06} 
introduced an approximation for use in hierarchical Dirichlet process (HDP) inference: \\ 
\onslide<2->{\alert{\textbf{It's wrong, don't use it.}}}
\onslide<3-> \item We correct that approximation for DP models. \\ 
\onslide<4->{\alert{\textbf{However, this doesn't extend to HDPs.}}}
\onslide<5> \item But that's ok because we'll describe an efficient exact implementation.
\end{unpacked_itemize}
%\end{exampleblock}
\end{frame}

\begin{frame}
\frametitle{The Chinese Restaurant Process}
In a Dirichlet Process unigram language model  words $w_1 \ldots w_n$ are generated as follows: 
\begin{align}
\nonumber G | & \alpha_0, P_0 &\sim & ~ \mbox{DP}(\alpha_0,P_0) \\
\nonumber w_i | & G &\sim & ~ G 
\end{align}
\begin{itemize}
  \item $G$ is a distribution over an infinite set of words, 
  \item $P_0$ is the probability that an word will be in the support of $G$, 
  \item $\alpha_0$ determines the variance of $G$.
\end{itemize}
\vspace{0.2in}
One way of understanding the predictions made by the DP model is through the Chinese restaurant process (CRP) \dots
\end{frame}

\begin{frame}
\frametitle{The Chinese Restaurant Process}
\only<1-9>{\vspace{-0.4in}}
\begin{figure}
\begin{center}
  \only<1>{\includegraphics[scale=0.7]{tables0.pdf}}
  \only<2>{\includegraphics[scale=0.7]{tables1.pdf}}
  \only<3>{\includegraphics[scale=0.7]{tables2.pdf}}
  \only<4>{\includegraphics[scale=0.7]{tables3.pdf}}
  \only<5>{\includegraphics[scale=0.7]{tables4.pdf}}
  \only<6>{\includegraphics[scale=0.7]{tables5.pdf}}
  \only<7>{\includegraphics[scale=0.7]{tables7.pdf}}
  \only<8>{\includegraphics[scale=0.7]{tables8.pdf}}
  \only<9>{\includegraphics[scale=0.7]{tables6.pdf}}
\end{center}
\end{figure}
\only<1-6>{
\vspace{-0.6in}
Customers (words) enter a restaurant and choose a table according to the distribution:
\begin{align}
\nonumber P(z_i = k | w_i = w, \mathbf{z}_{-i}) = \left\{ 
\begin{array}{ll} 
  \frac{n_k^{\mathbf{z}_{-i}}}{n_w + \alpha_0 P_0(w)}, 0 \leq k < |k|  \\
  \\ \frac{\alpha_0 P_0(w)}{n_w + \alpha_0 P_0(w)}, k = |k|
\end{array} \right.
\end{align}
%where $\mathbf{z}_{-i} = z_1 \dots z_{i-1}$ are the table assignments of the previous customers, $n_k^{\mathbf{z}_{-i}}$ is the number of customers at table $k$ in ${\mathbf{z}_{-i}}$, and $K(\mathbf{z}_{-i})$ is the total number of occupied tables.  
}
\only<7-9>{
\vspace{-0.4in}
The 7$^{th}$ customer `{\em the}' enters the restaurant and choses a table from
those already seating `{\em the}', or opening a new table:
}
\only<7>{
\begin{align}
\nonumber P(z_6 = 0 | w_6 = the, \mathbf{z}_{-6}) = \frac{2}{3 + \alpha_0 P_0(the)}
\end{align}
}
\only<8>{
\begin{align}
\nonumber P(z_6 = 2 | w_6 = the, \mathbf{z}_{-6}) = \frac{1}{3 + \alpha_0 P_0(the)}
\end{align}
}
\only<9>{
\begin{align}
\nonumber P(z_6 = 4 | w_6 = the, \mathbf{z}_{-6}) = \frac{P_0(the)}{3 + \alpha_0 P_0(the)}
\end{align}
}
\only<7-9>{\vspace{0.32in}}
\end{frame}

\begin{frame}
\frametitle{Approximating the table counts}
\begin{figure}
\begin{center}
  \includegraphics[scale=0.7]{tables_expectation.pdf}
\end{center}
\end{figure}

\begin{itemize}
  \item GGJ06 sought to avoid explicitly tracking tables by reasoning under
the expected table counts ($E[t_w]$).

\item Antoniak(1974) derives the expected table count as equal to the recurrence:
\begin{align}
\nonumber E[t_w] = \alpha_0 P_0(w) \sum_{i=1}^{n_w} \frac{1}{\alpha_0 P_0(w) + i - 1}
\label{eqn:true_expected}
\end{align}
\item Antoniak also suggests an approximation to this expectation which GGJ06 
 presents as: \only<2>{\alert{(corrected)}}
\only<1> {
\begin{align}
  \nonumber E[t_w] \approx \alpha_0 \log \frac{n_w + \alpha_0}{\alpha_0}
\end{align}
}
\only<2> {
\begin{align}
  \nonumber E[t_w] \approx \alpha_0 \alert{P_0(w)} \log \frac{n_w + \alpha_0
  \alert{P_0(w)}}{\alpha_0 \alert{P_0(w)}}
\end{align}
\vspace{-0.32cm}
}
\end{itemize}
\end{frame}


\begin{frame}
\frametitle{A better table count approximation}
\begin{itemize}
\item Antoniak's approximation makes two assumptions:
  \begin{unpacked_itemize}
    \item $\alpha_0$ is large, not the predominant situation in recent applications which employ a DP as a sparse prior,
    \item $P_0(w)$ is constant, which is not applicable to HDPs.
  \end{unpacked_itemize}
\vspace{1.0cm}
\item In our paper we derive an improved approximation based on a difference of digamma ($\psi$) functions:
\begin{align}
\nonumber E[t_w] = \alpha_0 P_0(w) \cdot \Bigg [\psi{\Big (\alpha_0
P_0(w)+n_w \Big)} - \psi{\Big (\alpha_0 P_0(w)} \Big ) \Bigg ]
\end{align}
\vspace{0.5cm}
\item However the restriction on $P_0(w)$ being constant remains \dots
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{DP performance}
\begin{figure}
{\centering \includegraphics[scale=0.45]{code/plot0.pdf}}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{DP performance}
\begin{figure}
{\centering \includegraphics[scale=0.45]{code/plot1.pdf}}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{DP performance}
\begin{figure}
{\centering \includegraphics[scale=0.45]{code/plot2.pdf}}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{HDP performance}
\begin{figure}
{\centering \includegraphics[scale=0.45]{code/plot3.pdf}}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Histogram Method}
\begin{unpacked_itemize}
  \item At this point we don't have a useful approximation of the expected table
    counts in a HDP model.
  \item However, we can describe a more compact representation for the state of the restaurant that doesn't require explicit table tracking.
  \item Instead we maintain a histogram for each dish $w_i$ of the frequency of a table having a particular number of customers.
\end{unpacked_itemize}
\end{frame}

\begin{frame}[t]
\frametitle{Histogram Method}
\begin{center}
  \only<1>{\includegraphics[scale=0.7]{tables0.pdf}}
  \only<2>{\includegraphics[scale=0.7]{tables1.pdf}}
  \only<3>{\includegraphics[scale=0.7]{tables2.pdf}}
  \only<4>{\includegraphics[scale=0.7]{tables3.pdf}}
  \only<5>{\includegraphics[scale=0.7]{tables4.pdf}}
  \only<6>{\includegraphics[scale=0.7]{tables5.pdf}}
  \only<7>{\includegraphics[scale=0.7]{tables7.pdf}}
  \only<8>{\includegraphics[scale=0.7]{tables9.pdf}}
\end{center}
\vspace{-2.5cm}
\only<6->{\vspace{0.47cm}}
\begin{center}
  \only<1>{\includegraphics[scale=0.2]{histogram_1.pdf}\hspace{-0.6cm}}
  \only<2>{\includegraphics[scale=0.2]{histogram_2.pdf}\hspace{-0.5cm}}
  \only<3>{\includegraphics[scale=0.2]{histogram_3.pdf}\hspace{-0.4cm}}
  \only<4>{\includegraphics[scale=0.2]{histogram_4.pdf}\hspace{-0.3cm}}
  \only<5>{\includegraphics[scale=0.2]{histogram_5.pdf}\hspace{-0.2cm}}
  \only<6>{\includegraphics[scale=0.2]{histogram_6.pdf}}
  \only<7>{\includegraphics[scale=0.2]{histogram_7.pdf}}
  \only<8>{\includegraphics[scale=0.2]{histogram_8.pdf}}
\end{center}
\end{frame}

\begin{frame}
\frametitle{Summary}
\begin{center} 
  \Large \textbf{The table count approximation of Goldwater et al. 2006 
  is broken, \alert{don't use it!}}
\end{center}
\end{frame}

\begin{frame}
%    \frametitle{Summary}
    \begin{center}
        \Large Thank you.
    \end{center}

\begin{block}{References}
    \footnotesize
    \vspace{0.5cm}
    P. Blunsom, T. Cohn, S. Goldwater and M. Johnson. A note on the
    implementation of hierarchical Dirichlet processes,
    {\em In the Proceedings of ACL-IJCNLP 2009}. \\
    \vspace{0.5cm}
    C. E. Antoniak. 1974. Mixtures of dirichlet processes with 
    applications to bayesian nonparametric problems. 
    {\em The Annals of Statistics}, 2(6):1152-1174.  \\
    \vspace{0.5cm}
    S. Goldwater, T. Griffiths, M. Johnson. 
    Contextual dependencies in unsupervised word segmentation. 
    {\em In the Proceedings of (COLING/ACL-2006)}. 
    \vspace{0.5cm}
\end{block}
\end{frame} 

\end{document}