# Learning Similarity Measures Based on Random Walks in

• Slides: 56

Learning Similarity Measures Based on Random Walks in Graphs William W. Cohen Machine Learning Department and Language Technologies Institute School of Computer Science Carnegie Mellon University joint work with: Ni Lao, CMU Google Tom Mitchell, CMU Einat Minkov, Univ Haifa Amarnag Subramanya, Fernando Pereira, Google

Motivation: The simple and the complex • In computer science there is a tension between – The elegant, simple and general – The messy, complex and problem-specific • Graphs are: – Simple: so they are easy to analyze and store – General: so • They appear in many contexts • They are often a natural representation of important aspects of information – Well-understood

Motivation: The simple and the complex • The real world is complex… • … learning is a way to incorporate that complexity in our models without sacrificing elegance and generality

Motivation: The simple and the complex • This talk: Learning Similarity Measures Based on Random Walks in Graphs – Many fundamental tasks in computer science map an input to an output – … i. e. , the task can be modeled as a relation between input and output – …and further the relation can often be viewed as a similarity relation: the desired outputs are similar to the input (query) – we want to learn this relationship • even if (especially if) it is complex • even if it is described by a multi-step process – Here: one line of work on learning complex relationships

Motivation: The simple and the complex • This talk: – One line of work on learning complex relationships – Not covered here: • Minkov et al 2006, 2008, 2011: Similar framework for personalized information management queries and NLP relationships (e. g. , synonyms) using generative and reranking-based learning strategies • Backstrom and Leskovec, 2011: Alternative, very expressive parameterization of learning complex similarity metrics in graphs with feature vectors on the edges.

Similarity Queries on Graphs 1) Given type t* and node x in G, find y: T(y)=t* and y~x. 2) Given type t* and node set X, find y: T(y)=t* and y~X. • Nearest-neighbor classification: – G contains feature nodes and instance nodes – A link (x, f) means feature f is true for instance x – x* is a query instance, y~x* means y likely of same class as x* • Information retrieval: – G contains word nodes and document nodes – A link (w, d) means word w is in document d – X is a set of keywords, y~X means y likely to be relevant to X • Database retrieval: – G encodes a database – …?

BANKS: Browsing and Keyword Search [Aditya et al, VLDB 2002] • Database is modeled as a graph – Nodes = tuples – Edges = references between tuples • edges are directed and indicate foreign key, inclusion dependencies, . . Multi. Query Optimization writes author S. Sudarshan paper writes Prasan Roy author

Query: {“sudarshan”, “roy”} Answer: subtree from graph Multi. Query Optimization writes author S. Sudarshan paper writes Prasan Roy author

y: paper(y) & ~“sudarshan” AND w: paper(y) & w~“roy” Query: “sudarshan”, “roy” Answer: subtree from graph

Similarity Queries on Graphs 1) Given type t* and node x in G, find y: T(y)=t* and y~x. 2) Given type t* and node set X, find y: T(y)=t* and y~X. • • Nearest-neighbor classification Core tasks in CS Information retrieval Database retrieval Evaluation: specific families of tasks for scientific publications: – Citation recommendation for a paper: (given title, year, …, of paper p, what papers should be cited by p? ) – Expert-finding: (given keywords, genes, … suggest a possible author) – “Entity recommendation”: (given title, author, year, … predict entities mentioned in a paper, e. g. gene-protein entities) – can improve NER – Literature recommendation: given researcher and year, suggest papers to read that year • Evaluation: Inference in a DB of automatically-extracted facts

Similarity Queries on Graphs For each task: query 1, ans 1 query 2, ans 2 …. LEARNER may use PPR Sim(s, p) = mapping from query ans variant of PPR • Evaluation: specific families of tasks for scientific publications: – Citation recommendation for a paper: (given title, year, …, of paper p, what papers should be cited by p? ) – Expert-finding: (given keywords, genes, … suggest a possible author) – “Entity recommendation”: (given title, author, year, … predict entities mentioned in a paper, e. g. gene-protein entities) – Literature recommendation: given researcher and year, suggest papers to read that year • Evaluation: Inference in a DB of automatically-extracted facts

Outline • • Motivation for Learning Similarity in Graphs A Baseline Similarity Metric Some Literature-related Tasks The Path Ranking Algorithm (Learning Method) – Motivation – Details • Results: Bio. Literature tasks • Results: KB Inference tasks

Defining Similarity on Graphs: PPR/RWR [Personalized Page. Rank 1999] Given type t* and node x, find y: T(y)=t* and y~x. • Similarity defined by “damped” version of Page. Rank • Similarity between nodes x and y: – “Random surfer model”: from a node z, • with probability α, teleport back to x (“reset”) • Else pick a y uniformly from { y’ : z y’ } • repeat from node y. . – Similarity x~y = Pr( surfer is at y | restart is always to x ) • Intuitively, x~y is sum of weight of all paths from x to y, where weight of path decreases exponentially with length (and fanout) • Can easily extend to a “query” set X={x 1, …, xk} • Disadvantages: …?

Some Bio. Literature Retrieval Tasks • Data used in this study – Yeast: 0. 2 M nodes, 5. 5 M links – Fly: 0. 8 M nodes, 3. 5 M links – E. g. the fly graph

Learning Proximity Measures for Bio. Literature Retrieval Tasks • Tasks: – Gene recommendation: – Reference recommendation: – Expert-finding: – Literature-recommendation: author, year gene words, year paper words, genes author, [papers read in past] • Baseline method: – Typed RWR proximity methods • Baseline learning method: – parameterize Prob(walk edge|edge label=L) and tune the parameters for each label L (somehow…) P(L=cite) = a P(write)=b P(bind. To) = d P(NE) = c P(express) = d

Path-based vs Edge-label based learning • RWR is a very robust and useful similarity metric • Learning one-parameter-per-edge label is very limited • In many cases, there aren’t enough parameters to express a complex relationship

Definitions • An graph G=(T, R, X, E), is – a set of entity types T={T} and a set of relations R={R} – a set of entities (nodes) X={x}, where each node x has a type from T – a set of edges e=(x, y), where each edge has a relation label from R • A path P=(R 1, …, Rn) is a sequence of relations • Path Constrained Random Walk – Given a query set S of “source” nodes – Distribution D 0 at time 0 is uniform over s in S – Distribution Dt at time t>0 is formed by • Pick x from Dt-1 • Pick y uniformly from all things related to x – by an edge labeled Rt – Notation: f. P(s, t) = Prob(s t; P) – In our examples type of t will be determined by Rn 21

x –[Athlete. Plays. For. Team] y –[Team. Plays. In. League] z

Path Ranking Algorithm (PRA) [Lao & Cohen, ECML 2010] • A PRA model scores a source-target node pair by a linear function of their path features where P is the set of all relation paths with length ≤ L (with support on data, in some cases – see [Lao and Cohen EMNLP 2011]) • For a relation R and a set of node pairs {(si, ti)}, we construct a training dataset D ={(xi, yi)}, where xi is a vector of all the path features for (si, ti), and yi indicates whether R(si, ti) is true or not • θ is estimated using L 1, L 2 -regularized logistic regression • We’ve gone from a small parameter space to a huge one

Parameter Estimation (Details) • Given a set of training data – D={(q(m), A(m), y(m))} m=1…M, y(m)(e)=1/0 • We can define a regularized objective function • Use average log-likelihood as the objective om(θ) – P(m) the index set or relevant entities, – N(m) the index set of irrelevant entities (how to choose them will be discussed later) 25

Parameter Estimation (Details) • Selecting the negative entity set Nm – Few positive entities vs. thousands (or millions) of negative entities? – First sort all the negative entities with an uniform-weight RWR model – Then take negative entities at the k(k+1)/2 -th position, for k=1, 2, …. • The gradient is simple • Use orthant-wise L-BFGS (Andrew & Gao, 2007) to estimate θ – Efficient, Can deal with L 1 regularization

L 2 Regularization • Improves retrieval quality – On the citation recommendation task

L 1 Regularization • Does not improve retrieval quality…

L 1 Regularization • … but can help reduce number of features

Another potential “regularization: approximate RWR

Experiment Setup for Bio. Literature • Data sources for bio-informatics – – • Tasks – – • Pub. Med on-line archive of over 18 million biological abstracts Pub. Med Central (PMC) full-text copies of over 1 million of these papers Saccharomyces Genome Database (SGD) a database for yeast Flymine a database for fruit flies Gene recommendation: Venue recommendation: Citation recommendation: Expert-finding: author, year genes, title words journal title words, year paper title words, genes author Data split – 2000 training, 2000 tuning, 2000 test • Time variant graph – each edge is tagged with a time stamp (year) – only consider edges that are earlier than the query, during random walk 31

Bio. Literature: Some Results • Compare the mean average precision (MAP) of PRA to – RWR model – RWR trained with one-parameter per link Except these† , all improvements are statistically signiﬁcant at p<0. 05 using paired t-test

Example Path Features and their Weights • A PRA+qip+pop model trained for the citation recommendation task on the yeast data 1) papers co-cited with on-topic papers 6) approx. standard IR retrieval 7, 8) papers cited during the past two years 9) well cited papers 10, 11) key early papers about specific genes 12, 13) papers published during the past two years 14) old papers

Extension 1: Query Independent Paths • Page. Rank (and other query-independent rankings): – assign an importance score (query independent) to each web page – later combined with relevance score (query dependent) • We generalize pagerank to heterogeneous graphs: – We include to each query a special entity e 0 of special type T 0 – T 0 is related to all other entity types, and each type is related to all instances of that type – This defines a set of Page. Rank-like query independent relation paths – Compute f(* t; P) offline for efficiency • Example all papers well cited papers productive authors all authors 34

Extension 2: Entity-specific rankings • There are entity-specific characteristics which cannot be captured by a general model – Some items are interesting to the users because of features not captured in the data – To model this, assume the identity of the entity matters – Introduce new features f(s t; Ps, t) to account for jumping from s to t and new features f(* t; P*, t) – At each gradient step, add a few new features of this sort with highest gradient, count on regularization to avoid overfitting

Bio. Literature: Some Results • Compare the MAP of PRA to – RWR model – query independent paths (qip) – popular entity biases (pop) Except these† , all improvements are statistically signiﬁcant at p<0. 05 using paired t-test

Example Path Features and their Weights • A PRA+qip+pop model trained for the citation recommendation task on the yeast data 1) papers co-cited with on-topic papers 6) approx. standard IR retrieval 7, 8) papers cited during the past two years 9) well cited papers 10, 11) key early papers about specific genes 12, 13) papers published during the past two years 14) old papers

Outline • Random Walk With Reset/Personalized Page. Rank – What is it? • Similarity Queries • Learning How to “Tune” Similarity Functions for An Application/Subdomains • Applications and Results – Bio. Literature – Knowledge Base Inference

Outline • • Motivation for Learning Similarity in Graphs A Baseline Similarity Metric Some Literature-related Tasks The Path Ranking Algorithm (Learning Method) – Motivation – Details • Results: Bio. Literature tasks • Results: KB Inference tasks [Lao, Mitchell, Cohen, EMNLP 2011]

Large Scale Knowledge-Bases • Large-Scale Collections of Automatically Extracted Knowledge – Know. It. All (Univ. Washington) • 0. 5 B facts extracted from 0. 1 B web pages – DBpedia (Univ. Leipzig) • 3. 5 M entities 0. 7 B facts extracted from wikipedia – YAGO (Max-Planck-Institute) • 2 M entities 20 M facts extracted from Wikipedia and word. Net – Free. Base • 20 M entities 0. 3 B links, integrated from different data sources and human judgments – NELL (Never-Ending Language Learning, CMU) • 0. 85 M facts extracted from 0. 5 B webpages

Inference in Noisy Knowledge Bases • Challenges – Robustness: extracted knowledge is incomplete and noisy – Scalability: the size of knowledge base is large

The NELL Case Study • Never-Ending Language Learning: “a never-ending learning system that operates 24 hours per day, for years, to continuously improve its ability to read (extract structured facts from) the web” (Carlson et al. , 2010) • Closed domain, semi-supervised extraction • Combines multiple strategies: morphological patterns, textual context, html patterns, logical inference • Example beliefs

A Link Prediction Task • We consider 48 relations for which NELL database has more than 100 instances • We create two link prediction tasks for each relation – Athlete. Plays. In. League(Hines. Ward, ? ) – Athlete. Plays. In. League(? , NFL) • The actual nodes y known to satisfy R(x; ? ) are treated as labeled positive examples, and all other nodes are treated as negative examples

Current NELL method (baseline) • FOIL (Quinlan and Cameron-Jones, 1993) is a learning algorithm similar to decision trees, but in relational domains • NELL implements two assumptions for efficient learning – The predicates are functional --e. g. an athlete plays in at most one league – Only find clauses that correspond to bounded-length paths of binary relations -- relational pathfinding (Richards & Mooney, 1992)

Current NELL method (baseline) • FOL not great for handling uncertainty – FOIL can only combine rules with disjunctions, therefore cannot leverage low accuracy rules – E. g. rules for team. Plays. Sports High racy u c c a ow but l l recal

Experiments - Cross Validation on KB data (for parameter setting, etc) † † RWR: Random Walk with Restart (PPR) †Paired t-test give p-values 7 x 10 -3, 9 x 10 -4, 9 x 10 -8, 4 x 10 -4

Example Paths Synonyms of the query team

Evaluation by Mechanical Turk • There are many test queries per predicate – All entities of a predicate’s domain/range, e. g. • Works. For(person, organization) – On average 7, 000 test queries for each functional predicate, and 13, 000 for each non-functional predicate • Sampled evaluation – We only evaluate the top ranked result for each query – We sort the queries for each predicate according to the scores of their top ranked results, and then evaluate precisions at top 10, 100 and 1000 queries • Each belief is voted by 5 workers – Workers are given assertions like “Hines Ward plays for the team Steelers”, as well as Google search links for each entity

Evaluation by Mechanical Turk • On 8 functional predicates where N-FOIL can successfully learn – PRA is comparable to N-FOIL for [email protected], but has significantly better [email protected] • On 8 randomly sampled non-functional (one-many) predicates – Slightly lower accuracy than functional predicates Task #Rule s Functional Predicates 2. 1(+37) Non-functional Predicates ---- N-FOIL [email protected] 0. 76 0. 380 #Path s 43 ---- 92 PRA [email protected] 0. 79 0. 668 0. 65 0. 620 PRA: Path Ranking Algorithm

Beyond Pure KB Inference • Following Minkov et al, 2008: – Learn paths in a graph composed of multiple dependency trees—to find synonyms, etc.

Learning Lexico-Syntactic Patterns • Following Minkov et al, 2008: – Learn paths in a graph composed of text and knowledge [Lao et al, EMNLP 2011]

Beyond Pure KB Inference • Following Minkov et al, 2008: – Learn paths in a graph composed of text and knowledge [Lao et al, EMNLP 2011]

Learning Lexico-Syntactic Patterns

Learning Lexico-Syntactic Patterns

Outline • • Motivation for Learning Similarity in Graphs A Baseline Similarity Metric Some Literature-related Tasks The Path Ranking Algorithm (Learning Method) – Motivation – Details • Results: Bio. Literature tasks • Results: KB Inference tasks • Conclusions

Summary/Conclusion • Learning is the way to make a clean, elegant formulation of a task work in the messy, complicated real world • Learning how to navigate graphs is a significant, core task that models – Recommendation, expert-finding, … – Information retrieval – Inference in KBs – … • It includes significant, core learning problems – Regularization/search of huge feature space – Discovery: long paths, lexicalized paths, … – Incorporating knowledge of graph structure … – ….

Looking Forward • PRA learns very restricted “inference rules” desired. Result(Query, Result) p 1(Query, X 1), p 2(X 1, X 2), … pk(Xk-1, Result) • Can you generalize from these to a larger set of inference rules? • Can you generalize from binary to n-ary relationships? • Can you jointly learn several relationships at once? • PRA learns to navigate “real” graphs – What about graphs that are built on-the-fly? • E. g. , Graphs that summarize a program’s execution, or a theorem-prover’s behavior? • Future work?

• Thanks to: – My co-authors on this work – All of you for being here – NSF grant IIS-0811562 – NIH grant R 01 GM 081293 – Gifts from Google – CIKM Organizers! 58