# Measuring the Inferential Values of Relations in Knowledge Graphs
## 4 The Proposed Approach
### Calculation of Relation Entropy in RIMIE  
To calculate the relation entropy, the concept of logical relation information table (LRIT) needs to be proposed firstly, which is the data basis for RIMIE. LRIT is essentially a dataset in the form of \((U,R)\) according to Definition 1, in which \(U\) is composed of the inference chains and \(R\) is a set of the relation. For example, Table 1 shows an instance of LRIT, in which each inference chain has the same series of relations; however, the values of inference chains may differ on the relations. The value of the relation may be some characteristic of the relation in the inference chain. For instance, in Table 1, \(r_{1}(x_{1})=2\) represents that the relation \(r_{1}\) has a value of 2 on logical inference chain \(x_{1}\). More specifically, in Figure 2, the relation \"monitored\" represents the two relation values of \"2024-006-21 09:12:00\" and \"2024-06-22 13:14:00\". RIMIE employs the uncertainty measurement methods in knowledge bases to assess the inferential values of relations in KGs. In inference processes, an inference chain can be seen as a series of steps, in which an error at any step may lead to the results completely divergent from the correct answers. Therefore, considering the effect of relations in each logical inference chain is crucial for accurately measuring their inferential values. On the other hand, if a relation \(r\) in a knowledge graph is more important for the downstream logical inference, the uncertainty associated with \(r\) should be greater. This means that at each step of a logical inference chain, considering \(r\) should bring greater benefits, and ignoring \(r\) may incur more losses. RIMIE proposes a measurement method of relation inferential value based on relation entropy. In an inference chain, the inferential value of a relation \(r\) depends on the relation dimensions of \(r\) in a knowledge graph. RIMIE partitions the samples in the LRTT based on the attribute values of \(r\), and a knowledge structure, denoted by \(\chi(r)=\{X_{1},X_{2},\ldots\}\), is obtained. For each equivalence class \(X_{i}\in\chi(r)\), the samples in \(X_{i}\) have the same attribute values on relation \(r\), and the number of equivalence classes represents the attribute dimensions of the relation. The probability distribution of equivalence classes in \(\chi(r)\) can be constructed by  
\[P=\{P(X_{i})|X_{i}\in\chi(r)\}. \tag{7}\]  
Correspondingly, the relation entropy is calculated by  
\[\mathcal{H}\big{(}\chi(r)\big{)}=-\sum_{P(X_{i})\in P}\big{(}P(X_{i})\log P(X_ {i})\big{)}, \tag{8}\]  
where \(P(X_{i})=|X_{i}|/|U|\). An instance of the calculation process of relation entropy is shown in Figure 4.  
In this study, the relation entropy reflects the importance of the relation from the inferential value. Its physical meaning is as follows: given a relation \(r\), how much uncertainty does relation \(r\) introduce to the logical reasoning, and how much uncertainty can be reduced by removing relation \(r\). The finer the partitioning of the sample set \(U\) by a specific relation, the greater the number of equivalence classes, and then relation \(r\) has more feature dimensions and a larger range of values. Correspondingly, the determination of a specific relation (i.e., the selection of an inference step) has greater uncertainty, or there is greater relation entropy. According to Remark 2, the value of relation entropy should be between \(0\) and \(\log n\), corresponding to the two extreme cases. One case is when the number of equivalence classes is equal to the number of samples; this indicates that relation \(r\) has different values in different logical inference chains. According to Formula (8), the maximum entropy is \(\log n\). Another case is that the relation \(r\) has the same value on every logical inference chain. This means that one equivalence class covers all samples and thus the relation has the same effect on different inference chain.