KnowledgeGraphs
KnowledgeGraphs
Sargur N. Srihari
[email protected]
1
Knowledge Graphs Srihari
Topics
• Knowledge Graphs (KGs)
• Statistical Relation Learning (SRL) for KGs
• Latent Feature Models
– RESCAL, ER-MLP, Latent distance
– Training SRL
• Markov Random Fields from KGs
• References
2
Knowledge Graphs Srihari
Definition of Attribute
• We can also define an attribute, a concept
analogous to a relation, but taking only one
argument:
(entity i , attribute j)
• For example, we could define the has_fur
attribute, and apply it to entities like dog
8
Knowledge Graphs Srihari
rk
ei ej
9
Knowledge Graphs Srihari
Training Datasets
• Inferring relations between entities from data
• From Knowledge Bases
1. Databases conveying commonsense knowledge
about everyday life
• Freebase, OpenCyc, WordNet, or Wikibase, etc
2. Databases with expert knowledge about an
application AI system
• GeneOntology
• From Unstructured natural language
10
Knowledge Graphs Srihari
KG Construction Approaches
• Curated:
– Triples created by experts
• Cyc, WordNet, UMLS
• Collaborative:
– Triples created by volunteers
• Wikidata, Freebase
• Automated semi-structured
– Triples from text via rules:
• YAGO, DBPedia, Freebase
11
Knowledge Graphs Srihari
• Link prediction:
– Predicting missing arcs in the knowledge graph
• Entity Resolution
– Is A. Guiness the same as Alec Guiness?
• Link-based Clustering
– Extend feature-based clustering to relation based
on similarity of entities and relations
• Word sense disambiguation
– Deciding which of the senses of a word is the
appropriate one, in some context 13
Knowledge Graphs Srihari
Link Prediction
• Predicting existence (probability of correctness)
of (typed) edges in graph (i.e.,triples)
– KGs often miss facts, and some edges are incorrect
14
Knowledge Graphs Srihari
Entity Resolution
• Problem of identifying which objects in
relational data refer to the same underlying
entities
Nodes 1 and 3 refer to the identical entity, the actor Alec Guinness.
Node 2 on the other hand refers to Arthur Guinness, the founder of the Guinness
brewery.
The surface name of node 2 (“A. Guinness”) alone would not be sufficient to perform a
correct matching as it could refer to both Alec Guinness and Arthur Guinness.
However, since links in the graph reveal the occupations of the persons,
15
a relational approach can perform the correct matching
Knowledge Graphs Srihari
Link-based Clustering
• Extend feature-based clustering to relational
learning
– Group entities in relational database using similarity
• Entities are not only grouped by similarity of
their features but also by similarity of their links
• In social networks, it is community detection
16
Knowledge Graphs Srihari
17
Knowledge Graphs Srihari
Tensor Representation
• Binary relational data is represented as a tensor
Fibers of a 3rd order tensor
Ne
Slices of a 3rd order tensor
Ne
Nr
19
Knowledge Graphs Srihari
20
Knowledge Graphs Srihari
24
Knowledge Graphs Srihari
26
Types of Latent Feature Models
Knowledge Graphs Srihari
RESCAL
• RESCAL is an embedding method for learning
from knowledge graphs
– For tasks like link prediction and entity resolution
– Scalable to KGs with millions of entities and billions
of facts
– Provide access to relational information for deep
learning methods
• RESCAL = Relational + Scalable
28
Knowledge Graphs Srihari
29
Knowledge Graphs Srihari
Fk=EWkET
where Fk ∈ RNe X Ne is the matrix holding all scores for the kth relation and the
ith row of E ∈ RNe X He holds the latent representation of ei
30
Knowledge Graphs Srihari
Multi-Layer Perceptrons
• We can interpret RESCAL as creating
composite representations of triples and
predicting their existence from this
representation
• In particular, we can rewrite RESCAL as
– Where wk=vec(Wk)
31
Knowledge Graphs Srihari
RESCAL as an MLP
MLP based on entities (E)
He=Hr=3 and Ha=3. Note, that the inputs are latent features.
The symbol g denotes the application of the function g (.) 33
Knowledge Graphs Srihari
34
Knowledge Graphs Srihari
• Here Bk is a tensor, where the lth slice Blk has size He x He,
and there are Hb slices
• hbijk is a bilinear hidden layer, since it is derived from a
weighted combination of multiplicative terms
– With more parameters than E-MLP or RESCAL
models it tends to overfit 35
Knowledge Graphs Srihari
2.TransE Model
– Translates latent features via a relation-specific
offset instead of matrix multiplications.
• Score of a triple xijk is defined as: f TransEijk := - d(ei+rk , ej)
Knowledge Graphs Srihari
37
Knowledge Graphs Srihari
38
Knowledge Graphs Srihari
39
• where λ controls the strength of the prior
Knowledge Graphs Srihari
Loss Function
• We can equivalently state this as a regularized
loss minimization problem
40
Knowledge Graphs Srihari
42
Knowledge Graphs Srihari
Definition of MRF
• MRF has the form
44
First Order Knowledge Base
Knowledge Graphs Srihari
First-Order Logic
• An atomic formula or atom is a predicate symbol applied to a
tuple of terms e.g., Friends(x;MotherOf(Anna))
• Formulas are recursively constructed from atomic formulas
using logical connectives and quantifiers.
• If F1 and F2 are formulas, the following are also formulas ¬F1
(negation), which is true iff F1 is false;
• F1 ∧ F2(conjunction), which is true iff both F1 and F2 are true
• F1 ∨ F2 (disjunction),which is true iff F1 or F2 is true; F1)
• F1 ⃗ F2 (implication),which is true iff F1 is false or F2 is true
• F1↔ F2 (equivalence), true iff F1 and F2 have same truth value
• ∀x F1(universal quantification), which is true iff F1 is true for
every object in the domain; and
• ∃x F1(existential quantification),which is true iff F1 is true for at
least one object x in the domain. 46
Knowledge Graphs Srihari
Definition of MLN
• An MLN L is a set of pairs (Fi; wi), where Fi is a
formula in first-order logic and wi is a real no.
• Together with constants C={c1; c2; : : : ; c|C|}, it
defines MRF ML;C ( ) as follows:
– 1. ML;C contains one binary node for each possible
grounding of each predicate appearing in L
• Value of node is 1 if ground atom is true, and 0 otherwise
– 2. ML;C contains one feature for each possible
grounding of each formula Fi in L
• The value of this feature is 1 if the ground formula is true,
and 0 otherwise. The weight of the feature is the wi
associated with Fi in L
47
Knowledge Graphs Srihari
An example
• Two types of entities: adults and children
• Two types of relations: parentOf and marriedTo
– These relations (edges) are correlated
• since people who share a common child are often
married, while people rarely marry their own children
• In Markov logic, we represent these
dependencies using formulae such as:
• F1: (x, parentOf, z) ^ (y, parentOf, z) => (x, marriedTo, y)
• F2: (x, marriedTo, y) => ¬ (y, parentOf, x)
49
Knowledge Graphs Srihari
53
Knowledge Graphs Srihari
Conclusion on MRFs
• Approaches based on MRFs are very flexible
• But harder to make scalable inference and
devise learning algorithms
– Compared to methods based on observable or
latent feature models
56
Knowledge Graphs Srihari
References
1. M. Nickel, K. Murphy, V. Tresp, E. Gabrilovich, “A Review of
Relational Machine Learningfor Knowledge Graphs”
Proceedings of the IEEE 104(1): 11-33 (2016)
2. M.Richardson , P.Domingos, “Markov logic
networks”, Machine Learning 62, 107–136(2006)
57