-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
506 lines (469 loc) · 22.8 KB
/
index.html
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Streaming Topic Model Training and Inference</title>
<meta name="description" content="Streaming Topic Model Training and Inference">
<meta name="author" content="Suneel Marthi; Joey Frazee">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/bbuzz17.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]> <script src="lib/js/html5shiv.js"></script> <![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-background-image="img/barcelona.jpg">
<br/>
<br/>
<br/>
<h3>Streaming Topic Model Training and Inference</h3>
<br/>
<p>Suneel Marthi</p>
<p style="font-size: 60%">March 21, 2019<br/>
DataWorks Summit 2019 - Barcelona</p>
</section>
<section data-background-image="img/barcelona.jpg">
<h3>$WhoAreWe</h3>
<br/>
<ul style='list-style: none;'>
<li>
<h6 style='text-align: left; font-size: 80%;'>Suneel Marthi <br/><span style="font-size: 60%"><i class="fa fa-twitter" aria-hidden="true"></i> @suneelmarthi</span></h6>
<ul style='font-size: 70%;'>
<li>Member of Apache Software Foundation</li>
<li>Committer and PMC on Apache Mahout, Apache OpenNLP, Apache Streams</li>
</ul>
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2.jpg">
<h3>Agenda</h3>
<ul>
<li>Motivation for Topic Modeling</li>
<li>Existing Approaches for Topic Modeling</li>
<li>Topic Modeling on Streams</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>Motivation for Topic Modeling</h3>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h3>Topic Models</h3>
<ul>
<li>Automatically discovering main topics in collections of documents
</li>
<ul>
<li>Overall</li>
<ul>
<li>What are the main themes discussed on a mailing list or a discussion forum ?
</li>
<li>
What are the most recurring topics discussed in research papers ?
</li>
</ul>
</ul>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-yellowish.jpg">
<h3>Topic Models (Contd)</h3>
<ul>
<li>Per Document</li>
<ul>
<li>What are the main topics discussed in a certain (single) newspaper article ?
</li>
<li>What is the most distinctive topic that makes a certain research article more interesting than the others ?</li>
</ul>
</ul>
</section>
<section data-background-image="img//ZsMwlm2-greenish.jpg">
<h3>Uses of Topic Models</h3>
<ul>
<li>Search Engines to organize text</li>
<li>Annotating Documents according to these topics</li>
<li>Uncovering hidden topical patterns across a document collection</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>Common Approaches to Topic Modeling</h3>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<ul>
<li>Latent Dirichlet Allocation (LDA)</li>
<ul>
<li>Topics are composed by probability distributions over words</li>
<li>Documents are composed by probability distributions over Topics</li>
<li>Batch Oriented approach</li>
</ul>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>LDA Model</h3>
<table align="left">
<tr>
<td width=400 style="vertical-align: top"><img src="img/lda.png" border=0/></td>
<td width=400 style="vertical-align: middle">
<ul>
<li style="font-size: 16pt"><em>N</em>: vocab size</li>
<li style="font-size: 16pt"><em>M/D</em>: # of documents</li>
<li style="font-size: 16pt"><em>alpha</em>: prior on per-document topic dist.</li>
<li style="font-size: 16pt"><em>beta</em>: prior on topic-word dist.</li>
<li style="font-size: 16pt"><em>theta</em>: per-document topic dist.</li>
<li style="font-size: 16pt"><em>phi</em>: per-topic word dist.</li>
<li style="font-size: 16pt"><em>z</em>: topic for word w</li>
</ul>
</td>
</tr>
<tr>
<td colspan=2 style="font-size: 18pt;"><p><b>Intuition</b>: Documents are a mixture of topics, topics are a mixture of words. So documents can be generated by drawing a sample of topics, and then drawing a sample of words.</p></td>
</tr>
</table>
</section>
<section data-background-image="img/ZsMwlm2-yellowish.jpg">
<ul>
<li>Latent Semantic Analysis (LSA)</li>
<ul>
<li style="font-size: 85%">SVDed TF-IDF Document-Term Matrix </li>
<li style="font-size: 85%">Batch Oriented approach</li>
</ul>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-blueish.jpg">
<ul>
<li>Drawbacks of Traditional Topic Modeling Approach</li>
<ul>
<li>Problem : labelling topics is often a manual task
</li>
</ul>
<pre><code data-trim data-noescape>
E.g. LDA topic:30% basket,15% ball,10% drunk,…
can be tagged as basketball
</code></pre>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h3><s>Common Approaches</s> Deep Learning (of course)</h3>
<ul>
<li>Learn to perform LDA: LDA supervised DNN training (inference speed up)
<ul>
https://arxiv.org/abs/1508.01011
</ul>
</li>
<li>Deep Belief Networks for Topic Modelling
<ul>
<li>https://arxiv.org/abs/1501.04325</li>
</ul>
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h3>What are Embeddings ?</h3>
<p align="left" style="font-size: 85%">Represent a document as a point in space, semantically similar docs are close together when plotted</p>
<p align="left" style="font-size: 85%">Such a representation is learned via a (shallow) neural network algorithm</p>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h4>Embeddings for Topic Modeling</h4>
<ul>
<li>LDA2Vec: Mixing LDA and word2vec word embeddings
<ul>
https://arxiv.org/abs/1605.02019
</ul>
</li>
<li>Navigating embeddings: geometric navigation in word
and doc embeddings space looking for topics
</li>
</ul>
<p><img src='img/embeddings.png' style=' position: absolute; right: 0px; bottom: 0px; width: 30%; height: 30%; margin: 0px, 0px, 0px, 0px; border: none; background: none;box-shadow: none; ' align="right"/><br/></p>
</section>
<section data-background-image="img/ZsMwlm2-yellowish.jpg">
<h4>Static vs Dynamic Corpora</h4>
<ul>
<li>Learning Topic Models over a fixed set of Documents
<ul>
<li>Fetch the Corpus</li>
<li>Train and Fit a topic model</li>
<li>Extract topics</li>
<li>...other downstream tasks</li>
</ul>
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h4>Static vs Dynamic Corpora (Contd)</h4>
<ul>
<li>What to do with Corpus updates?
<ul>
<li>Document collections are not static in real world</li>
<li>There may be no document collections to begin with</li>
<li>Memory limits with large corpora</li>
<li>Reprocess entire corpora when new documents are added</li>
</ul>
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-blueish.jpg">
<h4>Static vs Dynamic Corpora (Contd)</h4>
<ul>
<li>Streams, Streams, Streams
<ul>
<li>Twitter stream</li>
<li>Reddit posts</li>
<li>Papers on ResearchGate and Arxiv</li>
<li>....</li>
</ul>
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h3>Questions for Audience</h3>
<ul>
<li style="font-size: 85%">
Who’s doing inference or scoring on streaming data?<br/>
</li>
<li style="font-size: 85%">
Who’s doing online learning and optimization on streaming data?
</li>
</ul>
<p>(2) is hard, sometimes because the algorithms aren’t there.
But, also because people don’t know the algorithms are there.
</p>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>Topic Modeling on Streams</h3>
</section>
<section data-background-image="img/ZsMwlm2-blueish.jpg">
<h4>2 Streaming Approaches</h4>
<ul>
<li>Learning Topics from Jira Issues</li>
<li>Online LDA</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>Learning Topics on Jira Issues</h3>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h3>Workflow</h3>
<img src='img/Jira-Topic-Model.png' style='max-width: 80%; border: none; background: none;box-shadow: none; '/>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h4>FLINK-9963: Add a single value table format factory</h4>
<img src='img/Flink9963.png' style='max-width: 80%; border: none; background: none;box-shadow: none; '/>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h4>Topics extracted for Flink-9963</h4>
<ul>
<li style="font-size: 85%">format factory</li>
<li style="font-size: 85%">table schema</li>
<li style="font-size: 85%">table source</li>
<li style="font-size: 85%">sink factory</li>
<li style="font-size: 85%">table sink</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h4>FLINK-8286: Fix Flink-Yarn-Kerberos integration for FLIP-6</h4>
<img src='img/Flink8286.png' style='max-width: 80%; border: none; background: none;box-shadow: none; '/>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h4>Topics extracted for Flink-8286</h4>
<ul>
<li style="font-size: 85%">yarn kerberos integration</li>
<li style="font-size: 85%">kerberos integrations</li>
<li style="font-size: 85%">yarn kerberos</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-yellowish.jpg">
<h3>Bayesian Inference</h3>
<p><b>Goal</b>: Calculate the posterior distribution of a probabilistic model given data</p>
<br/>
<ul>
<li style="font-size: 85%">Gibbs sampling/MCMC: Repeatedly sample from conditional distribution(s) to approximate the posterior of the joint distribution;
typically a batch process<br/>
</li>
<li style="font-size: 85%">
Variational Bayes: Optimize the parameters of a function that approximates joint distribution
</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h3>Variational Bayes</h3>
<ul>
<li style="font-size: 85%">Expectation Maximization-like optimization</li>
<li style="font-size: 85%">Faster and more accurate</li>
<li style="font-size: 85%">Can often be computed online (on windows over streams)</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h3>Online LDA (1/2)</h3>
<ul>
<li style="font-size: 85%">Variational Bayes for LDA</li>
<li style="font-size: 85%">Batch or online</li>
<li style="font-size: 85%">Iterate between optimizing per-word topics and per-document topics (“E” step) and topic-word distributions (“M” step)</li>
<li style="font-size: 85%">Default topic model optimization in Gensim, scikit-learn, Apache Spark MLlib -- not because it’s amenable to streaming per se, but more because it’s memory efficient and can be applied to large corpora.</li>
</ul>
<p style="font-size: 40%; text-align: left;"><a style="color: white;" href="https://www.di.ens.fr/~fbach/mdhnips2010.pdf">Hoffman, Blei & Bach. Online Learning for Latent Dirichlet Allocation. Proceedings of Neural Information Processing Systems. 2010.</a></p>
</section>
<section data-background-image="img/ZsMwlm2-yellowish.jpg">
<h3>Online LDA (2/2)</h3>
<table align="left">
<tr>
<td width=400 style="vertical-align: top"><img src="img/online_vb_for_lda.png" border=0/></td>
<td width=400 style="vertical-align: top">
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">job-constant</li>
<li style="font-size: 11pt"><em>K</em>: number of topics</li>
<li style="font-size: 11pt"><em>alpha</em>: topic-document dist. prior</li>
<li style="font-size: 11pt"><em>eta</em>: topic-word dist. prior</li>
<li style="font-size: 11pt"><em>tau0</em>: learning rate</li>
<li style="font-size: 11pt"><em>kappa</em>: decay rate</li>
</ul>
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">(mini)batch-local</li>
<li style="font-size: 11pt"><em>gamma</em>: theta prior</li>
<li style="font-size: 11pt"><em>theta</em>: param. for per-document topic dist</li>
<li style="font-size: 11pt"><em>phi</em>: param. for per-topic word dist.</li>
<li style="font-size: 11pt"><em>rho</em>: update weight</li>
</ul>
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">job-global</li>
<li style="font-size: 11pt"><em>lambda</em>: parameter for topic-word dist.</li>
<li style="font-size: 11pt"><em>t</em>: documents/batches seen (index)</li>
</ul>
</td>
</tr>
<tr>
<td width=400 style="font-size: 14pt">
<p><b>Goal</b>: Optimize the topic-word dist. parameter lambda; it tells us what words belong to the topics.</p>
<p style="font-size: 10pt">[Image source: Hoffman, Blei & Bach, 2010.]</p>
</td>
<td width=400 style="font-size: 14pt"><p style="padding-left: 32px">Job-global parameters can be tracked in a state store. Batch-local parameters can be discarded.</p></td>
</tr>
</table>
</section>
<section data-background-image="img/ZsMwlm2-greenish.jpg">
<h2>Online LDA on Beam</h2>
<table align="left">
<tr>
<td width=400 style="vertical-align: top">
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">job-constant</li>
<li style="font-size: 11pt"><em>K</em>: number of topics</li>
<li style="font-size: 11pt"><em>alpha</em>: topic-document dist. prior</li>
<li style="font-size: 11pt"><em>eta</em>: topic-word dist. prior</li>
<li style="font-size: 11pt"><em>tau0</em>: learning rate</li>
<li style="font-size: 11pt"><em>kappa</em>: decay rate</li>
</ul>
</td>
<td width=400><p style="font-size: 50%;">Set job parameters globally with setGlobalJobParameters() on execution environment, or pass as arguments to operators</p></td>
</tr>
<tr>
<td width=400 style="vertical-align: top">
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">(mini)batch-local</li>
<li style="font-size: 11pt"><em>gamma</em>: theta prior</li>
<li style="font-size: 11pt"><em>theta</em>: param. for per-document topic dist</li>
<li style="font-size: 11pt"><em>phi</em>: param. for per-topic word dist.</li>
<li style="font-size: 11pt"><em>rho</em>: update weight</li>
</ul>
</td>
<td width=400><p style="font-size: 50%;">Operator/task-internal and don't need to be accessible by other tasks</p></td>
</tr>
<tr>
<td width=400 style="vertical-align: top">
<ul>
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -16px">job-global</li>
<li style="font-size: 11pt"><em>lambda</em>: parameter for topic-word dist.</li>
<li style="font-size: 11pt"><em>t</em>: documents/batches seen (index)</li>
</ul>
</td>
<td width=400 style="vertical-align: top">
<ul style="margin-left: 18px;">
<li style="font-size: 14pt; list-style: none; padding-left: 0; margin-left: -24px">Several options:</li>
<li style="font-size: 11pt">External key-value store</li>
<li style="font-size: 11pt">Accumulators: <em>lambda</em> update as increment, accumulator + broadcast variables</li>
<li style="font-size: 11pt">Broadcast state</li>
</ul>
</td>
</tr>
<tr>
<td colspan=2><p style="font-size: 40%">And, (mini)batches selected by Window size</p></td>
</tr>
</table>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<h3>OnlineLDA Pipeline</h3>
<img src='img/pipeline.png' style='max-width: 80%; border: none; background: none;box-shadow: none; '/>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h2>So what?</h2>
</section>
<section data-background-image="img/ZsMwlm2-purpleish.jpg">
<ul>
<li style="font-size: 90%">For many tasks, the default is batch training/optimization</li>
<li style="font-size: 90%">Often, even if good online training and optimization algorithms exist (why?)</li>
<li style="font-size: 90%">So if your algorithms only require 1-step of parameter state, why not just do streaming?</li>
<li style="font-size: 90%">You can get instant, always up-to-date results by putting the effort into using a different class of optimization algorithms an using a stream processing engine, so just do that</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-redish.jpg">
<h2>Links</h2>
<ul>
<li>http://papers.nips.cc/paper/3902-online-learning-for-latentdirichlet-allocation
</li><br/>
<li>Learning from LDA using Deep Neural Networks - https://arxiv.org/pdf/1508.01011.pdf</li><br/>
<li>Deep Belief Nets for Topic Modeling - https://arxiv.org/pdf/1501.04325.pdf</li><br/>
<li>Topic Modeling on Jira issues: https://github.com/tteofili/jtm</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2-blueish.jpg">
<h3>Credits</h3>
<ul>
<li>Tommaso Teofili, Simone Tripodi (Adobe - Rome)</li>
<li>Joern Kottmann, Bruno Kinoshita (Apache OpenNLP)</li>
<li>Fabian Hueske (Apache Flink, Data Artisans)</li>
</ul>
</section>
<section data-background-image="img/ZsMwlm2.jpg">
<h2>Questions ???</h2>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
controls: false,
progress: true,
history: true,
center: true,
slideNumber: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
keyboard: true,
touch: true,
loop: false,
fragments: true,
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>