D IFFERENTIABLE LEARNING OF NUMERICAL RULES IN KNOWLEDGE GRAPHS
A BSTRACT
Rules over a knowledge graph (KG) capture interpretable patterns in data and can be used for KG cleaning and completion.
Inspired by the TensorLog differentiable logic framework, which compiles rule inference into a sequence of differentiable operations, recently a method called Neural LP has been proposed for learning the parameters as well as the structure of rules.
However, it is limited with respect to the treatment of numerical features like age , weight or scientiﬁc measurements .
We address this limitation by extending Neural LP to learn rules with numerical values, e.g ., “ People younger than 18 typically live with their parents ”.
We demonstrate how dynamic programming and cumulative sum operations can be exploited to ensure efﬁciency of such extension.
Our novel approach allows us to extract more expressive rules with aggregates, which are of higher quality and yield more accurate predictions compared to rules learned by the state-of-the-art methods, as shown by our experiments on synthetic and real-world datasets.
I NTRODUCTION
Due to the availability of vast amounts of knowledge on the web, advances in information extraction have led to large graph-structured knowledge bases, also known as knowledge graphs (KGs), which are widely used in web search, question answering, and data analytics.
Such KGs represent data as a graph of entities ( e.g ., john , article1 ) connected via relations ( e.g ., citedIn ), or more formally as a set of binary grounded atoms ( e.g ., citedIn ( john , article1 ) ).
A common task in such settings is that of link prediction , determining whether a relation exists between two entities in the graph even if the relation is not included explicitly in the graph.
Although most work on this topic has focused on statistical rule-extraction techniques (Meilicke et al.
Gal´arraga et al. (2015);
Ortona et al.
(2018a))
, recent methods have shown the beneﬁt of using deep learning approaches for this link prediction task (see Wang et al.
(2017) for overview).
And while most deep approaches (for example, those based upon graph embedding methods) are inherently difﬁcult to interpret, the
Neural LP method of Yang et al.
(2017) is particularly appealing in that it allows for interpretable resulting rules for the link prediction task while still preserving the ﬂexibility of a learning approach.
Unfortunately, Neural LP is also quite limited in the types of rules it is capable of representing, and notably no rules that depend on numerical features can be efﬁciently learned within this framework.
In this paper, we propose an extension to Neural LP that allows for fast learning of numerical rules.
Speciﬁcally, although numerical rules would result in dense matrix operations in the generic Neural
LP framework, we show that using dynamic programming and cumulative sum operations, we can efﬁciently express the operators for numerical comparators within the Neural LP framework.
By deﬁning the relevant operators implicitly in this manner, we show that we can extend Neural LP to efﬁciently learn rules that make use of numerical features, while retaining the interpretability of the Neural LP framework.
More generally, this is an instance of integrating so-called “aggregates” ( i.e . external oracle queries, in this case binary queries that reﬂect numerical comparison) within a rule-learning framework.
Learning such rules with aggregates is very much an open problem in the
KG community (Gal´arraga & Suchanek (2014)), and our approach is the ﬁrst work to learn rules with these numerical aggregates.
We apply our approach to several knowledge graph datasets, and show that we are able to answer queries more accurately than the previous Neural LP approach, as well as more accurately than a state-of-the-art rule extraction method, the AnyBurl package proposed by Meilicke et al.
Speciﬁcally, we show on two synthetic and two real-world datasets that our extension to Neural
LP is able to more accurately recover rules that depend on numerical information, and thus make much more accurate link predictions in the knowledge graph.
Further, the extracted rules are still interpretable as in the original Neural LP framework, and unlike the pure graph embedding strategies (Bordes et al.
R ELATED W ORK
Relational Data Mining .
The problem of learning rules from the data has been traditionally addressed in the area of relational data mining Raedt (2017) and inductive logic programming (ILP) Muggleton (1995).
Works most related to ours concern learning decision trees with aggregates Vens et al.
(2006) from relational data.
However, these methods typically do not scale well, and modern knowledge graphs are far beyond what they can handle.
In the context of KGs, the problem of rule learning has recently gained a lot of attention.
In Ortona et al.
(2018b) rules with negation, which also support numerical comparison as we do have been considered.
Contrary to our approach, however, Ortona et al.
(2018b) is designed to ﬁnd a small set of rules that cover the majority of positive and as few negative examples as possible, which differs from our goal of learning rules in an unsupervised fashion.
Neural-based Rule Learning .
Several works Yang et al.
(2017); Manhaeve et al.
Rockt¨aschel & Riedel (2017); Evans & Grefenstette (2018); Zhang et al.
; Ho et al.
Weber et al.
(2019) utilize embedding models and neural architectures for rule learning.
The closest to ours is the work Yang et al.
(2017), which reduces the rule learning problem to algebraic operations on neural-embedding-based representations of a given KG.
However, Yang et al.
(2017) is restricted to non-numerical rules in contrast to our work.
Embedding Models with Numericals .
The problem of KG incompleteness has been tackled by methods that predict missing relational edges between existing entities.
Several approaches rely on statistics and include tensor factorization ( e.g ., Nickel et al.
Other models are based on neural embeddings ( e.g ., Bordes et al.
For overview see Wang et al.
The most relevant for us is the work Garc´ıa-Dur´an & Niepert (2018), which presents a novel approach to combining relational, latent (learned) and numerical features, i.e . features taking large or inﬁnite number of real values for the KG completion task.
While Garc´ıa-Dur´an & Niepert (2018) operates on KGs with numerical values, it’s results like in the case of most knowledge graph embedding models are not interpretable.
bob pete john article article    hasCitation hasCitation hasCitation citedIn citedIn citedIn supervisorOf colleagueOf inﬂuences
P RELIMINARIES
Knowledge Graphs .
We assume countable sets C of constants ( a.k.a . entities), N ⊂ R of numerical values and R of binary relations ( a.k.a . predicates).
A KG G is deﬁned by a ﬁnite set of ground atoms ( a.k.a . facts), of the form p ( x, y ) , where p ∈ R , x ∈ C and y ∈ C∪N ( e.g ., citedIn ( john , article1 ) ).
The set R n ⊆ R stores all numerical predicates p , such that p ( x, y ) ∈ G , where x ∈ C and y ∈ N .
The set of numerical facts, i.e . facts over numerical predicates, is denoted by G n ⊆ G .
We use lower-case letters for constants and upper-case letters for variables.
As KGs are incomplete, one can assume that missing facts, i.e . facts that are not in G , are either unknown or false .
Typically the open world assumption (OWA) is employed, which means that missing facts are considered to be unknown rather than false.
Alternatively, the local closed world assumption (LCWA) can be considered to generate negative facts by assuming that the KG is locally complete as data is usually added to KGs in batches.
More precisely, it means that for any x ∈ C we can conclude that p ( x, y ) is false if z ∈ C ∪ N exists such that p ( x, z ) ∈ G and p ( x, y ) / ∈ G .
Numerical Rules .
A rule is an expression of the form
[Equation]
(1) where p, q 1 , . . . , q n ∈ R , left-hand side of the rule is referred to as the rule head, and right-hand side as the rule body, and every conjunct in the rule head or body is referred to as an atom.
The rule inﬂuences ( X , Y ) ← colleagueOf ( X , Z ) ∧ supervisorOf ( Z , Y ) intuitively states that typically students are inﬂuenced by colleagues of their supervisors.
Aside from conventional rules, we can also have numerical rules , i.e . rules that contain numerical comparison among variables ( e.g ., number of citations of two people), or a variable and a numerical constant.
To simplify presentation, numerical values in N linked to an entity from C are sometimes treated as its “features”, and numerical relations in R n as functions that depend on those features.
In this case, for p ( X, Y ) we also use a shortcut notation X.p = Y .
For instance, john.hasCitation =stands for hasCitation ( john, 124) , and for compactness, r ◦ pq ( X, Y ) stands for X.p ◦ Y.q , where ◦ ∈ {≤ , > } .
The second subscript in r ◦ pq is omitted if it is clear from the context that p = q .
Example 1.
For example, consider a KG in Figure 1 and the following rule inﬂuences
[Equation]
←
[Equation]
hasCitation
[Equation]
This rule states that students are inﬂuenced by colleagues of their supervisors with a higher number of citations 1 .
We can also deﬁne a classiﬁcation relation mapping the feature to the probability of a logistic classiﬁcation, σ ( w T X. features + b ) , where w and b are parameters and σ is the sigmoid function.
As we demonstrate later such rules can be integrated and learnt naturally in the Neural LP framework.
Rule Learning .
Given a KG G the goal of rule learning is to extract rules from G , such that their application to G results in an approximation of the ideal KG, which stores all correct facts.
[Table]
[Table]
The Neural LP method (Yang et al.
(2017))is among rule learning proposals, which learns a distribution over rules of the form in Eq.
(1) without comparison operators in an end-to-end fashion by making use of gradient-based optimization.
This approach relies on the TensorLog framework (Cohen et al.
(2017)), which connects rule application with sparse matrix multiplications.
In
TensorLog all entities are mapped to integers, and each entity i is associated with a one-hot encoded vector v i ∈ { 0 , 1 } |C| such that only its i-th entry is 1 .
For example, every KG entity c ∈ C in Fig.
1 is encoded as a 0 / 1 vector of length 5 , since |C| = 5 .
For every relation p ∈ R \ R n and every pair of entities x, y ∈ C a matrix M p ∈ { 0 , 1 } |C|×|C| is deﬁned such that its ( y, x ) entry, denoted by ( M p ) yx , is 1 iff p ( x, y ) ∈ G .
For example, by considering the KG in Fig. 1, for the relation p =
citedIn
we have
[Table]
The idea of TensorLog is to imitate application of rules for any entity X = x by performing matrix multiplications M q n . . .
M q 2 M q 1 v x = s , where v x is the indicator of entity x .
Nonzero entries in the vector s point to the entities y for which p ( x, y ) is derived by applying the above rule on G .
For example, the inference for the following rule inﬂuences ( X, Y )
← colleagueOf ( X, Z ) , supervisorOf ( Z, Y ) can be translated to
M supervisorOf M colleagueOf v x = s .
By setting v x = [1 , 0 , 0 , 0 , 0] (cid:62) as indicator of john and applying the matrix multiplications, we obtain s =
[0 , 0 , 1 , 0 , 0] (cid:62) , the indicator of bob .
As M q 1 , . . . , M q n are sparse, the matrix-vector multiplication can be done efﬁciently, and the inference process is parallelizable on GPUs.
In Neural LP (Yang et al.
above operators are used to learn for every head the formula
[Equation]
where i indexes over all possible rules, α i is the conﬁdence associated with the rule r i and
β
i is an ordered list of all relations appearing in these rules.
The rules are read off from the solution of the following optimization problem
[Equation]
L EARNING R ULES WITH N UMERICAL F EATURES AND N EGATIONS
As the main contribution of the paper we extend the Neural LP framework to allow us to use comparison operators with numerical values in the rule bodies, and also to handle negations of atoms.
These extensions are non-trivial as the Neural LP framework does not directly support facts over numerical values: naively treating numerical constants as entities in C is intractable due to the explosion of the number of non-zero elements in the respective matrices.
Similarly, naive treatment of negated atoms would introduce dense matrices that would not be practical to operate on.
Intuitively, the main idea of our approach is to represent the necessary matrix operations implicitly, either using dynamic programming, cumulative sums and permutations (for numerical comparison features) or low rank factorizations (for negated atoms).
Exploiting this structure lets us formulate the associated
TensorLog operators efﬁciently, and effectively integrate them into the Neural LP framework for rule extraction.
4. C OMPARISON O PERATORS
Pair-wise Comparison .
We start by implicitly representing the operators associated with numerical comparators.
Let p, q ∈ ( R ∪ { NaN } ) |C| be the vector of two speciﬁc features, where NaN means missing values.
The comparison operator M r ≤ pq is deﬁned as
[Equation]
Intuitively, this matrix includes the binary indicator of the comparison, over all pairs of entities in the knowledge graph that contain p and q .
Unlike conventional sparse relations, the matrix M r ≤ pq is usually dense ( i.e .
it has O ( n 2 ) non-zero elements), thus a naive materialization would exceed the typical GPU memory limit.
However, in reality there is no need to explicitly materialize the
TensorLog relation matrix.
Note that in the Neural LP inference chain we described above, all that is needed is to efﬁciently compute the matrix-vector product between a relation matrix and some vector representing the current probabilities in the inference chain.
Consider the special case that both p and q are sorted in an ascending order as ˜ p and ˜ q with operator ( ≤ ) 2 , and call the corresponding comparison matrix ˜ M r ≤ pq .
Since ˜ q i ≤ ˜ q
i +1 and ˜ p
j ≤ ˜ p
j +1 , we have the following property ( P1 )
[Equation]
i.e., the resulting matrix ˜ M r ≤ pq is always effectively lower triangular in form (or more precisely, the transition from 1 to 0 is always monotonic in the matrix, even if the non-zero pattern is not precisely lower triangular in the usual sense).
Now deﬁne γ i = arg max j such that ( ˜ M r ≤ pq ) ij = 1 , i.e., γ i is the index of the last element equal to one.
The main observation is that we can compute the required matrix-vector product using just this γ vector, i.e . for any vector v ,
[Equation]
The respective values of γ for ˜ M r ≤ pq v can be precomputed on a CPU with linear complexity by dynamic programming since its value is monotonically increasing because of the property ( P1 ).
Also, the cumsum operator can be calculated in O ( |C| ) time, with an efﬁcient GPU parallelization that in practice is even faster for large vectors.
For the general case when p and q are not sorted, we can ﬁrst permute the input v to the sorted order, perform the matrix-vector multiplication, then permute the result back to the original order.
Since permutation ( a.k.a ., index slicing) is a simple linear time operation, this does not affect the complexity of the overall approach.
Speciﬁcally, let P p and P q be the permutation matrices corresponding to the argsort of p and q , respectively.
Then the matrix-vector multiplication corresponding to the comparison operator can be written as
[Equation]
which can be computed in O ( |C| ) in parallel given β , which are precomputed once in O ( |C| log |C| ) .
Thus, the comparison operator needed for inference can be computed efﬁciently on a GPU.
Efﬁcient Use of Numerical Comparisons via Multi-atom Symbol Matching .
Although the above numerical comparison operator provides an efﬁcient means for implementing such comparisons within the Neural LP framework, it has signiﬁcant drawbacks as well.
Speciﬁcally, because the comparison operator is dense, when using it to match potential entities in the graph, it has the potential to create a huge number of candidate matches.
For example, the operator ( X.p ≤ Y.p ) will link the entity with smallest p to all other entities with attribute p and will decrease the probability of ﬁnding the correct target.
To make the comparison operator more useful, it is natural to use it jointly with some other sparse operator.
For example,
[Equation]
would search only over neighbors of X in the graph that also obey the respective numerical relation.
Let the two parallel relations from above correspond to operators M colleagueOf and M r ≤ pq respectively.
The above conjunction can be implemented in TensorLog via
[Equation]
where the symbol (cid:12) denotes the element-wise multiplication.
Unfortunately, the above relation is not learnable in the standard Neural LP framework, since the latter only supports a single chain of matrix-vector operations M q n . . .
M q 2 M q 1 v x , which does not allow for easy computation of this
Hadamard product, as it includes two “copies” of the vector v .
However, we note that it is trivial to simply cache intermediate values of v in the multiplication chain, and this way conveniently compute such Hadamard products; in the knowledge graph setting, this exactly corresponds to the ability to integrate symbol matching at multiple points in the inference chain.
Classiﬁcation Operators .
We may also consider more general rules, where the comparison is performed not necessarily among two numerical attributes of a certain entity but rather functions over such attributes.
Note that such comparison for all entities can readily be expressed by TensorLog operators, that is, the corresponding matrix for a given numerical value Z is a diagonal matrix.
We model the numerical value Z by making use of a logistic model.
Namely, for each entity we collect the feature vector ϕ , which consists of all the numerical values from N that are in relation with the given entity.
The i th element of the diagonal in M is deﬁned as sigmoid ( w (cid:62) ϕ
+ b ) , where the weight vector w and the bias vector b are assumed to be learned.
These parameters can easily be learnt in the Neural LP framework via backpropagation.
Negated Operators .
The negation of a relation p ∈ ¯ R obtained by naively ﬂipping all zeros to ones and vice versa in the corresponding (sparse) matrix M p results in a dense matrix, which is not supported directly in TensorLog .
To compute the negated operator ¯ M p ∈ { 0 , 1 } |C|×|C| we employ the local closed-world assumption .
For a given M p only the elements, that are in such rows that contain at least one non-zero element, should be ﬂipped.
The matrix-vector multiplication for the negated operator ¯ M p can be written as
[Equation]
where 1 p ∈ { 0 , 1 } |C| is the indicator vector for p such that (1 p ) i =
iff p i = NaN .
Here, 1 is the vector with all of its elements equal to 1 .
Note that for any TensorLog operator M p the products
M p v and 1 p ( 1 (cid:62) v ) can be computed efﬁciently, therefore the negated operator ¯ M p can be computed efﬁciently as well.
The trick in Eq.
(3) generalizes to the comparison operators M r ◦ pq , namely,
[Equation]
E.g., ¯ M r ≤ pq v = 1 p 1 (cid:62) q v − M r >pq v .
This way we can learn rules with negated atoms in the body.
Once the rules have been learned by our approach, we rely on the same procedure as in Yang et al.
(2017) to decode them back to the form of Eq.
Connection to Rules with Aggregates over Knowledge Graphs.
Note that, importantly, the rules that we extract using the described procedure fall into the language of logic rules with external computations in the spirit of Eiter et al.
and are connected to the concept known as aggregates in the knowledge representation community.
Indeed, much of the formulation we have presented here can be viewed as an instance of learning rules with aggregates from knowledge graphs.
This is an active area of current research, and our work here is signiﬁcant in connection to this area in that we present one of the ﬁrst methods for learning rules using (a limited form of) such aggregates.
However, the discussion requires substantial additional notation in order to be concrete, and so we defer this discussion to Appendix A
[Table]
|C| |R| |R n | |G n | |G| |G t |
[Table]
E XPERIMENTAL R ESULTS
In this section we report the results of our experimental evaluation, which focuses on the effectiveness of our method against the state-of-art rule learning systems with respect to the predictive quality of the learned rules.
Speciﬁcally, we conduct experiments on a canonical knowledge graph completion task as described in Yang et al.
In this task, the query and tail are given to the algorithm, and the goal is to retrieve the related head.
For example, if supervisorOf ( turing , church ) is not present in the knowledge graph, then when presented with the relation supervisorOf and the entity church , the goal is to exploit the existing triples in the KG to retrieve turing .
In order to represent the query as a continuous input to the neural controller, for each query we learn the embedding of the lookup table.
As in Yang et al.
(2017), the embedding has dimension 118 and is randomly initialized to unit norm vectors.
The only difference between the parameters of the Neural-LP and our system is that we set the learning rate to 10 − 2 , while in Yang et al.
(2017) it is set to 10 − 3 , but both systems are run to convergence, and this learning rate does not affect the ﬁnal performance materially except for making it converge faster.
In all cases, we extracted rules with a maximum length of 5.
5. E XPERIMENTAL S ETUP
Datasets .
To evaluate and compare our approach for learning numerical rules, we considered the following datasets containing knowledge graphs:
• FB15K-237-num is a variant of Freebase knowledge graph with numerical values, where the reverse relations have been removed (Garc ´ ıa-Dur ´ an & Niepert (2018)).
• DBPedia15K is a fragment of the DBPedia knowledge graph Lehmann et al.
(2015) restricted to numerical facts Garc ´ ıa-Dur ´ an & Niepert (2018).
• Numerical1 is a synthetic dataset with 1000 entities, each containing a single numerical value (generated uniformly from 1 to 1000).
Each entity has 50 randomly-chosen neighbors, and the goal is to ﬁnd neighbors with the closest value to the current entity given the constraint that the neighbor’s value must be higher.
• Numerical2 is a variant of the Numerical1 dataset, where each entity has two numerical values, “balance” and “debt”; under the same generation process as above, the goal is to ﬁnd a neighbor of each node with the largest delta between balance and debt.
The statistics of the knowledge graphs used in our experiments is presented in Table 1, where apart from the number of KG entities ( |C| ), facts ( |G| ) and the size of the test set ( G t ), we also report the number of numerical relations ( |R n | ) and numerical facts ( |G n | ).
We use 80% of the KG as the training set, and 10% for test set and the same for validation.
The KG is split randomly with the constraint that only non-numerical facts appear in the test set, since we do not learn rules capable of predicting missing facts over numerical entities.
Baselines .
We compared our proposed approach, which we refer to as Neural-Num-LP against the following two baselines:
• AnyBURL 3 (Meilicke et al.
(2019)) is an anytime bottom-up method for learning Horn rules, i.e . rules with only positive atoms and no comparison operators.
To tune the system we use the default parameters as described on the system webpage and set the timeout to 5000 seconds.
• Neural-LP 4 (Yang et al.
(2017)) is a differential rule learning system described in Section 3.
[Table] [Table]
Following the common practice Meilicke et al.
; Yang et al.
we compute the standard evaluation metrics used for the link prediction task Bordes et al.
(2013): Hit@10 , the number of correct head terms predicted out of the top 10 predictions; and mean reciprocal rank ( MRR ), the mean of one over the rank of the correct answer in the list of predictions.
We have implemented our approach for learning numerical rules from knowledge graphs in python using the PyTorch library, and conducted all experiments on a machine GTX 1080 TO GPU with 11 GB RAM.
5. R ESULTS
In Table 2 we report the quality of predictions obtained by our method and the baselines.
Since the
Neural-LP framework Yang et al.
(2017) cannot handle the Freebase with numerical information, we present the results for FB15K-237 without numerical facts instead, which are taken from Yang et al.
The MRR values are missing for Neural-LP in several places, as the implementation provided by the authors does not have the respective function implemented.
As expected, on the synthetic datasets Numerical1 and Numerical2 , our method signiﬁcantly outperforms the baselines.
This is natural, since these datasets are constructed so that reasoning about numerical attributes is required for almost any prediction task presented to the algorithms.
And notably, the proposed approach is able to achieve 100% Hit@10 rates, as it is able to correctly identify these relevant numerical properties.
This contrasts to the baseline Neural-LP approach, which is unable to incorporate such information, and thus predicts the heads of each relation more or less randomly.
The datasets are also particularly challenging for AnyBURL, because AnyBURL treats each numerical value as an independent entity, and thus cannot perform efﬁcient comparative reasoning.
Most compellingly, however, similar observations can be made about the real-world datasets as well.
Indeed, since all entities in the KG including numerical ones are treated equally by the available systems, intuitively both AnyBurl and Neural-LP try to ﬁnd frequent patterns in KGs, and use these to predict the missing facts.
The numerical rules mined by our system are much more expressive and substantially improve the performance of the approach in some cases.
Speciﬁcally, our method outperforms the Neural-LP approach in terms of all metrics on both the FB15K-237num and DBPedia15K datasets.
The AnyBURL dataset is still competitive with our approach on the FB15K-237-num dataset (better in terms of Hit@10 but worse in terms of MRR), but our approach substantially outperforms it on the DBPedia15K , where our reasoning involving numerical comparison is able to substantially improve upon the existing methods.
Examples of extracted rules .
In Figure 3 we present examples of the rules learned by our system.
In particular, the rules r 1 , and r 2 have been extracted from the datesets Numerical1 and Numerical2 respectively, the rule r 3 from FB15K-237-num and the rest of the rules from DBPedia15K .
For example, r 1 is the rule with a comparison operator, which states that a person X prefers neighbours with the maximal order that is less than X ’s. The rule r 3 reﬂects that symptoms with certain properties (described by the function f ) typically provoke risk factors inherited from diseases which have these symptoms.
Here, the function f is the sigmoid over a linear combination of numerical properties of X .
Finally, r 4 states that prime ministers of countries with certain numerical properties (described by the function f ), are supported by military branches of the given country.
Here, the function f is again the sigmoid over a linear combination of numerical properties of Y .
C ONCLUSION
In this paper we have addressed the problem of learning numerical rules from large knowledge graphs.
Especially we have considered rules, where in the rule bodies numerical comparison operators and aggregates ( i.e . external oracle queries) that enable us to aggregate numerical properties of entities are allowed.
The Neural-LP method is a recent appealing learning approach based on
TensorLog ; however it does not support numerical rules, as they would result in dense matrix operations.
We have introduced an extension to the Neural-LP framework that allows for learning such rules from KGs by efﬁciently expressing comparison and classiﬁcation operators, negation as well as multi-atom symbol matching.
We have shown that our proposed extension outperforms previous techniques that do not support numerical information with respect to the quality of predictions that they produce.
The future research might focus on a further extension of our current approach by allowing for more general rule forms with complex external computations as well as rules with existential variables in the head.
A CKNOWLEDGMENTS
Authors would like to thank Christian Meilicke for his support with adjusting the parameters of the
AnyBurl package as well as anonymous reviewers for their invaluable feedback.
A I NTERPRETATION AS R ULES WITH E XTERNAL C OMPUTATIONS
We have presented our approach for learning rules that support numerical comparison among entities and classiﬁcation of entities based on aggregation of their numerical features and have also highlighted the algorithmic and numerical approaches to handling such rules
In this Appendix we draw a connection between the rules of our focus and formalisms known in the knowledge representation community.
In the general case the rule features that we consider are inlined with logic rules that allow for external computations i e . “oracle programs” that might appear in the body of the rules as part of a generic black-box computation (in the spirit of answer set programs with external functions Eiter et al. (2012)).
In the case of simplest numerical comparisons, for example, the corresponding oracle may check whether some numerical feature of one entity is larger than some numerical feature of another one.
In a more complex setting an oracle may aggregate numerical features of an entity by computing their linear combination and compare the result with a certain value.
Since the rules that we are targeting account both for relational and numerical information they can be characterized as restricted explainable structures simultaneously supporting symbolic and subsymbolic representations and inference.
Learning such structures is a long-standing and important goal of artiﬁcial intelligence, which has recently gained special attention (see e.g., Manhaeve et al.
(2018); Weber et al.
; Rockt¨aschel & Riedel (2017); Evans & Grefenstette (2018)).
The challenge of learning such rules with aggregates is also a central one in much work on
KGs Gal´arraga & Suchanek (2014).
Indeed, discovering patterns by learning rules from knowledge graphs enables us to obtain concise descriptions of a domain as well as to complete and clean the data.
Especially by considering numerical values such as age, weight or experimental measurements, which are common, e.g., for scientiﬁc knowledge graphs Auer et al.
(2018), learned rules might reveal interesting correlations in the data or even lead to scientiﬁc discoveries.
Our proposed procedure is the ﬁrst approach that is capable of learning such rules (even though we of course do not allow for arbitrary aggregates, the fact that we incorporate such learning at all is a substantial contribution to the KG literature).
Because this is a key capability of our approach, in this section we further formally present the exact structure of the rules that we support and illustrate them by examples, motivating their applicability in various scenarios.
The notation and deﬁnitions here are not crucial for understanding the remainder of the paper, but will provide context and clarify the contribution of the current work from the perspective of the knowledge representation community.
A. R ULES WITH A GGREGATES
We consider aggregate atoms of the form f { Y 1 , . . .
, Y n : p 1 ( X, Y ) , . .
p n ( X, Y ) } ◦ Z , where f is an aggregate function symbol, { Y 1 , . .
, Y n : p 1 ( X, Y ) , . .
p n ( X, Y ) } is called an aggregate element, ◦ ∈ {≤ , > } and Z is a numerical value.
For any aggregate in the above form we assume that p 1 , . .
, p n ∈ R n , i.e., p 1 , . .
. , p n are numerical features of an entity X .
Example 2.
The aggregate element { Y 1 , Y 2 : citedIn ( X, Y 1 ) , singleAuthorArticles ( X , Y 2 ) } denotes the numerical feature vector containing ϕ
= ( Y 1 , Y 2 ) , where Y 1 is the number of citations X has, and Y 2 is the number of articles with X being a single author.
The function f can in principle be arbitrarily complex and can be even represented by a neural network.
In our work, as a starting point we restrict ourselves to linear functions of the following form: sigmoid ( w (cid:62) ϕ + b ) , where ϕ is the respective numerical feature vector for the target entity X .
Example 3.
Reconsider the knowledge graph in Figure 1 extended with the facts singleAuthorArticles ( pete , 6 ) ,
singleAuthorArticles ( john , 20 ) .
For the aggregate f { Y 1 , Y 2 : hasCitation ( X, Y 1 ) , singleAuthorArticles
( X, Y 2 ) } > 0 . 5 , with f being the sigmoid function of the above form, suppose that w = (1 , 10) and b = 200 .
We have ϕ =
for X = pete and ϕ
= (124 , 8) for X = john .
Since 50 + 6 · 10 − 200 < 0 . 5 , for pete the respective aggregate atom evaluates to false, while for john it is true, which is easy to verify based on analogous computations.
In this work we have described procedures for learning rules that have the following form
[Equation]
where p 1 ( Y, X ) is an atom , and every q n ( Y, Z n ) , .
. . , q 1 ( Z 1 , X ) is either an atom , a negated atom , an aggregate atom of the form f { Y 1 , . .
, Y m : p 1 ( X 1 , Y m ) , . . .
, p m ( X 1 , Y m ) } ◦ 0 .
5 , ◦ ∈ {≤ , > } with p 1 , . . .
p m ∈ R n and f being a sigmoid function or it is a comparison concunction of the form
[Equation]
where ◦ ∈ {≤ , > } and Y, Z are present in some rule body atom elsewhere.
As described in Section 4 the above condition that Y, Z must be connected via some relation ensures that the entities that participate in the comparison are semantically related to each other, which is needed to avoid irrelevant comparisons.
Example 4.
Consider the following rule
[Equation]
Intuitively, the aggregate function computes a certain index for a person based on the number of his citations and the number of publications, with him being a single author.
The rule states that people with an index above a certain threshold supervise only top students of the university with which they are afﬁlliated.
The following expression demostrates rule with a comparison atom:
[Equation]
This rule states that students are typically inﬂuenced by colleagues of their supervisors with a higher number of citations.
The expression r ≤ hasCitation ( Y, Z ) can be used as a shortcut for the last three atoms in the body of the above rule.
A. E XECUTION OF R ULES WITH A GGREGATES
The execution of rules with negation and aggregates that we focus on is deﬁned in the standard way (see Faber et al.
(2011); Eiter et al.
(2012) for details).
More precisely, let G be a KG, r a rule over G , and a be a standard atom from G .
Then, rule | =
G a holds if there is a variable assignment that maps atoms in the positive part of rule body ( body + rule ) in G such that it does not map any of the atoms in the negative part of rule body ( body − rule ) in G .
For aggregate atoms a we have that rule | =
G a
if the value of the respective aggregate function on the KG satisﬁes the given inequality constraint.
G r =
G ∪ { a | r | = G a } extends G with atoms derived from G by applying r .
Note that to avoid propagating uncertain predictions, given a set of rules R we execute every rule in R on G independently, i.e .
G R = (cid:83) r ∈ R G r .
Given additional syntactic restrictions on rules in R , which disallow cycles through negation consistency is ensured.