Uncertainty and Robustness
- f Graph Embeddings
Aleksandar Bojchevski Technical University of Munich, Germany Graph Embedding Day 2018 - Lyon
of Graph Embeddings Aleksandar Bojchevski Technical University of - - PowerPoint PPT Presentation
Uncertainty and Robustness of Graph Embeddings Aleksandar Bojchevski Technical University of Munich, Germany Graph Embedding Day 2018 - Lyon Neglected aspects of graph embeddings Capturing uncertainty Robustness to noise Robustness to
Aleksandar Bojchevski Technical University of Munich, Germany Graph Embedding Day 2018 - Lyon
Uncertainty and Robustness of Graph Embeddings - Bojchevski 2
Uncertainty and Robustness of Graph Embeddings - Bojchevski 3
Uncertainty and Robustness of Graph Embeddings - Bojchevski 4
Uncertainty and Robustness of Graph Embeddings - Bojchevski 5
Uncertainty and Robustness of Graph Embeddings - Bojchevski 6 ๐ = 1 ๐ = 2
๐ช( ๐๐, ฮฃ๐) ๐ฆ๐
๐(๐ฆ๐)
deep encoder
Embed nodes as (Gaussian) distributions Sources of uncertainty:
Uncertainty and Robustness of Graph Embeddings - Bojchevski 7
For each node ๐: nodes in its (๐)-hop neighborhood should be closer to ๐ compared to nodes in its (๐ + 1)-hop neighborhood
Uncertainty and Robustness of Graph Embeddings - Bojchevski 8
๐ = 1 ๐ = 2
For each node ๐: nodes in its (๐)-hop neighborhood should be closer to ๐ compared to nodes in its (๐ + 1)-hop neighborhood
Uncertainty and Robustness of Graph Embeddings - Bojchevski 9
๐ = 1 ๐ = 2
For each node ๐: nodes in its (๐)-hop neighborhood should be closer to ๐ compared to nodes in its (๐ + 1)-hop neighborhood Example: closer in terms of the KL Diveregence KL is asymmetric โ handles directed graphs
Uncertainty and Robustness of Graph Embeddings - Bojchevski 10
๐ = 1 ๐ = 2
Personalized ranking implies pairwise constraints for node ๐ D๐ฟ๐(๐ช
๐||๐ช ๐) < D๐ฟ๐ (๐ช๐โฒ||๐ช ๐)
โ๐ โ ๐๐
(๐), โ๐โฒ โ ๐๐ (๐โฒ), โ๐ < ๐โฒ
Uncertainty and Robustness of Graph Embeddings - Bojchevski 11
๐ = 1 ๐ = 2 set of nodes in the ๐-hop neighborhood of node ๐
Generalize to unseen nodes by learning a mapping from features to embeddings
Uncertainty and Robustness of Graph Embeddings - Bojchevski 12
Uncertainty and Robustness of Graph Embeddings - Bojchevski 13 ๐ = 1 ๐ = 2
๐ช( ๐๐, ฮฃ๐) ๐ฆ๐
๐(๐ฆ๐)
deep encoder
๐| ๐ช ๐
2 + expโ๐น๐๐โฒ)
Closer nodes should have lower energy Naively: ๐(๐3) complexity Node-anchored sampling strategy:
Uncertainty and Robustness of Graph Embeddings - Bojchevski 14
15 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Uncertainty correlates with diversity Diversity: number of distinct classes in a nodeโs k-hop neighborhood
Uncertainty and Robustness of Graph Embeddings - Bojchevski 16
Uncertainty reveals the intrinsic latent dimensionality of the graph Detected latent dimensions โ number ground-truth communities
Uncertainty and Robustness of Graph Embeddings - Bojchevski 17
Prune dimensions with high uncertainty Maintaining link prediction performance
Uncertainty and Robustness of Graph Embeddings - Bojchevski 18
Uncertainty and Robustness of Graph Embeddings - Bojchevski 19
Uncertainty and Robustness of Graph Embeddings - Bojchevski 20
Uncertainty and Robustness of Graph Embeddings - Bojchevski 21
https://www.semanticscholar.org
Graph clustering
22
Similarity Graph Spectral Embedding
๐ = 9 ๐ธ = 5
1 2 3 4
2 4
1 2 3 4
2 4 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Partition V into two sets ๐ท1 and ๐ท2, such that the sum of the inter-cluster edge weights cut ๐ท1, ๐ท2 = ฯ๐ค1โ๐ท1,๐ค2โ๐ท2 ๐ฅ(๐ค1, ๐ค2) is minimized Drawbacks:
Uncertainty and Robustness of Graph Embeddings - Bojchevski 23
1 2 5
2 4 2 4 4 2 2 3
1
Ratio Cut: Minimize
๐๐ฃ๐ข(๐ท1,๐ท2) |๐ท1|
+
๐๐ฃ๐ข(๐ท2,๐ท1) |๐ท2|
Normalized Cut: Minimize
๐๐ฃ๐ข(๐ท1,๐ท2) vol(๐ท1) + ๐๐ฃ๐ข(๐ท1,๐ท2) vol(๐ท2)
Uncertainty and Robustness of Graph Embeddings - Bojchevski 24
1 2 5
3 4
2 4 2 4 4 2 2 3
1
1 2 5
3 4
2 4 2 4 4 2 2 3
1
Generalization to ๐ โฅ 2 clusters Partition V into disjoint clusters ๐ท1, โฆ , ๐ท๐ such that
C1,โฆ,Ck
ฯ๐=1
๐
๐๐ฃ๐ข(๐ทi, V\๐ทi)
C1,โฆ,Ck
ฯ๐=1
๐ ๐๐ฃ๐ข(๐ทi,V\๐ทi) |๐ทi|
C1,โฆ,Ck
ฯ๐=1
๐ ๐๐ฃ๐ข(๐ทi,V\๐ทi) vol(๐ท๐)
Finding the optimal solution is NP-hard How to compute an approximate solution efficiently?
Uncertainty and Robustness of Graph Embeddings - Bojchevski 25
1 2 5
3 4
2 4 2 4 4 2 2 3
1
Minimum Cut for ๐ = 3
1 2 โ ฯ ๐ฃ,๐ค โ ๐น ๐ ๐ฃ๐ค ๐ ๐ฃ โ ๐ ๐ค 2
2๐๐ธโ1 2 = ๐ฝ โ ๐ธโ1 2๐ต๐ธโ1 2
26 Uncertainty and Robustness of Graph Embeddings - Bojchevski
๐ = the heat at node ๐ค๐
๐โ๐ ๐) if ๐, ๐ โ ๐น
27
https://en.wikipedia.org/wiki/Laplacian_matrix#/media/ File:Graph_Laplacian_Diffusion_Example.gif
Uncertainty and Robustness of Graph Embeddings - Bojchevski
28 Uncertainty and Robustness of Graph Embeddings - Bojchevski
29 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Define indicator vector: : โ๐ท๐ ๐ = แ
1 |C๐|
๐๐ ๐ค๐ โ ๐ท๐ ๐๐๐ก๐ Let H = [โ๐ท1; โ๐ท2; โฆ ; โ๐ท๐] Observations: ๐ผ๐๐ผ = ๐ฝ๐ is orthonormal โ๐ท๐
๐ โ ๐ โ โ๐๐ = ๐๐ฃ๐ข ๐ท๐,๐\๐ท๐ ๐ท๐
and โ๐ท๐
๐ โ ๐ โ โ๐๐ = (๐ผ๐๐๐ผ)๐๐
๐๐๐ข๐๐๐ท๐ฃ๐ข(๐ท1, โฆ , ๐ท๐) = ฯ๐=1
๐ ๐๐ฃ๐ข ๐ท๐,๐\๐ท๐ ๐ท๐
= ฯ๐=1
๐ (๐ผ๐๐๐ผ)๐๐ = ๐ข๐ ๐๐๐(๐ผ๐๐๐ผ)
NetGAN: Generating Graphs via Random Walks - Bojchevski, Shchur, Zรผgner, Gรผnnemann. 30
1 2 5
3 4
2 4 2 4 4 2 2 3
1
Minimizing ratio-cut (normalized cut with ๐๐ก๐ง๐) is equivalent to min
๐ท1,โฆ,๐ท๐ ๐ข๐ ๐๐๐(๐ผ๐๐๐ผ) subject to ๐ผ๐๐ผ = ๐ฝ๐
Constraint relaxation: allow arbitrary values for H min
๐ผโ๐๐ร๐ฟ ๐ข๐ ๐๐๐(๐ผ๐๐๐ผ) subject to ๐ผ๐๐ผ = ๐ฝ๐
Standard trace minimization problem Optimal ๐ผ = First ๐ฟ smallest eigenvectors of ๐
31 Uncertainty and Robustness of Graph Embeddings - Bojchevski
๐๐ ๐ฅ = ๐ธโ1๐ = ๐ฝ โ ๐ธโ1๐ต = ๐ฝ โ ๐ is the the random walk Laplacian
eigenvector ๐ฅ = ๐ธ1/2๐ฃ
Let ๐ ๐ถ ๐ต = ๐ ๐1 โ ๐ถ ๐0 โ ๐ต be the probability of a random walker currently at any node in ๐ต to transition to any node in ๐ถ, for ๐ต โฉ ๐ถ = โ and A, ๐ถ โ ๐. Sample ๐0 โผ ๐ from the stationary distribution ๐๐๐ฃ๐ข(๐ต, าง ๐ต) = ๐( าง ๐ต|๐ต) + ๐(๐ต| าง ๐ต)
Uncertainty and Robustness of Graph Embeddings - Bojchevski 32
Finding the spectral embedding = Solving an optimization task ๐ผโ = k-first eigenvectors of ๐(๐ต)
33
๐ผโ = arg min
๐ผโโ๐ร๐ ๐๐ ๐๐๐ ๐ผ๐ โ ๐(๐ต) โ ๐ผ
subject to ๐ผ๐ โ ๐ธ๐ต โ ๐ผ = ๐ฝ๐ ๐(๐ต) = ๐ธ(๐ต) โ ๐ต Input Graph ๐ต Graph Laplacian ๐(๐ต) Trace minimization Ratio/Normalized Cut Output Embedding ๐ผโ
Uncertainty and Robustness of Graph Embeddings - Bojchevski
Noisy
34
Noisy
Uncertainty and Robustness of Graph Embeddings - Bojchevski
Jointly learn decomposition & embedding Decomposition steered by the underlying embedding / clustering
35
๐ต = ๐ต๐ + ๐ต๐ ๐ต๐ ๐ต๐ good graph sparse corruptions
๐ผโ = arg min
๐ผโโ๐ร๐ ๐๐ ๐๐๐ ๐ผ๐ โ ๐(๐ต๐) โ ๐ผ
subject to ๐ผ๐ โ ๐ธ(๐ต๐) โ ๐ผ = ๐ฝ๐ ๐ตโ, ๐ผโ = arg min
๐ผโโ๐ร๐ ๐ต๐โ โโฅ0 ๐ร๐
๐๐ ๐๐๐ ๐ผ๐ โ ๐(๐ต๐) โ ๐ผ subject to ๐ผ๐ โ ๐ธ(๐ต๐) โ ๐ผ = ๐ฝ๐ ๐ต = ๐ต๐ + ๐ต๐ ๐ต๐
0 โค 2๐
โ๐: ๐๐
๐ 0 โค ๐๐
global local
Uncertainty and Robustness of Graph Embeddings - Bojchevski
Update ๐ผ, Given ๐ต๐/๐ต๐ โ ๐น๐๐ก๐ง
36
update ๐ต๐ update ๐ผ ๐ตโ, ๐ผโ = arg min
๐ผโโ๐ร๐ ๐ต๐โ โโฅ0 ๐ร๐
๐๐ ๐๐๐ ๐ผ๐ โ ๐(๐ต๐) โ ๐ผ
Uncertainty and Robustness of Graph Embeddings - Bojchevski
Update ๐ต๐/๐ต๐, Given ๐ผ โ ๐๐ ๐ผ๐๐ ๐
๐
in closed form
๐
that minimizes the trace equivalent to maximizing ๐
Robust Spectral Clustering 37 Aleksandar Bojchevski
๐ ๐๐ฃ๐ค
๐ ๐ฃ,๐คโ๐น
= เท
๐ฃ,๐คโ๐น
๐๐ฃ๐ค
๐
๐๐ฃ โ ๐๐ค 2
2 ๐๐๐๐๐ก ๐๐๐ ๐๐ฅ๐๐ง ๐๐ ๐ขโ๐ ๐๐๐๐๐๐๐๐๐ ๐ก๐๐๐๐
โ ๐ โ ๐๐ฃ 2 โ ๐ โ ๐๐ค 2
๐๐ ๐๐๐๐ ๐ก ๐๐๐๐๐ก ๐๐๐๐ก๐ ๐ข๐ ๐ขโ๐ ๐๐ ๐๐๐๐
subject to โ o constraints
๐ตโ, ๐ผโ = arg min
๐ผโโ๐ร๐ ๐ต๐โ โโฅ0 ๐ร๐
๐๐ ๐๐๐ ๐ผ๐ โ ๐(๐ต๐) โ ๐ผ
Equivalent to Multidimensional Knapsack problem
1 ๐+1
Efficient solution in O(#edges)
38 Uncertainty and Robustness of Graph Embeddings - Bojchevski
39
๐๐ ๐๐๐๐๐๐ ๐๐ ๐๐โ
๐๐๐๐ ๐๐ ๐๐โ
๐ก๐๐๐ ๐ก๐ ๐๐๐ ๐ ๐ฃ๐๐ข๐๐๐๐ก
40 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Uncertainty and Robustness of Graph Embeddings - Bojchevski 41
(Spectral) Embeddings are not robust to noise / but we can remedy that
In domains where graph embeddings are used (e.g. the Web) adversaries are common and false data is easy to inject
Uncertainty and Robustness of Graph Embeddings - Bojchevski 42
Image of a tabby cat correctly classified
43
Training data Training Model 88% tabby cat
Uncertainty and Robustness of Graph Embeddings - Bojchevski
Perturbation
Image of a tabby cat correctly classified Add imperceptible perturbation Model classifies the cat as guacamole
44
Training data Training Model 99% guacamole
Perturbed image
Uncertainty and Robustness of Graph Embeddings - Bojchevski
45 Uncertainty and Robustness of Graph Embeddings - Bojchevski
a set of node pairs ๐ฐ โ ๐ ร ๐
46 Uncertainty and Robustness of Graph Embeddings - Bojchevski
เท ๐ตโ 0,1 ๐ร๐ โ( แ
๐ โ( แ
Uncertainty and Robustness of Graph Embeddings - Bojchevski 47
Adjacency matrix of the graph after the attacker modified some entries Optimal embedding from the to be optimized graph แ ๐ต The attackerโs budget
เท ๐ตโ 0,1 ๐ร๐ โ( แ
๐ โ( แ
Uncertainty and Robustness of Graph Embeddings - Bojchevski 48
Adjacency matrix of the graph after the attacker modified some entries Optimal embedding from the to be optimized graph แ ๐ต The attackerโs budget General attack
เท ๐ตโ 0,1 ๐ร๐ โ๐๐ข๐๐( แ
๐ โ( แ
Uncertainty and Robustness of Graph Embeddings - Bojchevski 49
Adjacency matrix of the graph after the attacker modified some entries Optimal embedding from the to be optimized graph แ ๐ต The attackerโs budget Targeted attack
Discrete and Combinatorial Bi-level optimization problem Transductive learning โ network poisoning setting
Uncertainty and Robustness of Graph Embeddings - Bojchevski 50
frozen model target train
Evasion
train train target model embedding
Poisoning
RW-based embeddings solve: ๐โ = min
๐ โ( ๐ 1, ๐ 2, โฆ , ๐) with ๐ ๐ = ๐๐ ๐(๐ต)
๐โ โ โ๐ร๐ฟ: learned embedding ๐๐
๐: e stochastic procedure that generates RWs of length ๐
โ: model-specific loss e.g. skip-gram with negative sampling (SGSN) Challenge: RW sampling precludes gradient based optimization
Uncertainty and Robustness of Graph Embeddings - Bojchevski 51
DeepWalk is equivalent* to factorizing เทฉ ๐ = log max ๐, 1 ๐ =
๐ค๐๐ ๐ต ๐โ ๐ ๐
๐ = ฯ๐ =1
๐
๐๐ ๐ธโ1 ๐ = ๐ธโ1๐ต with ๐โ obtained by the SVD of เทฉ ๐ = ๐ฮฃ๐๐ using the top K largest singular values/vectors i.e. ๐โ = ๐๐ฟฮฃ๐ฟ
1/2
Uncertainty and Robustness of Graph Embeddings - Bojchevski 52
transition matrix window size ๐ ๐ negative samples Shifted Positive Pointwise Mutual Information (PPMI) Matrix
Equivalent to min
เทฉ ๐๐ฟ
|| เทฉ ๐ โ เทฉ ๐๐ฟ||๐บ
2
The loss using the optimal embedding is โ๐ธ๐
1 ๐ต, ๐โ =
ฯ๐=๐ฟ+1
|๐|
๐๐
2, where
๐1 โฅ ๐2 โฅ โฏ โฅ ๐|๐| are the singular values of เทฉ ๐(๐ต) ordered decreasingly Idea: Given a perturbation ฮ๐ต, find the change in the singular values of เทฉ ๐(๐ต + ฮ๐ต)
Uncertainty and Robustness of Graph Embeddings - Bojchevski 53
เทฉ ๐ = log max ๐, 1 ๐ =
๐ค๐๐ ๐ต ๐โ ๐ ๐
๐ = ฯ๐ =1
๐
๐๐ ๐ธโ1 Linearization: ignore the log(โ ) and max(โ , 1) Scalars ๐ค๐๐ ๐ต , ๐, ๐ can be also ignore Rewrite โ๐ธ๐
1 ๐ต, ๐โ =
ฯ๐=๐ฟ+1
|๐|
|๐๐|2 Thus, find a change in the spectrum of ๐ after the attacker perturbed the graph ฮ๐ต
Uncertainty and Robustness of Graph Embeddings - Bojchevski 54
Compute the generalized spectrum (generalized eigenvalues/vectors) of ๐ต i.e. compute and ๐, ฮ that solve ๐ต๐ฃ = ๐๐ธ๐ฃ Rewrite ๐ = ฯ๐ =1
๐
๐๐ ๐ธโ1 as ๐ = ๐ (ฯ๐ =1
๐
ฮ๐ )๐๐ The task is now to find the change in generalized eigenvalues ๐๐ of the adjacency matrix ๐ต given a perturbation ฮ๐ต
Uncertainty and Robustness of Graph Embeddings - Bojchevski 55
simple function of the generalized eigenvalues ๐๐ of the graph
Given ๐, ฮ that solve ๐ต๐ฃ = ๐๐ธ๐ฃโฒ and a small perturbation ฮ๐ต, ฮ๐ธ Find ๐โฒ, ฮโฒ that solve ๐ต + ฮ๐ต ๐ฃโฒ = ๐โฒ(๐ธ + ฮ๐ธ)๐ฃโฒ First order approximation: ๐โฒ๐ = ๐๐ + ๐ฃ๐
๐ ฮ๐ต + ๐๐ฮ๐ธ ๐ฃ๐
for small ฮ๐ต and ฮD higher order terms become negligible
Uncertainty and Robustness of Graph Embeddings - Bojchevski 56
ฮ๐ต is a matrix with only 2 non-zero elements for a single edge flip (๐, ๐) namely ฮ๐ต๐๐ = ฮ๐ต๐๐ = 1 โ 2A๐๐ โ ฮw๐๐ Similarly, ฮD has only two non-zero elements on the diagonal Then we can approximate the generalized eigenvalues of A + ฮ๐ต in closed-form computable in O(1) time:
2 + ๐ฃ๐๐ 2 )
Uncertainty and Robustness of Graph Embeddings - Bojchevski 57
๐ = log max
๐ค๐๐ ๐ต ๐โ ๐ ๐, 1
Uncertainty and Robustness of Graph Embeddings - Bojchevski 58
However, แ ๐ตโ = arg max
เท ๐ตโ 0,1 ๐ร๐ โ๐๐๐๐ก๐๐โ๐๐๐ ๐
๐ก๐ฃ๐๐. ๐ข๐ แ ๐ต โ ๐ต 0 = 2๐ is still hard to optimize โ ๐2 ๐ ways to choose the flips Greedy solution:
59 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Uncertainty and Robustness of Graph Embeddings - Bojchevski 60
To target node ๐ค we need the change in its embedding ๐๐ค
โ
That is we need the change in eigenvectors Apply eigenvalue perturbation again to approximate the top ๐ฟ eigenvectors For a given edge flip (๐, ๐) we get: ๐ฃ๐
โฒ = ๐ฃ๐ โ ฮw๐๐ ๐ต โ ๐๐ธ +
โฮ๐๐๐ฃ๐ โ ๐ + ๐น๐ ๐ฃ๐๐ โ ๐๐๐ฃ๐๐ + ๐น
๐ ๐ฃ๐๐ โ ๐๐๐ฃ๐๐
Uncertainty and Robustness of Graph Embeddings - Bojchevski 61
Uncertainty and Robustness of Graph Embeddings - Bojchevski 62
Uncertainty and Robustness of Graph Embeddings - Bojchevski 63
Uncertainty and Robustness of Graph Embeddings - Bojchevski 64
DW (SVD) DW (SGNS) n2v
GCN ๐ = 250 (0.8%)
๐ = 500 (1.6%)
๐ = 250 (1.7%)
๐ = 500 (3.4%)
Uncertainty and Robustness of Graph Embeddings - Bojchevski 65
Node embeddings are vulnerable to adversarial attacks Poisoning has negative effect on the embeddings quality and the downstream tasks Attacks are transferable โ they generalize to many models
66 Uncertainty and Robustness of Graph Embeddings - Bojchevski
Uncertainty and Robustness of Graph Embeddings - Bojchevski 67