1 of 65

Learning Edge Representations via Low-Rank Asymmetric Projections

Sami Abu-El-Haija, Bryan Perozzi, Rami Al-Rfou

Prepared for ACM CIKM 2017, Singapore

1

2 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

2

3 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

3

4 of 65

Graph Embeddings -- What are they?

  • Given graph G=(V, E):

  • Embedding nodes == representing them in a continuous vector space:

4

v1

v2

v3

v5

v4

v6

v11

v9

  • Nodes are “close” in vector space, if they are “neighbors” in the graph.
  • Vector space should preserve structure of graph

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

5 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

5

6 of 65

Graph Embeddings -- Why are they needed?

  • Graphs contain discrete relationships (e.g. adjacency list)
  • Most Modern Machine Learning (ML) Methods accept continuous inputs
  • Graph Embeddings is a way to represent it in continuous domain, such that it can be plugged into ML methods, examples include:
    • Node Classification
    • Edge Classification
    • Link Prediction [this paper’s focus]

6

7 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

7

8 of 65

Graph Embedding -- How are they learned?

  • Pre-deep learning era includes Laplacian Eigenmaps [1]:

Where:

  • Y is embedding matrix (aka embedding dictionary)
  • A is adjacency matrix.

8

[1] Belkin & Niyogi. Laplacian eigenmaps and spectral techniques for embedding and clustering. NIPS 2001

9 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

9

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

10 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

10

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

v1

v2

v3

v5

v4

v6

v11

v9

11 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

11

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

Random Walk

v1

v2

v3

v5

v4

v6

v11

v9

12 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

12

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

Random Walk

v3 → v5 → v9 → v11 → v5 → ...

...

Random Walk Sequences

v1

v2

v3

v5

v4

v6

v11

v9

13 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

13

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

Random Walk

v3 → v5 → v9 → v11 → v5 → ...

...

Random Walk Sequences

word2vec algorithm

v1

v2

v3

v5

v4

v6

v11

v9

14 of 65

Graph Embedding -- How are they learned?

Deep learning era brought Deepwalk [2]: simulates random walks then uses word2vec-style [3] learning to learn embeddings.

14

[2] Perozzi et al. DeepWalk: Online Learning of Social Representations. KDD 2014

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

Random Walk

v3 → v5 → v9 → v11 → v5 → ...

...

Random Walk Sequences

word2vec algorithm

Embeddings Y

v1

v2

v3

v5

v4

v6

v11

v9

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

15 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

15

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

16 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

16

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

v3 → v5 → v9 → v11 → v5 → ...

Random Walk Sequences

Embeddings Y

.v1

.v11

.v6

.v2

.v3

.v4

.v5

x

y

.v9

17 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

17

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

v3 → v5 → v9 → v11 → v5 → ...

Random Walk Sequences

Embeddings Y

anchor

node

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

18 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

18

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

v3 → v5 → v9 → v11 → v5 → ...

Random Walk Sequences

Embeddings Y

anchor

node

context node

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

19 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

19

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

v3 → v5 → v9 → v11 → v5 → ...

Random Walk Sequences

Embeddings Y

anchor

node

context node

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

Stochastic Update

20 of 65

Graph Embedding -- How are they learned?

  • Word2vec [3] learns word embeddings by stochastically moving embedding of an anchor word closer to a neighboring context word.

E.g. increase

dot-product of embeddings

20

[3] Mikolov et al. Distributed Representations of Words and Phrases and their Compositionality. NIPS 2013

21 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

21

22 of 65

Weaknesses of existing methods

  • Edge function is symmetric, with dist(u, v) = dist(v, u)
    • This loses directed edge information
  • They require large embedding dictionaries to preserve the graph structure. Sometimes larger than the original graph.

22

23 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

23

24 of 65

Our Method: TLDR

We extend existing methods in several ways:

  • In addition to node embeddings, we learn an edge function, in the node embedding space.
  • Our edge function is asymmetric: dist(u, v) dist(v, u)
    • Better encodes directed graphs
  • We propose novel objective: Graph Likelihood.
  • Modelling an edge function, and training with our novel objective, we preserve the structure of the graph much better while using much smaller space.

24

25 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

25

26 of 65

Our Method: Model Architecture

26

v

Graph

u

27 of 65

Our Method: Model Architecture

27

v

Yv

Yu

u

Graph

Node

Embeddings

28 of 65

Our Method: Model Architecture

28

v

Yv

f

f(Yv)

Yu

f

f(Yu)

u

DNN

Node

Embeddings

Graph

29 of 65

Our Method: Model Architecture

29

v

Yv

f

f(Yv)

Yu

f

f(Yu)

u

DNN

Node

Embeddings

Graph

30 of 65

Our Method: Model Architecture

30

v

Yv

f

f(Yv)

T

R

Yu

f

f(Yu)

T

LT

u

DNN

Node

Embeddings

Graph

Low-Rank Asymmetric Projection

31 of 65

Our Method: Model Architecture

31

v

Yv

f

f(Yv)

T

R

Yu

f

f(Yu)

T

LT

u

DNN

Node

Embeddings

Low-Rank Asymmetric Projection

Dest

LTf(Yu)

Graph

Edge Representation

Source

Rf(Yv)

32 of 65

Our Method: Model Architecture

32

v

Yv

f

f(Yv)

T

R

Yu

f

f(Yu)

T

LT

σ(g(u, v))

u

DNN

Node

Embeddings

Low-Rank Asymmetric Projection

Source

Dest

LTf(Yu)

Rf(Yv)

Graph

Edge Likelihood

Edge Representation

33 of 65

Our Method: Model Architecture

33

v

Yv

f

f(Yv)

T

R

Yu

f

f(Yu)

T

LT

σ(g(u, v))

u

DNN

Node

Embeddings

Low-Rank Asymmetric Projection

Source

Dest

LTf(Yu)

Rf(Yv)

Graph

Edge Likelihood

Edge Representation

Left Embedding

(projection)

Right Embedding

(projection)

34 of 65

DeepWalk versus ours

DeepWalk [2]

Ours

34

35 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

35

36 of 65

Our Method: Graph Likelihood Derivation

  • Assume that Q is an edge estimator.
  • If Q is “perfect”, then likelihood below must equal to 1 when evaluated on E:

36

37 of 65

Our Method: Graph Likelihood Derivation

  • Assume that Q is an edge estimator.
  • If Q is “perfect”, then likelihood below must equal to 1 when evaluated on E:

  • Equation above can be written as:

37

38 of 65

Our Method: Graph Likelihood Derivation

38

39 of 65

Our Method: Graph Likelihood Derivation

39

Graph Likelihood

Non exclusive!

is frequence of u and v are co-visited in random walks

40 of 65

Our Method: Graph Likelihood Derivation

40

Graph Likelihood

41 of 65

Our Method: Graph Likelihood Derivation

41

Graph Likelihood

42 of 65

Our Method: Training

  • Our Graph Likelihood objective is quadratic:

  • Instead, we optimize a linear objective. We simulate random walks for positives, and we use noise estimation for negatives. We optimize:
  • We train using PercentDelta [7]

[7] Abu-El-Haija, Proportionate Gradient Updates with PercentDelta, 2017

42

where

43 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

43

44 of 65

Link Prediction Experiments

E

44

45 of 65

Link Prediction Experiments

E

Etrain+

Etest+

45

46 of 65

Link Prediction Experiments

E

Etrain+

Etrain-

Etest+

46

47 of 65

Link Prediction Experiments

E

Etrain+

Etrain-

Etest-

Etest+

|Etrain+| = |Etest+| = |Etrain-| = |Etest-|

47

48 of 65

Why Link Prediction?

  • We aim to produce structure-preserving embeddings.
  • Embeddings that preserve the graph structure, should be able to reconstruct the input graph, generalizing to unseen edges.
  • Application across many domains, including social and e-commerce.

48

49 of 65

Link Prediction Results

Sampled softmax

Graph Likelihood Objective

ca-AstroPh [5]

Protein-Protein Interaction [6]

49

dim

node2vec

Our Shallow

Our Deep Asym

8

81.1

92.3

91.7

32

89.9

95.5

95.5

128

95.5

95.3

95.7

8

73.3

74.6

80.4

32

69.1

77.9

83.3

128

69.8

79.5

84.1

[5] http://snap.stanford.edu/data

[6] Stark et al. BioGRID: A General Repository for Interaction Datasets. Nucleic Acids Research 2006.

50 of 65

Link Prediction Results

Datasets from [5, 6]

50

[5] http://snap.stanford.edu/data

[6] Stark et al. BioGRID: A General Repository for Interaction Datasets. Nucleic Acids Research 2006.

51 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

51

52 of 65

Our Method: Visualization of Learned Embeddings

Embedding Protein-Protein Interaction graph dataset [6] using asymmetric projection of 2 dimensions.

Right Projection

Left Projection

52

53 of 65

Our Method: Visualization of Learned Embeddings

Right & Left Projections

53

54 of 65

Our Method: Visualization of Learned Embeddings

Pick node and show is edges

54

55 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

55

56 of 65

Our Method: Implementation

# Create train/test positive/negatives and simulate random walks:

$ python create_dataset_arrays.py --input ~/data/mygraph.txt \

--output ~/data/mygraph_arrays

# Train node embeddings and edge representation

$ python deep_edge_trainer.py --dataset_dir ~/data/mygraph_arrays

56

57 of 65

Outline

  • Background: Graph Embeddings
    • What are they?
    • Why are they needed?
    • How are they learned?
    • Weaknesses of existing methods
  • Our Method
    • Model Architecture
    • Objective Function & Training
    • Linked Prediction Experiments
    • Visualization of Learned Embeddings
    • Implementation
  • Conclusion

57

58 of 65

Conclusion

  • We train node embeddings jointly with an edge function.
  • Our edge function is a (deep) asymmetric projection in the node embedding space.
  • We train using our novel objective (Graph Likelihood).
  • Training with an edge function and using our objective show relative error reductions of up to 63% (directed) and 15% (undirected), while using 16x smaller representations.
  • Our code and data-splits will be available on github, accessible thru sami.haija.org/graph/deep_embedding.html

58

59 of 65

Thank you!

Any Questions?

59

60 of 65

Backup Slides

60

61 of 65

Link Prediction Results

Note: We ran node2vec using their default context window size (C=10).

Datasets from [5, 6]

61

[5] http://snap.stanford.edu/data

[6] Stark et al. BioGRID: A General Repository for Interaction Datasets. Nucleic Acids Research 2006.

62 of 65

Model Discussion: Can we skip f() ?

?

?

Skipping f() will hurt the generalization performance of the model, since:

  1. Overfitting without f()
  2. f() is a regularizer.

Tables on next slide!

62

63 of 65

Model Discussion: Can we skip f() ?

Shallow = without f()

Deep = with f()

63

64 of 65

Visualization: soc-facebook [5] dataset (spherical constraints)

64

65 of 65

65

.v1

.v11

.v6

.v2

.v3

.v4

.v5

.v9

x

y

v1

v2

v3

v5

v4

v6

v11

v9