-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeep_graph_1.html
276 lines (176 loc) · 7.32 KB
/
deep_graph_1.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
<!DOCTYPE html>
<html>
<head>
<title>Deep Learning on Graphs [Marc Lelarge]</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="./assets/katex.min.css">
<link rel="stylesheet" type="text/css" href="./assets/slides.css">
<link rel="stylesheet" type="text/css" href="./assets/grid.css">
</head>
<body>
<textarea id="source">
class: center, middle, title-slide
count: false
# Deep Learning on Graphs<br/>
# (1/3)
<br/><br/>
.bold[Marc Lelarge]
.bold[[www.dataflowr.com](https://www.dataflowr.com)]
---
# (1) Node embedding
## Language model
### one fixed graph, no signal. Ex: community detection
# .gray[(2) Signal processing on graphs]
## .gray[Fourier analysis on graphs]
### .gray[one fixed graph, various signals. Ex: classification of signals]
# .gray[(3) Graph embedding]
## .gray[Graph Neural Networks]
### .gray[various graphs. Ex: classification of graphs]
---
# Node embedding
## Language model
### one fixed graph, no signal. Ex: community detection
- [DeepWalk](https://arxiv.org/abs/1403.6652)
- hierarchical softmax
- [node2vec](https://snap.stanford.edu/node2vec/)
- negative sampling
---
# Language model
- goal: to estimate the likelihood of a specific sequence of words appearing in a corpus.
- formally: to maximize $p(w\_{n} \| w\_{1}, ... , w\_{n-1})$ where $w\_i$ are in the vocabulary $V$.
--
count: false
## skip-gram model
.center.width-50[![](images/graphs/skipgram.png)]
- from the text, construct $D$ the multiset of all word and context pairs: $(w,c)$.
---
# skip-gram model
.center.width-50[![](images/graphs/skipgram.png)]
- from the text, construct $D$ the multiset of all word and context pairs: $(w,c)$.
- goal: maximize $\prod\_{(w,c)\in D} p(c\| w ; \theta)$ in the parameter $\theta$.
- parametrization of the conditional probability thanks to a softmax:
$$
p(c\|w; \theta) = \frac{e^{u\_c \cdot u\_w}}{\sum\_{c'\in C}e^{u\_{c'} \cdot u\_w}},
$$
where $u\_c$ and $u\_w$ are vector representations for $c$ and $w$ and $C$ is the set of all available contexts.
---
# Hierarchical softmax
.center.width-30[![](images/graphs/hierarchical.png)]
- Assign the contexts to the leaves of a binary tree and use the parametrization:
$$
p(c\|w; \theta) = \prod\_{b\in \pi(c)} \sigma(h\_b \cdot u\_w),
$$
where $\pi(c)$ is the path from the root to the leaf $c$ and $\sigma$ is the sigmoid function:
$$
\sigma(x) = \frac{1}{1+e^{-x}}.
$$
- reduce computational complexity from $O(|C|)$ to $O(\log|C|)$.
---
# DeepWalk
- a sentence = a random walk on the graph
- Hierarchical softmax speed up: assign shorter paths to frequent contexts using Huffman coding.
--
count: false
<img align="left" width="500" src="images/graphs/deep_walk1.png"><img align="right" width="500" src="images/graphs/deep_walk2.png">
---
# Negative sampling
.center.width-50[![](images/graphs/skipgram.png)]
- introduce $B = \mathbf{1}((w,c)\in D)$ with the parameterization
$$
p(b=1|w,c,\theta) = \sigma(u\_w \cdot u\_c)=\frac{1}{1+e^{-u\_w \cdot u\_c}} .
$$
- instead of maximizing $\prod\_{(w,c)\in D} p(c\| w ; \theta)$, we now maximize $\prod\_{(w,c)\in D} p(b=1 |c, w ; \theta)$
---
count: false
# Negative sampling
- introduce $B = \mathbf{1}((w,c)\in D)$ with the parameterization
$$
p(b=1|w,c,\theta) = \sigma(u\_w \cdot u\_c)=\frac{1}{1+e^{-u\_w \cdot u\_c}} .
$$
- instead of maximizing $\prod\_{(w,c)\in D} p(c\| w ; \theta)$, we now maximize $\prod\_{(w,c)\in D} p(b=1 |c, w ; \theta)$
.red[Problem, this has a trivial solution! We only have positive examples!]
--
count: false
- create negative examples $D'$ and maximize in $\theta$:
$$
\sum\_{(w,c)\in D}\log \sigma(u\_w \cdot u\_c) + \sum_{(w,c)\in D'}\log \sigma(-u\_w \cdot u\_c)
$$
- in [Mikolov et al.](http://papers.nips.cc/paper/5021-distributed-representations-of-words-andphrases) $D'$ is $k$ times larger than $D$, and for each $(w,c)\in D$, we construct $k$ samples $(w,c\_1) ... (w,c\_k)$ where $c\_i$ is drawn according to its empirical distribution raised to the $3/4$ power.
---
# node2vec
- parameterization of the skip-gram model approximated thanks to negative sampling
- notion of context obtained thanks to biased random walk.
.center.width-50[![](images/graphs/node2vec_rw.png)]
---
# some results
.center.width-40[![](images/graphs/node2vec_miserables.png)]
---
# some results
In the multi-label classification setting, every node is assigned one or more labels from a finite set. During training phase, a certain fraction of nodes with all their labels is observed. The task is to predict the labels for the remaining nodes.
.center.width-50[![](images/graphs/node2vec_res.png)]
--
count: false
Guess from which paper these results are taken from?
.center.width-10[![](images/graphs/smiley.png)]
---
# (1) Node embedding
## Language model
### one fixed graph, no signal. Ex: community detection
# .gray[(2) Signal processing on graphs]
## .gray[Fourier analysis on graphs]
### .gray[one fixed graph, various signals. Ex: classification of signals]
# .gray[(3) Graph embedding]
## .gray[Graph Neural Networks]
### .gray[various graphs. Ex: classification of graphs]
---
class: end-slide, center
count: false
The end.
.bold[[www.dataflowr.com](https://www.dataflowr.com)]
</textarea>
<script src="./assets/remark-latest.min.js"></script>
<script src="./assets/auto-render.min.js"></script>
<script src="./assets/katex.min.js"></script>
<script type="text/javascript">
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// var options = {sourceUrl: getParameterByName("p"),
// highlightLanguage: "python",
// // highlightStyle: "tomorrow",
// // highlightStyle: "default",
// highlightStyle: "github",
// // highlightStyle: "googlecode",
// // highlightStyle: "zenburn",
// highlightSpans: true,
// highlightLines: true,
// ratio: "16:9"};
var options = {sourceUrl: getParameterByName("p"),
highlightLanguage: "python",
highlightStyle: "github",
highlightSpans: true,
highlightLines: true,
ratio: "16:9",
slideNumberFormat: (current, total) => `
<div class="progress-bar-container">${current}/${total} <br/><br/>
<div class="progress-bar" style="width: ${current/total*100}%"></div>
</div>
`};
var renderMath = function() {
renderMathInElement(document.body, {delimiters: [ // mind the order of delimiters(!?)
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false},
{left: "\\[", right: "\\]", display: true},
{left: "\\(", right: "\\)", display: false},
]});
}
var slideshow = remark.create(options, renderMath);
</script>
</body>
</html>