-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresentation.tex
457 lines (345 loc) · 9.69 KB
/
presentation.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
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
\documentclass{beamer}
\mode<presentation>
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{bm}
\begin{document}
\begin{frame}
\frametitle{Overview}
\begin{itemize}
\item Dependency Model with Valence
\begin{enumerate}
\item Introduction
\item Implementation
\end{enumerate}
\item Thousand random restarts
\item Future Work
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Dependency Model with Valence}
\begin{itemize}
\item Unsupervised Dependency Parser
\item Conceived by Dan Klein
\item Generative model
\item Requires only 5,773 sentences to train juxtappose state of the art supervised parsers which need around 40,000 annotated sentences
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Example}
John saw Mary
\end{frame}
\begin{frame}
Generate the root
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& Mary \\
\end{deptext}
\depedge{1}{3}{}
\end{dependency}
\end{figure}
Repeat the next few steps recursively
\end{frame}
\begin{frame}
For a given word, generate all the right dependents
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& Mary \\
\end{deptext}
\depedge{1}{3}{}
\depedge{3}{4}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
When a word no longer takes any dependents on the right, generate STOP symbol to the right
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& Mary \& STOP \\
\end{deptext}
\depedge{1}{3}{}
\depedge{3}{4}{}
\depedge{4}{5}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
Generate all the left dependents of the word. When a word no longer takes any dependents on the left, generate STOP symbol to the left
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{3}{}
\depedge{3}{5}{}
\depedge{5}{6}{}
\depedge{5}{4}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& STOP \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{3}{}
\depedge{3}{4}{}
\depedge{3}{6}{}
\depedge{6}{7}{}
\depedge{6}{5}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& saw \& STOP \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{3}{}
\depedge{3}{2}{}
\depedge{3}{4}{}
\depedge{3}{6}{}
\depedge{6}{7}{}
\depedge{6}{5}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& John \& STOP \& saw \& STOP \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{4}{}
\depedge{4}{2}{}
\depedge{2}{3}{}
\depedge{4}{5}{}
\depedge{4}{7}{}
\depedge{7}{6}{}
\depedge{7}{8}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& STOP \& John \& STOP \& saw \& STOP \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{5}{}
\depedge{5}{3}{}
\depedge{3}{4}{}
\depedge{3}{2}{}
\depedge{5}{6}{}
\depedge{5}{8}{}
\depedge{8}{9}{}
\depedge{8}{7}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}
root \& STOP \& John \& STOP \& STOP \& saw \& STOP \& STOP \& Mary \& STOP \\
\end{deptext}
\depedge{1}{6}{}
\depedge{6}{3}{}
\depedge{6}{9}{}
\depedge{9}{8}{}
\depedge{9}{10}{}
\depedge{3}{2}{}
\depedge{3}{4}{}
\depedge{6}{5}{}
\depedge{6}{7}{}
\end{dependency}
\end{figure}
\end{frame}
\begin{frame}
\begin{gather*}
P(D(h)) = \prod\limits_{dir\in(l,r)} \prod\limits_{a\in deps_D(h,dir)} P_{STOP} (\neg STOP | h, dir, adj) \\
P_{CHOOSE}(a|h, dir) P(D(a)) P_{STOP}(STOP | h, dir, adj)
\end{gather*}
\end{frame}
\begin{frame}
\frametitle{Goal of the Parser}
To determine the parameters for underlying distribution:
\begin{itemize}
\item The probability that a head word takes a modifier (depProb[h, m, direction])
\item The probability that a head word continues to take further arguments (contProb[h, direction, adj])
\item The probability that a head word stops taking further arguments (stopProb[h, direction, adj])
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Implementation of DMV}
A sentence can have several possible parses:
\begin{figure}[!ht]
\centering
\includegraphics[width=90mm]{images/rsz_all_deps.jpg}
\label{overflow}
\end{figure}
Eisner’s parsing algorithm -- keep track of the counts of all possible parses.
A hypergraph -- efficient data structure -- calculating the probabilities of each one of these parses.
\end{frame}
\begin{frame}
\frametitle{Modified Eisner's parsing algorithm}
\begin{figure}
\centering
\includegraphics[width=90mm]{images/eisner_rules.jpg}
\caption{Eisner's algorithm rules}
\label{overflow}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Hypergraph}
A hypergraph H = $(V, E)$, where $V$ is the set of vertices, $E$ is the set of hyperedges.
Hyperedge $e$ $\in$ $E$ of a weighted graph is a triple $e~=~(T(e), h(e), f(e))$, where $h(e)$ $\in$ $V$ is its head vertex and $T(e)$ $\in$ $V^*$ is an ordered list of tail vertices.
$f(e)$ is a weight function
\end{frame}
\begin{frame}
\begin{figure}
\centering
\includegraphics[width=90mm]{images/hypergraph_example.jpg}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\includegraphics[width=90mm]{images/hypergraph.png}
\end{figure}
\end{frame}
\begin{frame}
\begin{algorithm}[H]
\caption{Compute Weights}
\begin{algorithmic}
\State Lets assume incomplete constituent as i.c and complete constituent stop as c.s
\If{edge.headNode $\in$ i.c}
\State return depProb[edge.headWord, edge.modifierWord, edge.dir] $\times$ contProb[edge.headWord, edge.dir, edge.isAdj]
\ElsIf{edge.headNode $\in$ c.s}
\State return stopProb[edge.headWord, edge.dir, edge.isAdj]
\Else
\State return 1
\EndIf
\end{algorithmic}
\end{algorithm}
\end{frame}
\begin{frame}
\frametitle{Implementation}
\begin{itemize}
\item The insideOutside algorithm is run on the entire hypergraph.
\item The inside probability of the root of the hypergraph gives the total probability of the sentence Z.
\item The marginals of the nodes and the edges of the hypergraph are computed using the PyDecode library.
\item counts = marginals / Z
\item The em algorithm is run 10 times for all the sentences
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Related work}
\begin{itemize}
\item (Smith and Eisner, 2005) used contrastive estimation together with DMV.
\item (Cohen et al., 2008) used logistic normal priors
\item (HeaddenIII et al., 2009) extended the valence and conditioned generating a new argument on whether it is adjacent or not. $P_{CHOOSE}(a|h, dir)$ in the above equation is thus substituted by $P_{CHOOSE}(a|h, dir, adj)$
\item (Spitkovsky et al., 2011) observed a strong connection between English punctuation and phrase boundaries, split sentences at punctuation marks and imposed parsing restrictions over their fragments.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Initialization of DMV}
Consider a sentence with words $w_1$ $\ldots$ $w_n$ where $n$ is the number of words in the sentence.\\
(1) Each word has a uniform probability of becoming a ROOT.
$$ P(ROOT) = \frac{1}{n} $$
(2) The probability of dependency between two words is inversely proportional to the distance between them.
Linguistic intuition that shorter dependencies are preferable to longer
\end{frame}
\begin{frame}
\frametitle{Thousand random restarts}
\begin{algorithm}[H]
\caption{EM algorithm for a thousand random restarts}
\begin{algorithmic}
\For{iterations = 1 to 10}
\For{sentence in corpus}
\State Build hypergraph
\For{multinomial in Multinomials}
\State Update counts for sentence. Estimation step
\EndFor
\EndFor
\For{multinomial in Multinomials}
\State Recompute the probabilities. Maximization step
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\includegraphics[width=90mm]{images/directed_accuracy.png}
\caption{Directed accuracy vs likelihood}
\label{overflow}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\centering
\includegraphics[width=90mm]{images/undirected_accuracy.png}
\caption{Undirected accuracy vs likelihood}
\label{overflow}
\end{figure}
\end{frame}
\begin{frame}
\begin{table}[htbp]
\begin{center}
\begin{tabular}{|l|c|r|}
\hline
\textbf{Characteristic} & \textbf{Ad-harmonic Initializer} & \textbf{Random Initializer}\\
\hline
Undirected accuracy & 65.5 & 70.56 (+5.06) \\
Directed accuracy & 51.5 & 55.59 (+4.09) \\
Likelihood & -102,453.49 & -102,375.79 (-77.7) \\
\hline
\end{tabular}
\end{center}
\caption{Comparing accuracies of Ad-harmonic and Random Initializer}
\end{table}
\end{frame}
\begin{frame}
\begin{figure}[!ht]
\centering
\includegraphics[width=90mm]{images/avg_accuracy.png}
\caption{Average accuracy per iteration}
\label{overflow}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}[!ht]
\centering
\includegraphics[width=90mm]{images/avg_likelihood.png}
\caption{Average likelihood per iteration}
\label{overflow}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Future Work}
\begin{itemize}
\item It takes 180 minutes to run EM for 60 iterations with 40 random restarts.
\item The time taken to build the model is directly proportional to the number of random restarts
\item To scale to a million random restarts, the time taken to build the model must be independent of the number of random restarts.
\end{itemize}
\end{frame}
\end{document}