Walk-and-Relate: A Random-Walk-based Algorithm for Representation Learning on Sparse Knowledge Graphs
Abstract.
Knowledge graph (KG) embedding techniques use structured relationships between entities to learn low-dimensional representations of entities and relations. The traditional KG embedding techniques (such as TransE and DistMult) estimate these embeddings via simple models developed over observed KG triplets. These approaches differ in their triplet scoring loss functions. As these models only use the observed triplets to estimate the embeddings, they are prone to suffer through data sparsity that usually occurs in the real-world knowledge graphs, i.e., the lack of enough triplets per entity. In this paper, we propose an efficient method to augment the number of triplets to address the problem of data sparsity. We use random walks to create additional triplets, such that the relations carried by these introduced triplets correspond to the metapath (composition of the sequence of underlying relations) induced by the random walks. We also provide approaches to accurately and efficiently choose the informative metapaths from the possible set of metapaths, generated by the random walks. The proposed approaches are model-agnostic, and the augmented training dataset can be used with any KG embedding approach out of the box. Experimental results obtained on the benchmark datasets show the advantages of the proposed approach.
1. Introduction
Knowledge graphs (KGs) are data structures that store information about different entities (nodes) and their relations (edges). They are used to organize information in many domains such as music (Fell et al., 2022), movies (Orlandi et al., 2018), (e-)commerce (Zalmout et al., 2021), and sciences (Ioannidis et al., 2020). A common approach of using KGs in various information retrieval and machine learning tasks is to compute knowledge graph embeddings (KGE) (Wang et al., 2017; Goyal and Ferrara, 2018). These approaches embed a KG’s entities and relation types associated with an edge into a -dimensional space such that the embedding vectors associated with the entities and the relation types satisfy a pre-determined mathematical model. Numerous models for computing knowledge graph embeddings have been developed, such as TransE (Bordes et al., 2013), TransR (Lin et al., 2015) and DistMult (Yang et al., 2014).
There are many possible facts and relations in the real world, but collecting them can be challenging; consequently, existing knowledge graphs lack completeness. Learning embeddings for entities and relations in knowledge graphs can be considered knowledge induction, and the induced embeddings can be used to infer new triplets in the knowledge graph. The embedding quality is heavily reliant on the quantity and quality of the underlying triplets. This makes obtaining meaningful embeddings from sparse KG difficult, because of the lack of enough number of triplets per entity or relation. In addition, KG embedding approaches that use negative sampling encounter increased false negative rate in the chosen negative samples when dealing with sparse KGs. Negative sampling is performed by creating synthetic observations (relating two entities using a relation) such that the created observation is not observed in the training data. The chances of selecting an actual positive observation as a negative sample is higher with a sparse KG.
One solution to address the sparsity of triplets is to perform data augmentation. Various forms of data augmentation are possible. For example, prior approaches have explored augmenting the KG triplets with text corpus (Wang et al., 2016; Ho et al., 2018), using schema and semantic constraints (Xie et al., 2016; Krompaß et al., 2015), using inference rules on the KG (Guo et al., 2016; Zhang et al., 2019; Zhao et al., 2020; Ho et al., 2018), etc. The approaches proposed in this paper resemble the ones that leverage the KG inference rules (multi-hop reasoning, in particular) to augment the KG triplets. Specifically, multi-hop reasoning is the task of learning explicit inference patterns in a KG. For example, if the KG includes the facts such as b is a’s mother, c is b’s husband, we want to learn the following pattern: LHS: isMother(a, b) isHusband(b, c) RHS: isFather(a, c). Various approaches leverage such reasoning to expand the set of KG triplets, and hence, learn higher quality embeddings. The question we answer is: what if the isFather relation (RHS in the above pattern) is not present in the KG? Could we still leverage the composite relation isMother(a, b) isHusband(b, c) (LHS in the above pattern) to augment the triplets? This paper proposes a solution in this direction. Our proposed approach performs data augmentation predicated on composite relations, even if the composite relations could not be mapped to existing relations.
Specifically, we provide approaches that use random walks to efficiently and accurately estimate informative (multi-hop) composite-relations (also called metapaths) in the KG. Each metapath can be effectively considered a new relation in the KG, thus augmenting the number of triplets in the KG. However, the difficulty in considering each metapath as a separate relation lies in the exponential size of the search space: the number of possible metapaths increases as we increase the length of the metapath. To this end, we also provide various approaches that allow parameter sharing among the relations, thus alleviating the curse of dimensionality incurred because of the exponential search space. In summary, the main contributions are as follows:
-
•
We propose a quantitative way to measure the metapath information, i.e., the information encoded by a metapath.
-
•
We introduce computationally efficient and accurate approaches to use random walks to estimate informative metapaths in the KG and use them to augment the KG triplets.
-
•
We provide various parameter sharing approaches to tackle the curse of dimensionality induced by the exponential search space of the possible metapaths.
-
•
We experimentally evaluate the performance of proposed framework on different knowledge graph benchmarks. The proposed approach outperforms the baselines.
The rest of the paper is organized as follows. We discuss the related work in Section 2, followed by the background and notation in Section 3. In Section 4, we describe the details of the proposed Walk-and-Relate method. We describe our evaluation methodology in Section 5. Finally, we present experimental results in Section 6 and conclude our discussion in Section 7.
2. Related work
The research areas relevant to the work present in this paper belong to Knowledge Graph Embeddings, Inference Rule Mining, and Data Augmentation for KGE approaches. We discuss these areas below:
2.1. Knowledge Graph Embeddings
Knowledge graph embedding (KGE) is a machine learning task of learning a low-dimensional representation of a knowledge graph’s entities and relations while preserving their semantic meaning. Leveraging their embedded representation, knowledge graphs (KGs) can be used for various applications such as link prediction, triple classification, entity recognition, clustering, and relation extraction (Ji et al., 2015; Abu-Salih et al., 2021). KGE differs from ordinary relation inference as the information in a knowledge graph is multi-relational and more complex to model and computationally expensive. Many models have been devoted to estimating KGE. Some translation-based embedding models, such as TransE (Bordes et al., 2013), TransH (Wang et al., 2014), TransR (Lin et al., 2015) and TransD (Ji et al., 2015) apply simple linear or bilinear operations to model the embeddings of entities and relations. DistMult (Yang et al., 2014) and ComplEx (Trouillon et al., 2016) design similarity scoring functions to learn semantic information. ConvE (Dettmers et al., 2018) and ConvKB (Nguyen et al., 2017) apply convolutional neural network to learn non-linear features.
In addition, there are approaches that tackle representation learning on homogeneous graphs, i.e., graphs with just one type of relation. Examples include DeepWalk (Perozzi et al., 2014) and node2vec (Grover and Leskovec, 2016). These approaches are based on random walks for embedding generation. For each node in the graph, these models generate a random path of connected nodes. The random path gives a sequence of nodes, and we can train models like Word2Vec (skip-gram) (Mikolov et al., 2013) to obtain the node embeddings. The approaches presented in this paper are motivated from these random-walk based embedding generation approaches.
2.2. Rule mining
Rule mining in KGs finds rules such as isMarried(a,b) staysTogether(a,b). Approaches like Inductive Logic Programming (ILP) and AMIE (Galárraga et al., 2013) are popular choices for learning such rules. AMIE is an improved version of a fuzzy Horn rule-mining algorithm based on inductive logic programming (ILP). It overcomes the difficulty of traditional rule-mining algorithms in generating negative evidence on the basis of the open-world assumption. However, the difficulty in finding such rules lies in the exponential size of the search space: every relation can potentially be combined with every other relation in a rule. To tackle this, several extensions of the AMIE have been proposed (Galárraga et al., 2015; Lajus et al., 2020).
One particular type of rule mining finds its use in the multi-hop reasoning. Multi-hop reasoning is the task of learning explicit inference patterns in a KG. For example, if the KG includes the facts such as b is a’s mother, c is b’s husband, we want to learn the following rule (pattern): isMother(a, b) isHusband(b, c) isFather(a, c). Path-Ranking Algorithm (PRA) (Lao et al., 2011) is a popular algorithm for estimating such patterns in KGs. Lao et al. (2011) uses a soft inference procedure based on a combination of constrained, weighted, random walks through the knowledge base graph to infer rules for the KG. Their solution can learn to infer different target relations by tuning the weights associated with random walks that follow different paths through the graph, using a version of the PRA.Wang and Li (2015) proposes a rule learning approach RDF2Rules for RDF KGs. Rules are learned by finding frequent predicate cycles in RDF graphs. A new confidence measure is also proposed for evaluating the reliability of the mined rules.Barati et al. (2016) intro an approach called SWARM (Semantic Web Association Rule Mining) to mine semantic association rules from RDF KG. SWARM leverages the schema information to enrich the semantics of the rules. (Xiong et al., 2017) proposes a reinforcement learning framework to find reasoning paths in the KG. Unlike random walk-based models, the RL model allows to control the properties of the found paths. These effective paths can also be used as an alternative to PRA in many path-based reasoning methods.
2.3. Data augmentation for KGE
Various approaches have been developed to augment the KG data. We summarize such approaches in this section. Wang et al. (2016) augments the KG data with a text corpus. Specifically, they introduce additional text-based information and performed joint model training by combining triplets from a knowledge graph with entity descriptions in text. Guo et al. (2016) proposed a method that embeds rules and triplets jointly. This method learns rules based on the TransE model and retrains the embeddings combined with rules. Zhang et al. (2019) proposed IterE, to alleviate the sparsity of entities in KG. In this framework, embeddings and rules are learned iteratively; the embeddings are learned from existing triplets, and new triplets are inferred from the rules that have been learned. Zhao et al. (2020) iteratively trains embeddings and discovers patterns between relations to construct new triplets. For example, the model can discover the pattern that is the inverse relation of . If the KG contains the triplet , then according to the discovered rules, the model can infer another triplet, . Ho et al. (2018) iteratively extends rules induced from a KG by relying on feedback from a precomputed embedding model over the KG and external information sources including text corpora.Xie et al. (2016) adds entity-level information into the representation learning model by using an encoder. This approach can be used to create fused semantic vectors for entities at different levels to improve the representation effect. Krompaß et al. (2015) adds prior knowledge about the semantics of relation-types, extracted from the schema of the knowledge graph (type-constraints) or approximated through a local closed-world assumption, to the representation learning model. Only triplets that satisfy the type constraints are considered for modelling; thus, irrelevant or erroneous samples can be effectively filtered out to a certain extent.
3. Definitions and Notations
Symbol | Description |
---|---|
A (knowledge) graph. | |
Set of nodes or entities in the graph . | |
Set of edges in the graph . | |
Set of node types in the graph . | |
Set of edge types in the graph . | |
A metapath in the graph , having the edge-type sequence , where is the length of the metapath. | |
Type mapping function , that maps a node to its corresponding type in the graph . | |
Type mapping function , that maps an edge to its corresponding type in the graph . | |
Number of distinct metapaths of type that the edge is a part of in the graph . | |
Association measure, defined as the fraction of edges of the type that are a part of the metapath instance for the metapath . | |
Metapath information for the metapath . | |
Rule-confidence for the rule , defined as the fraction of node pairs such that the triplet exists given that the path exists. | |
Representation (embedding) of where is an entity, relation or basis vector. |
A graph is composed of nodes and edges , where is the set of nodes and is the set of edges. A knowledge graph (KG) is a special type of graph whose nodes and edges have types. A node in a knowledge graph represents an entity and an edge represents a relation between two entities. The edges are in the form of triplets , which indicates that a pair of entities (head) and (tail) are connected to each other via a relation (edge-type) . Each node and each edge are associated with their type mapping functions and , respectively. A metapath on the knowledge graph is defined as a sequence of relations (edge-types) , which describes a composite relation . Given a metapath , a metapath instance of is defined as a node and edge sequence in the graph following the sequence of relations defined by . The notation used in this paper is summarized in the Table 1.
4. Proposed Approach: Walk-and-Relate (WAR)
Walk-and-Relate (WAR) uses short random walks to construct sequences of connected nodes in the KG. Similar to Deepwalk (Perozzi et al., 2014), the random walk samples uniformly from the neighbors of the last vertex visited until the maximum length () is reached111In principle, there is no requirement for the random walks to be of the same length and we can have restarts in the random walks. For each node in the graph, WAR performs a random walk, thus sampling a random path of nodes connected to it. For each pair of nodes in this random walk, we can effectively consider them neighbors in the graph, associated by a metapath (composite relation). Thus, we use these pair of nodes, along with the associated metapath to construct additional triplets and augment the training dataset for KG embeddings. While the nodes in the augmented triplets can be directly used by the triplet scoring function of the desired KG embedding method, there are some unknowns regarding how to use the metapaths. Particularly:
-
•
Does the composite relation described by the metapath provide any additional information? Augmenting with non-informative metapaths could bring undesired noise to the training triplets. The is expected to be the case as the number of possible metapaths grows exponential with the length of random-walk. To address this, we take motivation from the vast literature on association mining, and provide approaches to efficiently mine informative metapaths and quantify the information provided by them (details in Section 4.1).
-
•
How do we represent the metapath as a single relation which is a requirement for KG embedding models based on triplet scoring? For each selected informative metapath (), we check if the metapath can be confidently mapped to one of the existing relations in the KG (rule-mining: ). If yes, we use the corresponding rule to generate new triplets for the relation (Note that this step is similar to earlier approaches). Details on rule-mining are covered in Section 4.2. If the metapath cannot be confidently mapped to one of the existing relations, each metapath is effectively considered as new relation in the KG. However, the difficulty in considering each metapath as a separate relation lies in the exponential size of the search space. To address this curse of dimensionality, we provide multiple solutions based on generalization via parameter sharing (details in Section 4.3).
The next sections cover the WAR framework in detail.
4.1. How informative is a metapath?
We borrow ideas from the association rule mining literature (Agrawal et al., 1993) to measure the information conveyed through a metapath, which we call metapath-information. First, we define a association measure, denoted by , that measures how often an edge with type is a part of an metapath instance of type . Similar to the confidence measure used in the association rule mining, we define the as the fraction of edges of the type that are a part of the metapath instance for the metapath . Formally, the definition is given as
(1) |
where denotes the distinct metapath instances of type that the edge is a part of in the graph . Next, we define the metapath-information of the metapath as the product of the association measures of each of its constituent relations . Formally, we denote the metapath-information of as and calculate it as
(2) |
Estimation of requires enumeration of all the metapath instances of . Trivial enumerating these metapath instances would lead to a time and space complexity of the order of . The exponential complexity raises scalability concerns, and prohibits from estimating the metapath importance for graphs with large number of edges.
In this direction, we provide two heuristics to address the scalability problems. First, we provide an approach to prune the exploration space of the candidate metapaths, that leverages the downward-closure property of the metapath-information. Second, we provide an approach to estimate the metapath-information on a sampled graph.
4.1.1. Pruning the exploration space
Our goal is to select the informative metapaths, and not to calculate the metapath-information of all possible metapaths. Thus, we employ a pruning strategy, i.e., not compute for a metapath if we have evidence that is less than a threshold. We leverage the downward-closure property of the metapath-information to compute this evidence.
Lemma 4.1.
metapath-information is downward-closed (anti monotonic), i.e., if and , then .
Proof: Each metapath instance of type can be mapped to a metapath instance of type , by removing the edge of relation . Thus,
(3) |
(4) |
Next, the metapath-information is expressed as
(5) |
(6) |
As a fraction, the association . Thus,
(7) |
Following the above downward-closure property, we only need to expand the exploration space to consider the metapath only if the metapath is informative ( is above a threshold).
4.1.2. Estimation on a sampled graph
Instead of estimation on the full-graph, we sample the edges from the graph, and estimate the metapath-information from there. However, metapath-information estimated from the sampled graph (with randomly sampled edges) is lower (thus, not representative) than the metapath-information on the full graph222In principle, the very notion of missing edges in a KG means that KG itself has sampled edges from the complete KG, which we don’t have access to. Thus, the metapath-information estimated from a given KG is a lower-bound on the ”ideal” metapath-information.. This is because the numerator in the Equation 1 decays faster with sampling as compared to the denominator. To address this difference, we introduce a correction factor that allows us to estimate the metapath-information on the full KG, using the sampled KG.
Given an edge of type , it does not belong to any metapath instance of type (i.e., ) if one of the following conditions hold:
-
•
does not belong to any metapath instance of type in the original unsampled graph, i.e., . The probability of this condition holding is
(8) where denotes the sampling probability. i.e.,
-
•
belongs to one or more metapath instance of type in the original unsampled (full) graph, i.e., , but each of those metapath instances do not appear in the sampled graph. This is possible if at least one of the constituent edges of those metapath instances (apart from ) is removed because of sampling. The probability of this condition holding is
(9)
Combining the above two conditions, and aggregating over the observed number of edges of type in the sampled graph () that do not belong to any of the metapath instance of type , we get:
(10) |
To simplify the above formulation, we make following three observations:
-
(i)
Assuming is uniformly distributed333The assumption gives a lower bound (following the AM-GM inequality property) across the edges, we get
(11) where is the number of metapaths instances of type in the graph . Further, for a metapath instance present in the unsampled graph, the probability of it present in the sampled graph is . Thus, .
-
(ii)
For any metapath instance present in the unsampled graph, the probability of it present in the sampled graph is . Thus, .
-
(iii)
Being a part of an metapath instance or not is both mutually exclusive and exhaustive. Thus,
(12)
Substituting the above observations in Equation 10 gives us
(13) |
where . Except , all other variables are observed or hyperparameters () in the Equation 13. Thus, various root-finding algorithms could be used to find the optimal value of that satisfy Equation 13, such as Brent’s (Brent, 1971) and Golden-section search (Kiefer, 1953). The solution is then substituted for the numerator in the Equation 1 to get the corrected association measure , and thus accurately estimate the metapath-information .
Algorithm 1 provides the pseudo-code for estimating the informative metapaths.
4.2. How to map the informative metapath to relations in the graph?
For the augmentation triplets to be used by the desired KG embedding approach that uses triplet scoring functions, we represent the metapath as a single relation in the KG. To address this, we mine rules of the form , using the standard notion of confidence used in the association rule mining. Specifically, we define the rule confidence (denoted by ) for the rule as the fraction of node pairs such that the triplet exists given that the path exists. Formally,
(14) |
For a metapath , we denote the as the mapping that holds the key-value pairs []. Since we are only interested in high-confidence rules, we add a minimum threshold on the for [] to be added to (say, ).
Next, for each informative-metapath , we map it to an individual relation with the following setup:
-
(i)
If the is non-empty, we sample a relation out of , with the sampling probability . The sampling is done independently for each augmentation triplet on course of the training.
-
(ii)
If the is empty, we simply introduce a new relation for the metapath in the KG.
4.3. Generalization with parameter sharing
If a metapath cannot be mapped to existing relations in the KG, we introduce a new relation describing the metapath in the KG. The increase in the number of unique relations would lead to rapid growth in number of parameters (relation embeddings). Specifically, the number of parameters rises exponentially (in terms of number of original relations in the graph) with the lengths of the considered metapaths. In practice this can easily lead to over-fitting on rare metapaths (which counters our primary goal of addressing data-sparsity). To address this problem, we propose various approaches to allow parameter sharing among the embeddings for the metapaths, thus limiting the number of unique parameters and allowing for better generalization.
4.3.1. Using composition properties of the underlying model
Models such as TransE (Bordes et al., 2013) and RotatE (Sun et al., 2019) have triplet scoring functions that enable them to infer the composition patterns. For example, given the metapath , its representation is computed as under the assumptions of the TransE model. Similarly, the representation under the assumptions of the RotatE model is given as , where is the Hadmard (or element-wise product). Thus, we simply use the representations of the constituent relations to infer the representation of the new relation describing the metapath, without introducing any additional parameters. Note that this approach can only be applied to models that allow inference of the composition patterns.
4.3.2. Using parametric sequence models to represent the metapath
Parametric sequence models such as Recurrent Neural Network (RNN) are employed to generate the representation of the metapath by using the sequence of representations of the constituent relations. The only additional parameters that are introduced by this approach are the ones corresponding to the sequence model (RNN), which is a constant overhead. The RNN parameters are estimated using back-propagation from the triplet scoring loss function of any KGE model.
4.3.3. Using basis decomposition
Similar to Relational Graph Convolutional Network (R-GCN) (Schlichtkrull et al., 2018), we use basis-decomposition as a way to share parameters among the representations for relations (and metapaths). With basis decomposition, the representation is defined as follows:
(15) |
i.e. we calculate the representation as a linear combination of basis transformations with coefficients such that only the coefficients depend on . This approach does introduce additional parameters that grow exponentially with the lengths of the considered metapaths, but the number of coefficients are much smaller in size as compared to the representation size.
4.4. Putting it all together
Given the set of informative metapaths and associated rulemaps, we use random walks to generate instances of those metapaths on the graph. These instances are used to create augmentation triplets in the KG and are directly taken as input by any downstream KG-embedding model based on triplet scoring loss functions. The KG-embedding model, thus, has access to a larger pool of training data, effectively leading to higher-quality KG embeddings. For the KGE model to be aware of the metapath-information and rule-confidence, we use them as the edge-weight for the KGE model (edge-weights are used to scale the loss function for the corresponding triplets). Specifically, if we introduce a new relation for the metapath , we use as the edge-weight for the augmented triplets added as a result of metapath instances belonging to . Otherwise, we use as the edge-weight for the augmented triplets, where the metapath is mapped to the relation with rule-confidence . Algorithm 2 provides the pseudo-code for our algorithm Walk-and-Relate.
5. Experimental Methodology
We use the Deep Graph Library - Knowledge Embeddings (DGLKE) (Zheng et al., 2020) toolkit to bootstrap the implementation of WAR framework. DGLKE is designed for learning at scale. It provides implementations and benchmarks on widely-used and popular KGE models, making it more easier for users to apply and develop on top of those methods. We have also open-sourced the code for the WAR framework on GitHub444https://github.com/gurdaspuriya/walk-and-relate.
5.1. Datasets
Dataset | #Nodes | #Edges | #Relations |
---|---|---|---|
FB15K | 14,951 | 592,213 | 1,345 |
WN18 | 40,943 | 151,442 | 18 |


We used two standard benchmark datasets (WN18 and FB15K) to evaluate the performance of the proposed approaches and compare against the baselines. FB15k is derived from the Freebased Knowledge Graph (Bollacker et al., 2008), whereas WN18 was derived from WordNet (Miller, 1995). Table 2 shows various statistics for these datasets. Figure 1 shows the degree distribution of the two datasets. The degree distribution of FB15K is relatively more uniform (has low variance) as compared to WN18. For WN18, of the nodes have degree , and of the nodes have degree . In contrast, FB15k has of the nodes have degree , and of the nodes have degree . Both datasets and their training/validation/test splits were used as provided by the DGL-KE toolkit.
5.2. Metrics
We use three standard ranking metrics (Lerer et al., 2019) widely used in literature for evaluating the KG embeddings: Hit (for ), Mean Rank (MR), and Mean Reciprocal Rank (MRR). For a positive triplet , let be the list of triplets containing and its associated negative triplets ordered in a non-increasing score order, and let be th position in . Given that, Hit is the average number of times the positive triplet is among the highest ranked triplets; MR is the average rank of the positive instances, whereas MRR is the average reciprocal rank of the positive instances. Formally, these metrics are defined as
(16) |
(17) |
(18) |
where is the total number of positive triplets. Note that and MRR are between 0 and 1, whereas MR ranges from 1 to the .
5.3. Comparison methodology
We choose two representative KG embedding approaches based on triplet-loss functions: TransE and Distmult. TransE is a translation-based model and allows to infer compositional patterns, while Distmult is a similarity scoring-based approach. For these two approaches, we evaluate the different triplet-augmentation and parameter-sharing approaches as described below:
-
(1)
No augmentation: The models are trained on explicit triplets present in the graph, and thus, no augmentation is done.
-
(2)
WAR - Only rules: To show the promise of proposed augmentation approaches over earlier approaches that only leverage rules of the form , we provide results on an augmentation exercise where we only add additional triplets based on mapping the metapaths to the existing relations in the graph (to mimic the prior approaches).
-
(3)
WAR - Metapaths + No parameter sharing (WAR + MP): This approach performs augmentation with the discovered informative-metapaths, by introducing a new relation for each metapath, i.e, without any parameter sharing among the metapath (relation) embeddings.
-
(4)
WAR - Metapaths + parameter sharing using model’s composition properties (WAR + MP + Model): This approach performs augmentation with the discovered informative-metapaths, and uses the relation embeddings to compute the metapath embeddings based on the underlying composition model. Note that this approach cannot be used for DistMult as it does not allow inference of the composition patterns.
-
(5)
WAR - Metapaths + sequence modeling for metapath (WAR + MP + RNN): This approach performs augmentation with the discovered informative-metapaths, and uses RNN as the sequence model to aggregate the representations of the constituent relations into the representation of the metapath.
-
(6)
WAR - Metapaths + basis decomposition (WAR + MP + Basis): This approach performs augmentation with the discovered informative-metapaths, and uses the linear combination of a common bases to estimate the embeddings of the metapaths.
5.4. Hyperparameter selection
We use metapaths of lengths upto three () to construct augmentation triplets for the WAR approach. All approaches use the mini-batch size of nodes to construct random walks. For both WN18 and FB15K, we use the metapath-information threshold of to prune the search space. We use the full graph to estimate informative metapaths for WN18 but sample edges for FB15K (given its size). To construct the rules, the rule-confidence threshold is set to . We use random grid search to optimize for the embedding learning rate (between ), RNN learning rate (when applicable, between ), basis learning rate (when applicable, between ) and regularization norm (between ). We use different learning rates for embeddings, RNN parameters and basis parameters because RNN and basis parameters get dense updates, while embeddings get sparse updates. We use MRR as the primary metric and train the KGE models until the performance on the MRR metric does not increase in two successive epochs. All other hyperparameters are kept the same as provided by DGL-KE for each combination of triplet loss function (TransE and Distmult) and Dataset (WN18 and FB15K).
6. Results and Discussion
Tables 3 and 4 shows the performance of various approaches on the WN18 dataset, using the TransE and DistMult scoring functions, respectively. On all the metrics, the approaches that leverage data augmentation outperform the approaches without data augmentation. Particularly, we observe that levering the proposed augmentation framework (WAR) and limiting the augmentation triplets to rules (WAR - Only rules) leads to and improvement on MRR over the approach without augmentation, for the TransE and DistMult scoring functions, respectively. The improvement increases to for the TransE and for DistMult when we expand the augmentation triplets with informative metapaths, even if those metapaths cannot be mapped to existing relation in the graph, by introducing a new relation for such metapaths. This provides evidence for our hypothesis that we can leverage the composite relations (i.e., metapaths) to provide strong learning signals to the KG embedding approaches, even though we cannot learn confident rules from these metapaths.
Further, given that the number of distinct relations for WN18 is relatively small (), we do not expect the exponential search space of metapaths to play much role in dampening the performance, thus, we do not expect much performance gain with parameter sharing approaches. This is verified from the experimental results, where we observe that leveraging the parameter sharing is either better or as good as as the situation not performing parameter sharing. With parameter sharing, performance on the WN18 for TransE tends to remain similar, but we see performance gain of up to for DistMult.
Tables 5 and 6 shows the performance of various approaches on the FB15k dataset, using the TransE and DistMult scoring functions, respectively. Here, we see some different trends as compared with the WN18 dataset. Particularly, we see that using the WAR framework and limiting the augmentation triplets to rules (WAR - Only rules) does not lead to visible performance gain over the approach without augmentation. Given that FB15k is a relatively larger dataset as compared to WN18 (3X lesser nodes and 4X more edges), the limited triplets added by rule-based augmentation does not provide enough signal as compared to the already available triplets in the graph, which explains this behavior. This is also expressed by the degree distribution plots of the two datasets in Figure 1. WN18 has a much larger fraction of nodes with a small degree ( of the nodes have degree ) as compared to FB15k ( of the nodes have degree ). We see similar trend when we use augmentation triplets with informative metapaths as new relations as well. This can be attributed to large number of relations () in the FB15k dataset, which brings the curse of dimensionality given the exponential search space for metapaths. This is further evident from the performance gain with the parameter sharing strategies. Specifically, the experimental results show that leveraging the parameter sharing leads to a performance gain of and on the MRR metric for the TransE and DistMult scoring functions, respectively.
Figure 2 shows the performance metrics for the FB15k dataset and DistMult after sampling the training dataset with different sampling probabilities: (original, unsampled graph). We observe that the WAR framework provides greater benefits when sampling probabilities are lower for different metrics. The WAR framework’s metrics and those provided by the approach without data augmentation start converging as the sampling probability increases. To facilitate visualization, we also provide relative performance gains based on baseline approaches, i.e., approaches that do not incorporate any data augmentation. These results are provided in figure 3555The MR metric is unbounded, so we observe relatively high variance, and do not observe smooth patterns in the performance gain with the MR, as compared with the other considered metrics.. For example, on the MRR metric, the WAR-framework-based approaches provide more than performance gain when the training triplets are sampled with a probability of , but the gain drops to for the case when we do not perform sampling. Additionally, limiting the augmentation triplets to rules (WAR - Only rules) leads to minimal gains at , which further diminishes at higher sampling probabilities. This supports our hypothesis that we can leverage metapaths to provide strong learning signals to sparse KG embedding approaches.
The performance metrics are drastically affected by the added sparsity in the training triplets. MRR, for example, scores when trained on unsampled triplets, but this performance drops to when trained with of the training triplets. The drastic decrease is not just because of decreased training data, but because of an increased false-negative rate among the chosen negative samples. KG embedding involves negative sampling to pick out non-observed negative triplets from training data (by corrupting the entities or relations of an actual observed triplet). The chances of selecting an actual positive triplet as a negative triplet (since the positive triplet is absent from the sampled graph) increase as sparsity increases. The effect is even more pronounced with approaches that use self-adversarial negative-sampling (Sun et al., 2019). By using the KGE model predictions during training, self-adversarial negative sampling selects hard negative samples (unobserved samples that the KGE model predicts as positive). Due to the sparsity in the training triplets, the false negative rate increases, not only violating the assumptions of self-adversarial negative sampling but also causing positive triplets to be chosen as negative triplets more frequently than random triplets, which will result in poor performance.
Augmentation | MRR | MR | HITS | HITS | HITS |
---|---|---|---|---|---|
None | 0.5886 | 211 | 0.3515 | 0.8126 | 0.9435 |
WAR - Only rules | 0.5905 | 211 | 0.3548 | 0.8135 | 0.9439 |
WAR + MP | 0.6058 | 186 | 0.3841 | 0.8110 | 0.9413 |
WAR + MP + Model | 0.5970 | 195 | 0.3684 | 0.8082 | 0.9426 |
WAR + MP + RNN | 0.6047 | 176 | 0.3813 | 0.8115 | 0.9406 |
WAR + MP + Basis | 0.6041 | 190 | 0.3800 | 0.8120 | 0.9415 |
Augmentation | MRR | MR | HITS | HITS | HITS |
---|---|---|---|---|---|
None | 0.8290 | 655 | 0.7351 | 0.9204 | 0.9451 |
WAR - Only rules | 0.8302 | 665 | 0.7372 | 0.9197 | 0.9457 |
WAR + MP | 0.8315 | 555 | 0.7385 | 0.9205 | 0.9478 |
WAR + MP + RNN | 0.8399 | 571 | 0.7611 | 0.9151 | 0.9407 |
WAR + MP + Basis | 0.8353 | 592 | 0.7446 | 0.9224 | 0.9479 |
Augmentation | MRR | MR | HITS | HITS | HITS |
---|---|---|---|---|---|
None | 0.6899 | 37 | 0.5810 | 0.7734 | 0.8603 |
WAR - Only rules | 0.6899 | 37 | 0.5810 | 0.7737 | 0.8603 |
WAR + MP | 0.6843 | 39 | 0.5746 | 0.7680 | 0.8585 |
WAR + MP + Model | 0.6937 | 37 | 0.5803 | 0.7820 | 0.8735 |
WAR + MP + RNN | 0.6998 | 36 | 0.5881 | 0.7869 | 0.8766 |
WAR + MP + Basis | 0.6967 | 37 | 0.5847 | 0.7836 | 00.8753 |
Augmentation | MRR | MR | HITS | HITS | HITS |
---|---|---|---|---|---|
None | 0.7992 | 117 | 0.7595 | 0.8240 | 0.8703 |
WAR - Only rules | 0.7974 | 96 | 0.7546 | 0.8237 | 0.8748 |
WAR + MP | 0.8053 | 94 | 0.7648 | 0.8309 | 0.8761 |
WAR + MP + RNN | 0.8107 | 93 | 0.7717 | 0.8368 | 0.8765 |
WAR + MP + Basis | 0.8210 | 77 | 0.7876 | 0.8413 | 0.8795 |


7. Conclusion
In this paper, we address the challenge of data sparsity that usually occurs in real world knowledge graphs, i.e., the lack of enough triplets per entity. Specifically, we propose an efficient data augmentation approach, named Walk-and-Relate (WAR), to augment the number of triplets. WAR leverages random walks to create additional triplets, such that the relations carried by these introduced triplets entail from the metapath induced by the random walks. We also provide approaches to accurately and efficiently filter out informative metapaths from the possible set of metapaths, induced by the random walks. The proposed approaches are model-agnostic, and the augmented training dataset can be used with any KG embedding approach out of the box. Experimental results obtained on the benchmark datasets show the advantages of the proposed approach.
Our work makes a step towards going beyond inference rules to augment KGs, and envision that the proposed method will serve as a motivation to develop other solutions to address the sparsity in real world KGs.
References
- (1)
- Abu-Salih et al. (2021) Bilal Abu-Salih, Marwan Al-Tawil, Ibrahim Aljarah, Hossam Faris, Pornpit Wongthongtham, Kit Yan Chan, and Amin Beheshti. 2021. Relational learning analysis of social politics using knowledge graph embedding. Data Mining and Knowledge Discovery 35, 4 (2021), 1497–1536.
- Agrawal et al. (1993) Rakesh Agrawal, Tomasz Imieliński, and Arun Swami. 1993. Mining association rules between sets of items in large databases. In Proceedings of the 1993 ACM SIGMOD international conference on Management of data. 207–216.
- Barati et al. (2016) Molood Barati, Quan Bai, and Qing Liu. 2016. SWARM: an approach for mining semantic association rules from semantic web data. In Pacific rim international conference on artificial intelligence. Springer, 30–43.
- Bollacker et al. (2008) Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD international conference on Management of data. 1247–1250.
- Bordes et al. (2013) Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. Advances in neural information processing systems 26 (2013).
- Brent (1971) Richard P. Brent. 1971. An algorithm with guaranteed convergence for finding a zero of a function. The computer journal 14, 4 (1971), 422–425.
- Dettmers et al. (2018) Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. 2018. Convolutional 2d knowledge graph embeddings. In Proceedings of the AAAI conference on artificial intelligence, Vol. 32.
- Fell et al. (2022) Michael Fell, Elena Cabrio, Maroua Tikat, Franck Michel, Michel Buffa, and Fabien Gandon. 2022. The WASABI song corpus and knowledge graph for music lyrics analysis. Language Resources and Evaluation (2022), 1–31.
- Galárraga et al. (2015) Luis Galárraga, Christina Teflioudi, Katja Hose, and Fabian M Suchanek. 2015. Fast rule mining in ontological knowledge bases with AMIE++. The VLDB Journal 24, 6 (2015), 707–730.
- Galárraga et al. (2013) Luis Antonio Galárraga, Christina Teflioudi, Katja Hose, and Fabian Suchanek. 2013. AMIE: association rule mining under incomplete evidence in ontological knowledge bases. In Proceedings of the 22nd international conference on World Wide Web. 413–422.
- Goyal and Ferrara (2018) Palash Goyal and Emilio Ferrara. 2018. Graph embedding techniques, applications, and performance: A survey. Knowledge-Based Systems 151 (2018), 78–94.
- Grover and Leskovec (2016) Aditya Grover and Jure Leskovec. 2016. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining. 855–864.
- Guo et al. (2016) Shu Guo, Quan Wang, Lihong Wang, Bin Wang, and Li Guo. 2016. Jointly embedding knowledge graphs and logical rules. In Proceedings of the 2016 conference on empirical methods in natural language processing. 192–202.
- Ho et al. (2018) Vinh Thinh Ho, Daria Stepanova, Mohamed H Gad-Elrab, Evgeny Kharlamov, and Gerhard Weikum. 2018. Rule learning from knowledge graphs guided by embedding models. In International Semantic Web Conference. Springer, 72–90.
- Ioannidis et al. (2020) Vassilis N Ioannidis, Xiang Song, Saurav Manchanda, Mufei Li, Xiaoqin Pan, Da Zheng, Xia Ning, Xiangxiang Zeng, and George Karypis. 2020. Drkg-drug repurposing knowledge graph for covid-19. arXiv preprint arXiv: 2010.09600 (2020).
- Ji et al. (2015) Guoliang Ji, Shizhu He, Liheng Xu, Kang Liu, and Jun Zhao. 2015. Knowledge graph embedding via dynamic mapping matrix. In Proceedings of the 53rd annual meeting of the association for computational linguistics and the 7th international joint conference on natural language processing (volume 1: Long papers). 687–696.
- Kiefer (1953) Jack Kiefer. 1953. Sequential minimax search for a maximum. Proceedings of the American mathematical society 4, 3 (1953), 502–506.
- Krompaß et al. (2015) Denis Krompaß, Stephan Baier, and Volker Tresp. 2015. Type-constrained representation learning in knowledge graphs. In International semantic web conference. Springer, 640–655.
- Lajus et al. (2020) Jonathan Lajus, Luis Galárraga, and Fabian Suchanek. 2020. Fast and exact rule mining with AMIE 3. In European Semantic Web Conference. Springer, 36–52.
- Lao et al. (2011) Ni Lao, Tom Mitchell, and William Cohen. 2011. Random walk inference and learning in a large scale knowledge base. In Proceedings of the 2011 conference on empirical methods in natural language processing. 529–539.
- Lerer et al. (2019) Adam Lerer, Ledell Wu, Jiajun Shen, Timothee Lacroix, Luca Wehrstedt, Abhijit Bose, and Alex Peysakhovich. 2019. Pytorch-biggraph: A large scale graph embedding system. Proceedings of Machine Learning and Systems 1 (2019), 120–131.
- Lin et al. (2015) Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015. Learning entity and relation embeddings for knowledge graph completion. In Twenty-ninth AAAI conference on artificial intelligence.
- Mikolov et al. (2013) Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems 26 (2013).
- Miller (1995) George A Miller. 1995. WordNet: a lexical database for English. Commun. ACM 38, 11 (1995), 39–41.
- Nguyen et al. (2017) Dai Quoc Nguyen, Tu Dinh Nguyen, Dat Quoc Nguyen, and Dinh Phung. 2017. A novel embedding model for knowledge base completion based on convolutional neural network. arXiv preprint arXiv:1712.02121 (2017).
- Orlandi et al. (2018) Fabrizio Orlandi, Jeremy Debattista, Islam A Hassan, Clare Conran, Majid Latifi, Matthew Nicholson, Fahim A Salim, Daniel Turner, Owen Conlan, Declan O’sullivan, et al. 2018. Leveraging knowledge graphs of movies and their content for web-scale analysis. In 2018 14th International Conference on Signal-Image Technology & Internet-Based Systems (SITIS). IEEE, 609–616.
- Perozzi et al. (2014) Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. 2014. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining. 701–710.
- Schlichtkrull et al. (2018) Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. 2018. Modeling relational data with graph convolutional networks. In European semantic web conference. Springer, 593–607.
- Sun et al. (2019) Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. 2019. Rotate: Knowledge graph embedding by relational rotation in complex space. arXiv preprint arXiv:1902.10197 (2019).
- Trouillon et al. (2016) Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. 2016. Complex embeddings for simple link prediction. In International conference on machine learning. PMLR, 2071–2080.
- Wang et al. (2017) Quan Wang, Zhendong Mao, Bin Wang, and Li Guo. 2017. Knowledge graph embedding: A survey of approaches and applications. IEEE Transactions on Knowledge and Data Engineering 29, 12 (2017), 2724–2743.
- Wang and Li (2015) Zhichun Wang and Juanzi Li. 2015. RDF2Rules: Learning rules from RDF knowledge bases by mining frequent predicate cycles. arXiv preprint arXiv:1512.07734 (2015).
- Wang et al. (2016) Zhigang Wang, Juanzi Li, Zhiyuan Liu, and Jie Tang. 2016. Text-enhanced representation learning for knowledge graph. In Proceedings of International Joint Conference on Artificial Intelligent (IJCAI). 4–17.
- Wang et al. (2014) Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. 2014. Knowledge graph embedding by translating on hyperplanes. In Proceedings of the AAAI conference on artificial intelligence, Vol. 28.
- Xie et al. (2016) Ruobing Xie, Zhiyuan Liu, Maosong Sun, et al. 2016. Representation Learning of Knowledge Graphs with Hierarchical Types.. In IJCAI, Vol. 2016. 2965–2971.
- Xiong et al. (2017) Wenhan Xiong, Thien Hoang, and William Yang Wang. 2017. Deeppath: A reinforcement learning method for knowledge graph reasoning. arXiv preprint arXiv:1707.06690 (2017).
- Yang et al. (2014) Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. 2014. Embedding entities and relations for learning and inference in knowledge bases. arXiv preprint arXiv:1412.6575 (2014).
- Zalmout et al. (2021) Nasser Zalmout, Chenwei Zhang, Xian Li, Yan Liang, and Xin Luna Dong. 2021. All You Need to Know to Build a Product Knowledge Graph. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining. 4090–4091.
- Zhang et al. (2019) Wen Zhang, Bibek Paudel, Liang Wang, Jiaoyan Chen, Hai Zhu, Wei Zhang, Abraham Bernstein, and Huajun Chen. 2019. Iteratively learning embeddings and rules for knowledge graph reasoning. In The World Wide Web Conference. 2366–2377.
- Zhao et al. (2020) Feng Zhao, Haoran Sun, Langjunqing Jin, and Hai Jin. 2020. Structure-augmented knowledge graph embedding for sparse data with rule learning. Computer Communications 159 (2020), 271–278.
- Zheng et al. (2020) Da Zheng, Xiang Song, Chao Ma, Zeyuan Tan, Zihao Ye, Jin Dong, Hao Xiong, Zheng Zhang, and George Karypis. 2020. Dgl-ke: Training knowledge graph embeddings at scale. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval. 739–748.