http cs224w stanford edu 1 introduction to knowledge
play

http://cs224w.stanford.edu 1. Introduction to Knowledge Graphs 2. - PowerPoint PPT Presentation

CS224W: Machine Learning with Graphs Jure Leskovec, Hongyu Ren, Stanford University http://cs224w.stanford.edu 1. Introduction to Knowledge Graphs 2. Knowledge Graph completion 3. Path Queries 4. Conjunctive Queries 5. Query2Box: Reasoning with Box


  1. CS224W: Machine Learning with Graphs Jure Leskovec, Hongyu Ren, Stanford University http://cs224w.stanford.edu

  2. 1. Introduction to Knowledge Graphs 2. Knowledge Graph completion 3. Path Queries 4. Conjunctive Queries 5. Query2Box: Reasoning with Box Embeddings 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 2

  3. ¡ Knowledge in graph form § Capture entities, types, and relationships ¡ Nodes are entities ¡ Nodes are labeled with their types ¡ Edges between two nodes capture relationships between entities 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 3

  4. ¡ Node types : paper, title, author, conference, year ¡ Relation types : pubWhere, pubYear, hasTitle, hasAuthor, cite 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 4

  5. ¡ Node types : account, song, post, food, channel ¡ Relation types : friend, like, cook, watch, listen 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 5

  6. paintedBy 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 6

  7. ¡ Google Knowledge Graph ¡ Amazon Product Graph ¡ Facebook Graph API ¡ IBM Watson ¡ Microsoft Satori ¡ Project Hanover/Literome ¡ LinkedIn Knowledge Graph ¡ Yandex Object Answer 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 7

  8. ¡ Serving information 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 8

  9. ¡ Question answering and conversation agents 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 9

  10. 1. Introduction to Knowledge Graphs 2. Knowledge Graph completion 3. Path Queries 4. Conjunctive Queries 5. Query2Box: Reasoning with Box Embeddings 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 10

  11. ¡ Publicly available KGs: § FreeBase, Wikidata, Dbpedia, YAGO, NELL, etc. ¡ Common characteristics: § Massive : millions of nodes and edges § Incomplete : many true edges are missing Given a massive KG, enumerating all the Can we predict plausible possible facts is BUT missing links? intractable! 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 11

  12. ¡ Freebase § ~50 million entities 93.8% of persons from Freebase have no place of birth and 78.5% § ~38K relation types have no nationality! § ~3 billion facts/triples ¡ FB15k/FB15k-237 § A complete subset of Freebase, used by researchers to learn KG models [1] Paulheim, Heiko. "Knowledge graph refinement: A survey of approaches and evaluation methods." Semantic web 8.3 (2017): 489-508. [2] Min, Bonan, et al. "Distant supervision for relation extraction with an incomplete knowledge base." Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies . 2013. 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 12

  13. ¡ Given an enormous KG, can we complete the KG / predict missing relations? § links + type missing relation: genre 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 13

  14. ¡ Edges in KG are represented as triples (ℎ, 𝑠, 𝑢) § head (ℎ) has relation 𝑠 with tail (𝑢) . ¡ Key Idea: § Model entities and relations in the embedding/vector space ℝ ( . § Given a true triple (ℎ, 𝑠, 𝑢) , the goal is that the embedding of (ℎ, 𝑠) should be close to the embedding of 𝑢 . § How to embed ℎ, 𝑠 ? § How to define closeness? 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 14

  15. ¡ Symmetric Relations: 𝑠 ℎ, 𝑢 ⇒ 𝑠 𝑢, ℎ ∀ℎ, 𝑢 § Example : Family, Roommate ¡ Composition Relations: 𝑠 + 𝑦, 𝑧 ∧ 𝑠 / 𝑧, 𝑨 ⇒ 𝑠 1 𝑦, 𝑨 ∀𝑦, 𝑧, 𝑨 § Example : My mother’s husband is my father. ¡ 1-to-N, N-to-1 relations: 𝑠 ℎ, 𝑢 + , 𝑠 ℎ, 𝑢 / , … , 𝑠(ℎ, 𝑢 3 ) are all True. § Example : 𝑠 is “StudentsOf” 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 15

  16. ¡ Translation Intuition : NOTATION: embedding For a triple (ℎ, 𝑠, 𝑢) , 𝐢, 𝐬, 𝐮 ∈ ℝ ( , vectors will appear in 𝐢 + 𝐬 = 𝐮 boldface Score function: 𝑔 ; ℎ, 𝑢 = ||ℎ + 𝑠 − 𝑢|| Nationality 𝐬 Obama 𝐢 𝐮 American Bordes, Antoine, et al. "Translating embeddings for modeling multi-relational data." Advances in neural information processing systems . 2013. 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 16

  17. ¡ Translation Intuition: for a triple (ℎ, 𝑠, 𝑢) , 𝐢 + 𝐬 = 𝐮 Max margin loss: ; (ℎ, 𝑢 F ) G ℒ = ? 𝛿 + 𝑔 ; (ℎ, 𝑢) − 𝑔 (@,;,A)∈B,(@,;,A C )∉B Valid triple Corrupted triple where 𝛿 is the margin, i.e., the smallest distance tolerated by the model between a valid triple and a corrupted one. NOTE : check lecture 7 for a more in-depth discussion of TransE! 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 17

  18. ¡ Who has won the Turing award? Answers! Turing Award Pearl Win 𝐫 Hinton Bengio Canada Trudeau Bieber ¡ Who is a Canadian citizen? Turing Award Pearl Answers! Hinton Bengio 𝐫 Canada Citizen Trudeau Bieber 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 18

  19. ¡ Composition Relations: 𝑠 + 𝑦, 𝑧 ∧ 𝑠 / 𝑧, 𝑨 ⇒ 𝑠 1 𝑦, 𝑨 ∀𝑦, 𝑧, 𝑨 ¡ Example : My mother’s husband is my father. ¡ In TransE: 𝑠 1 = 𝑠 + + 𝑠 / ü 𝐳 𝐬 / 𝐬 + 𝐴 𝐲 𝐬 1 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 19

  20. ¡ Symmetric Relations: 𝑠 ℎ, 𝑢 ⇒ 𝑠 𝑢, ℎ ∀ℎ, 𝑢 ¡ Example : Family, Roommate ¡ In TransE: 𝑠 = 0, ℎ = 𝑢 û If we want TransE to handle symmetric relations 𝑠 , for all ℎ, 𝑢 that satisfy 𝑠(ℎ, 𝑢) , 𝑠(𝑢, ℎ) is also True, which means ‖ ℎ + 𝑠 − 𝐬 ‖ 𝑢 = 0 and 𝑢 + 𝑠 − ℎ = 0 . Then 𝑠 = 0 and ℎ = 𝑢 , however ℎ and 𝑢 are two different entities and should be mapped to different 𝐢 𝐮 locations. 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 20

  21. ¡ 1-to-N, N-to-1, N-to-N relations. ¡ Example : (ℎ, 𝑠, 𝑢 + ) and (ℎ, 𝑠, 𝑢 / ) both exist in the knowledge graph, e.g., 𝑠 is “StudentsOf” With TransE, 𝑢 + and 𝑢 / will map to the same vector, although they are different entities. 𝐮 + ¡ 𝐮 + = 𝐢 + 𝐬 = 𝐮 / 𝐬 𝐮 / ¡ 𝐮 + ≠ 𝐮 / contradictory! 𝐬 𝐢 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 21

  22. ¡ TransR: model entities as vectors in the entity space ℝ ( and model each relation as vector 𝒔 in relation space ℝ P with 𝐍 ; ∈ ℝ P×( as the projection matrix. ¡ ℎ S = 𝑁 ; ℎ, 𝑢 S = 𝑁 ; 𝑢 ¡ 𝑔 ; ℎ, 𝑢 = ||ℎ S + 𝑠 − 𝑢 S || 𝐮 𝐢 S 𝐮 S 𝐬 𝐢 Lin, Yankai, et al. "Learning entity and relation embeddings for knowledge graph completion." AAAI . 2015. 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 22

  23. ¡ Symmetric Relations: 𝑠 ℎ, 𝑢 ⇒ 𝑠 𝑢, ℎ ∀ℎ, 𝑢 ¡ Example : Family, Roommate 𝑠 = 0, ℎ S = 𝑁 ; ℎ = 𝑁 ; 𝑢 = 𝑢 S ü 𝐮 For TransR, we can map ℎ and 𝑢 to the same location on the space of relation 𝑠 . 𝑵 ; 𝐮 S , ℎ S 𝐢 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 23

  24. ¡ 1-to-N, N-to-1, N-to-N relations ¡ Example : If (ℎ, 𝑠, 𝑢 + ) and (ℎ, 𝑠, 𝑢 / ) exist in the knowledge graph. We can learn 𝑁 ; so that 𝑢 S = 𝑁 ; 𝑢 + = 𝑁 ; 𝑢 / , note that 𝑢 + does not need to be equal to 𝑢 / ! 𝐮 + 𝐮 / 𝐢 S 𝐮 S 𝐬 𝐢 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 24

  25. ¡ Composition Relations: 𝑠 + 𝑦, 𝑧 ∧ 𝑠 / 𝑧, 𝑨 ⇒ 𝑠 1 𝑦, 𝑨 ∀𝑦, 𝑧, 𝑨 ¡ Example : My mother’s husband is my father. Each relation has different space. It is not naturally compositional for multiple relations! û 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 25

  26. 𝒈 𝒔 (𝒊, 𝒖) Embedding Entity Relation ℎ, 𝑢 ∈ ℝ ( 𝑠 ∈ ℝ ( ||ℎ + 𝑠 − 𝑢|| TransE ℎ, 𝑢 ∈ ℝ ( 𝑠 ∈ ℝ P , 𝑁 ; ∈ ℝ P×( ||𝑁 ; ℎ + 𝑠 − 𝑁 ; 𝑢|| TransR Embedding Symmetry Composition One-to-many û ü û TransE ü û ü TransR 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 26

  27. 1. Introduction to Knowledge Graphs 2. Knowledge Graph completion 3. Path Queries 4. Conjunctive Queries 5. Query2Box: Reasoning with Box Embeddings 11/21/19 Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu 27

Recommend


More recommend