A relationship mining method, device and equipment and readable storage medium

CN115982289BActive Publication Date: 2026-08-28STATE GRID BUSINESS BIG DATA CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211656238.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-22
Publication Date
2026-08-28
Estimated Expiration
2042-12-22

AI Technical Summary

Technical Problem

传统电网数据的存储方法主要使用企业级关系型数据库实现物理存储,主要存在的问题是支持的数据规模比较小、存储系统的扩展性较差、查询和复杂数据分析性能低下等

Benefits of technology

[0046]由上述技术方案可以看出,本申请实施例提供的关系挖掘方法、装置、设备及可读存储介质,获取待测实体对和待测实体对的关系路径,待测实体对的关系路径为从待测头实体指向待测尾实体经过的边表示的关系的有序集合。将待测实体对和待测实体对的关系路径输入至待测关系的挖掘模型,得到待测关系的挖掘模型输出的挖掘结果,其中,待测关系的挖掘模型用于依据待测实体对的关系路径以及预设实体类型的权重参数,获取待测实体对对应于各条关系路径的特征值,基于各个特征值获取待测头实体和待测尾实体之间待测关系成立的概率,并将待测关系成立的概率作为挖掘结果输出。可见,本申请将实体类型的影响计入特征值的计算过程,消除了无关实体对特征值的不合理影响,提高特征值计算的合理性,进一步提高了挖掘结果的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982289B_ABST
    Figure CN115982289B_ABST
Patent Text Reader

Abstract

The application discloses a relationship mining method and device, equipment and a readable storage medium, which can be applied to the field of artificial intelligence or the field of finance. A to-be-tested entity pair and a relationship path of the to-be-tested entity pair are acquired, the relationship path of the to-be-tested entity pair is an ordered set of relationships represented by edges passing through from a to-be-tested head entity to a to-be-tested tail entity. The to-be-tested entity pair and the relationship path of the to-be-tested entity pair are input into a to-be-tested relationship mining model, and a mining result output by the to-be-tested relationship mining model is obtained. Since the to-be-tested relationship mining model is used to acquire characteristic values corresponding to each relationship path of the to-be-tested entity pair according to the relationship path of the to-be-tested entity pair and a weight parameter of a preset entity type, the influence of the entity type is taken into account in the calculation process of the characteristic values, unreasonable influence of irrelevant entity pair characteristic values is eliminated, the rationality of characteristic value calculation is improved, and the accuracy of the mining result is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a relation mining method, apparatus, device, and readable storage medium. Background Technology

[0002] The storage of power grid data is the prerequisite and foundation for various data analyses, directly impacting the performance, accuracy, and availability of subsequent applications such as query analysis, information mining, and status assessment. Traditional power grid data storage methods primarily utilize enterprise-level relational databases for physical storage, which suffers from limitations such as limited supported data size, poor scalability of the storage system, and low performance in querying and complex data analysis.

[0003] Knowledge graphs, acting as the brain of artificial intelligence, have been widely applied in fields such as search engines, public security, finance, and healthcare. Therefore, constructing knowledge graphs based on power grid data is a crucial means to address the low storage efficiency of traditional power grid data. However, with the increasing complexity of power grid data structures and the daily growth in data volume, the scale of knowledge graphs based on power grid data is gradually expanding. How to accurately extract potential relationships between power grid data points from knowledge graphs is a pressing issue that needs to be addressed. Summary of the Invention

[0004] This application provides a relationship mining method, apparatus, device, and readable storage medium, as follows:

[0005] A relation mining method includes:

[0006] Obtain a pair of entities to be tested, the pair of entities to be tested including a head entity to be tested and a tail entity to be tested;

[0007] Based on a pre-constructed knowledge graph, the relational path of the entity pair to be tested is obtained. The relational path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity.

[0008] The entity pair to be tested and its relationship path are input into the mining model of the relationship to be tested, and the mining results output by the mining model of the relationship to be tested are obtained.

[0009] The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result.

[0010] Optionally, obtaining the feature values ​​of the entity pair to be tested corresponding to each relation path based on the relation path of the entity pair to be tested and the weight parameters of the preset entity type includes:

[0011] Based on the improved recursive operation formula, the feature values ​​of the entity pair to be tested corresponding to the relation path are obtained. The improved recursive operation formula is obtained by assigning a preset entity type weight parameter to each walking entity at each step of the path ranking learning algorithm.

[0012] Optionally, obtaining the probability that the relationship to be tested between the head entity and the tail entity to be tested is true based on each feature value includes:

[0013] Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training.

[0014] Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

[0015] Optionally, this method also includes:

[0016] Based on the knowledge graph, obtain the training data set for the relationship to be tested;

[0017] The training data set of the relationship to be tested includes multiple training data sets. The training data includes training entity pairs, relationship paths of the training entity pairs, and relationship labels of the training entity pairs. The training entity pairs include training head entities and training tail entities. The relationship path of the training entity pairs is an ordered set of relationships traversed from the training head entity to the training tail entity. The relationship labels of the training entity pairs are used to indicate whether the training head entity and the training tail entity have the relationship to be tested.

[0018] The training entity pairs and their relationship paths are input into the classification model, so that the classification model iteratively executes the parameter update process until the preset training conditions are met, thereby obtaining the mining model of the relationship to be tested.

[0019] The parameter update process includes:

[0020] Based on the improved recursive calculation formula and the weight parameters of the preset entity type, the feature values ​​of the training entity pairs corresponding to each relation path are obtained.

[0021] The confidence level of the training entity pair is obtained based on each feature value. The confidence level is used to characterize the probability that the test relationship between the training head entity and the training tail entity is true.

[0022] The confidence level of each training entity pair is used as the predicted value, and the relation label of each training entity pair is used as the true value. The preset model parameters are updated using a preset loss function, and the model parameters include the weight parameters of the preset entity type.

[0023] Optionally, the model parameters also include weight parameters for preset relational paths;

[0024] The step of obtaining the confidence level of the training entity pairs based on each feature value includes:

[0025] Based on the weight parameters of the relational paths of the training entity pairs, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the training entity pairs.

[0026] The confidence level of the training entity pair is obtained based on the Logistic function and the feature scores of the training entity pair.

[0027] Optionally, this method also includes:

[0028] Acquire power grid data, which includes power data and business data;

[0029] The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data.

[0030] The data to be processed is stored in a relational database according to a multi-modal data storage method;

[0031] Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples;

[0032] The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set.

[0033] The knowledge graph is constructed based on the triple dataset.

[0034] Optionally, generating triples of the data to be processed based on the relational database includes:

[0035] For the structured data in the relational database, triples are obtained by mapping according to the rule that row names are head entities, column names are relations, and data is tail entities;

[0036] For the unstructured data in the relational database, the unstructured data is input into a pre-trained entity relation extraction model to obtain triples output by the entity relation extraction model.

[0037] A relationship mining device, comprising:

[0038] The test data acquisition unit is used to acquire a test entity pair, which includes a test head entity and a test tail entity;

[0039] The path acquisition unit is used to acquire the relation path of the entity pair to be tested based on the pre-constructed knowledge graph. The relation path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity.

[0040] The mining result acquisition unit is used to input the entity pair to be tested and the relationship path of the entity pair to be tested into the mining model of the relationship to be tested, and obtain the mining result output by the mining model of the relationship to be tested;

[0041] The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result.

[0042] A relationship mining device includes: a memory and a processor;

[0043] The memory is used to store programs;

[0044] The processor is used to execute the program and implement the various steps of the relationship mining method.

[0045] A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the various steps of a relation mining method.

[0046] As can be seen from the above technical solutions, the relationship mining method, apparatus, device, and readable storage medium provided in this application obtain the entity pairs to be tested and their relationship paths. The relationship path of the entity pairs to be tested is an ordered set of relationships represented by edges traversed from the head entity to the tail entity. The entity pairs to be tested and their relationship paths are input into the relationship mining model to obtain the mining results output by the model. The relationship mining model is used to obtain feature values ​​corresponding to each relationship path of the entity pairs to be tested based on the relationship paths and preset entity type weight parameters. Based on each feature value, the probability of the relationship between the head entity and the tail entity to be tested being established is obtained, and the probability of the relationship being established is output as the mining result. Therefore, this application incorporates the influence of entity type into the feature value calculation process, eliminating the unreasonable influence of irrelevant entities on the feature values, improving the rationality of feature value calculation, and further improving the accuracy of the mining results. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0048] Figure 1 A flowchart illustrating a relationship mining method provided in an embodiment of this application;

[0049] Figure 2 A code diagram illustrating a regular expression provided in an embodiment of this application;

[0050] Figure 3 A schematic diagram of an ER diagram provided in an embodiment of this application;

[0051] Figure 4 A schematic diagram of the structure of a knowledge graph provided in an embodiment of this application.

[0052] Figure 5 A schematic diagram of a model training process provided in an embodiment of this application;

[0053] Figure 6 This is a schematic diagram of the structure of a relationship mining device provided in an embodiment of this application;

[0054] Figure 7 This is a schematic diagram of the structure of a relationship mining device provided in an embodiment of this application. Detailed Implementation

[0055] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0056] The method provided in this application can be applied to, but is not limited to, scenarios where relationships between entities are obtained from knowledge graphs based on power grid data. Power grid data includes power data (e.g., power system operation data) and business data (e.g., electricity billing data and user electricity consumption information). A knowledge graph is a structured semantic network that stores a large number of triples and their descriptive information. The structure of a triple is: (head entity, relation, tail entity), where the relation indicates the association between the head and tail entities. Nodes in the knowledge graph represent entities, and edges between nodes represent relationships between entities, with the direction of the edges pointing from the head entity to the tail entity. A specific application scenario of this solution is as follows:

[0057] Extract entity relationship triples from power data and business data to initially construct a knowledge graph of power data and business data. Further, based on the knowledge graph, mine the potential relationships between entities in power data and business data, and further supplement the knowledge graph based on the potential relationships.

[0058] Figure 1 The specific implementation flow of a relationship mining method provided in the embodiments of this application is as follows: Figure 1 As shown, this method specifically includes:

[0059] S101. Obtain power grid data.

[0060] In this embodiment, the power grid data includes power data and business data.

[0061] It should be noted that power data and business data come from different systems. Optionally, power data and business data from different systems can be obtained through interfaces and internet channels. For specific methods of data acquisition, please refer to existing technologies.

[0062] S102. Preprocess the power grid data to obtain the data to be processed.

[0063] In this example, preprocessing includes, but is not limited to, data cleaning; specifically, cleaning dirty data from the power grid data. In this embodiment, the specific method for cleaning power grid data includes:

[0064] A1. Use regular expressions to remove irregular data from power data and business data.

[0065] In this embodiment, there are several methods for removing irregular data using regular expressions, such as... Figure 2 As shown, based on the preset first type of regular expression (such as...) Figure 2 The "<\w+?" shown< / \w+?> "",<p.*?> "as well as"<a.*?> Removes HTML statements. Based on a preset second type of regular expression (such as...). Figure 2 The "\s" symbol shown handles whitespace characters based on a preset third-class regular expression (such as...). Figure 2 The "\s" symbol shown removes whitespace characters. It should be noted that... Figure 2 The code examples shown are optional regular expressions; for more details, please refer to existing technologies.

[0066] A2. Abnormal data is obtained by clustering power grid data, and abnormal data processing is performed.

[0067] In this embodiment, the clustering algorithm is pre-configured based on the actual application scenario. The clusters obtained by clustering are the data sets. Data that does not belong to any cluster (i.e., isolated points) are regarded as abnormal data, and the abnormal data is subjected to preset abnormal data processing. Optionally, the abnormal data processing includes deletion operations. Abnormal data includes, but is not limited to, null values ​​and invalid values.

[0068] Specifically, using clustering algorithms in machine learning, data objects are grouped into multiple data sets, and data objects outside the data sets (i.e., outliers) are identified as anomalous data and deleted.

[0069] It should be noted that this step cleans the power grid data by removing irregular and abnormal data. The cleaned power grid data is then used as the data to be processed, which improves the data quality of the data foundation for building the knowledge graph.

[0070] S103. Store the data to be processed in a multi-mode data storage system.

[0071] In this embodiment, there are several methods for storing the data to be processed in a multi-modal data storage manner, and one of the optional methods includes:

[0072] B1. Parse the data to be processed into knowledge sources, which include entities, relationships and attributes. Construct an ER diagram (Entity-Relationship Diagram) based on the knowledge sources.

[0073] It should be noted that there are multiple methods for parsing the data to be processed to obtain knowledge sources and constructing ER diagrams. One possible method for constructing an ER diagram is as follows:

[0074] Specifically, power data and business data are often stored in Excel or CSV files. Power data includes electricity consumption tables, while business data includes company annual reports, tax rating tables, operating status statistics tables, and credit rating reports. Table 1 shows an example of the optional data table structure.

[0075] Table 1

[0076]

[0077] In this embodiment, the data tables are parsed to obtain the table names and column names of each data table. The table names and column names are treated as entities, and the relationships between each entity are extracted, including the first type of relationship (the relationship between the table name and the company) and the second type of relationship (the relationship between the table name and the column name).

[0078] The ER graph is constructed by treating each entity as a node and the first and second types of relationships as edges. It's understandable that the relationships also include a third type (relationships between different companies). Figure 3 A partial schematic diagram of the ER diagram based on the table structure shown in Table 1 is provided.

[0079] B2. According to the ER diagram, the power grid data is stored in a relational database. Specifically, for the digital, image, and text multimedia data in the power grid data, file path links are used for storage. Table 2 shows the storage format of some multi-modal data in the relational database.

[0080] Table 2

[0081]

[0082] It should be noted that this application solves the storage management problem caused by the complexity and large volume of power grid data by constructing a multi-modal database for storage and management, and provides a data foundation for the construction of knowledge graphs.

[0083] S104. For structured data in a relational database, map the data into triples according to the rule that the row name is the head entity, the column name is the relation, and the data to be processed is the tail entity.

[0084] For example, by converting the row name "XX Company" in Table 2 into a head entity, the column name "Cash Flow" into a relation, and the value of "Cash Flow" into a tail entity, we can obtain the triple (XX Company, Cash Flow, 100251.77).

[0085] S105. For unstructured data in a relational database, input the unstructured data into the entity relation extraction model to obtain the triples output by the entity relation extraction model.

[0086] In this embodiment, unstructured data from a relational database is input into a trained entity relation extraction model to obtain head entities, relations, and tail entities from the unstructured data, thereby obtaining triples to represent the unstructured data.

[0087] For example, if the input unstructured data (text) is "XX Company's net cash flow from operating activities in 2021 was 82.4155 million yuan", the triple output by the entity relationship extraction model is (XX Company, cash flow, 82.4155 million yuan).

[0088] In this embodiment, the entity relation extraction model is pre-obtained by training a machine learning model. The specific structure of the machine learning model can vary; for example, it can include a deep learning model built based on a supervised deep learning algorithm. This embodiment does not limit this specific model. A particular method for training a deep learning model to obtain the entity relation extraction model includes:

[0089] C1. Get the preset entity type and relationship type.

[0090] Table 3 illustrates an optional type index table, where p_index is the relation index, predicate is the relation type, stype is the head entity type, and otype is the tail entity type. It should be noted that the entity type and relation type can be manually constructed.

[0091] Table 3

[0092]

[0093]

[0094] C2. Obtain the sample data set.

[0095] In this embodiment, the sample dataset includes pre-annotated sample data. The annotations for the sample data include triple elements and their types, where each triple element includes a head entity, a relation, and a tail entity. Specifically, the sample dataset is obtained by annotating 20% ​​of the unstructured data in the corpus.

[0096] For example, the first unstructured data is "XX Company has been rated as a provincial-level enterprise with good credit in contracting and has been rated as "Tax Credit Rating A". The annotation includes: head entity "XX Company", relation "Tax Credit Rating", and tail entity "A". That is, the annotation data of the first unstructured data includes the triple (XX Company, Tax Credit Rating, A), and also includes the entity type "Enterprise" of "XX Company", the relation type "Tax Credit Rating" of "Tax Credit Rating", and the entity type "Rating" of "A".

[0097] It should be noted that this step labels the types of triplet elements according to the pre-set relation type, head entity type, and tail entity type in C1. For specific labeling methods and sample data representation methods, please refer to existing technologies. For example, the sample data obtained by labeling the first unstructured data is represented as: {'text':'XX Company was rated as a provincial-level contract-trustworthy enterprise by the Hebei Provincial Administration for Industry and Commerce and was rated as "Tax Credit Rating A" by the Tax Credit Rating Review Committee','spo_list':[{'predicate':'Tax Credit Rating','object_type':{'Rating'},'subject_type':'Enterprise','object':{'A'},'subject':'XX Company'}]}.

[0098] C3. Divide the sample data set into training set, validation set and test set, train the deep learning model until the preset training conditions are met, and obtain the entity relationship extraction model.

[0099] In this embodiment, sample data from the training set is used as input data, and the labeled data (elements of triples) of the sample data is used as the target output to train the deep learning model. Training conditions include, but are not limited to, the evaluation metrics of the deep learning model reaching a preset threshold.

[0100] It should be noted that the specific training methods for entity relationship extraction models can be found in existing technologies.

[0101] Triples extracted from unstructured data in relational databases and triples extracted from structured data in relational databases are both considered as candidate triples and added to the candidate triple set.

[0102] It should be noted that a well-trained entity relation extraction model is used to extract triples from unstructured data, thereby improving the accuracy of triple extraction.

[0103] S106. Perform data cleaning on the candidate triplet set to obtain the triplet dataset.

[0104] In this embodiment, the method for data cleaning of the candidate triplet set includes:

[0105] 1. Delete candidate triples that include non-standard entities.

[0106] Optionally, a preset stop word list is obtained, which includes preset non-standard entities, i.e., stop words. If a candidate triple contains at least one non-standard entity from the stop word list, the candidate triple is considered an incorrect triple, and all incorrect triples in the candidate triple set are deleted.

[0107] For example, the candidate triple is (XX Company, Generate, Net Amount). Here, "Generate" is an irregular entity recorded in the stop word list. It can be seen that this candidate triple does not contain any practical meaning and has no positive value for building a knowledge graph. Therefore, this candidate triple is deleted.

[0108] 2. Perform semantic alignment on each candidate triplet in the candidate triplet set.

[0109] In this embodiment, semantic alignment (i.e., semantic disambiguation) is achieved by replacing entities with the same semantic meaning in each candidate triplet with synonyms. The synonym replacement method includes standard word replacement. One possible specific method for semantic alignment of each candidate triplet in the candidate triplet set includes:

[0110] Obtain the feature vectors of the elements in each candidate triplet, where the elements include head entities, tail entities, and relations. The feature vectors are generated based on the semantics of the elements, for example, the feature vectors include word vectors.

[0111] Clustering of elements based on feature vectors yields element clusters. Specifically, elements whose feature vector similarity is greater than a preset similarity threshold are grouped into the same entity cluster.

[0112] Obtain the standard representation of each element cluster, and replace the entities in the candidate triples with the standard representation of the entity cluster to which the entity belongs.

[0113] For example, if the similarity of the feature vectors (word vectors) of the two entity words "net cash flow" and "cash flow" is greater than the similarity threshold, then the two entity words are determined to be words of the same type. That is, the clustering algorithm is used to classify "net cash flow" and "cash flow" into the same entity cluster, and the standard expression of the entity cluster is determined to be "net cash flow". Furthermore, "cash flow" in each candidate triplet is replaced with "net cash flow".

[0114] It should be noted that the standard expression can be randomly selected from the element cluster, or it can be obtained based on the similarity of the feature vectors of each element in the element cluster. For details, please refer to the existing technology.

[0115] It is understandable that the set of triples obtained through data cleaning in this step includes multiple standardized triples.

[0116] S107. Construct a knowledge graph based on a triplet dataset.

[0117] Specifically, a knowledge graph is constructed using entities (including head and tail entities) in the triple dataset as nodes and relations in the triple dataset as edges.

[0118] like Figure 4An example of a knowledge graph structure diagram is provided, such as... Figure 4 As shown, Company Z is the head entity in triple 1 (Company Z, credit rating, A rating), A rating is the tail entity in triple 1, and credit rating is the relationship in triple 1.

[0119] It should be noted that the specific methods for constructing knowledge graphs based on triple datasets can be found in existing technologies.

[0120] S108. Traverse the knowledge graph and extract path features from the knowledge graph to obtain a path feature set.

[0121] In this embodiment, the path features include an ordered set of relations traversed from one entity to another, and the entity types of the entities traversed. That is, the path features include the entity types of the entities corresponding to the nodes traversed from the entity (first entity) as the search starting point to the entity (second entity) as the search ending point, and the relations corresponding to the edges traversed.

[0122] For example, the feature P of any path can be represented as:

[0123]

[0124] Where, r i (i∈[1,n]) represents the i-th relation in path feature P. T0 represents the entity type of the starting point of path feature P, T n T represents the entity type of the endpoint of path feature P. i Indicates r i The entity type (value range) of the tail entity, T i-1 Indicates r i The entity type (scope) of the header entity.

[0125] It is understandable that Boolean values ​​and statistical values ​​such as frequency of occurrence of any relational path can be calculated based on the path feature set. Furthermore, the preset entity type is preset with fine granularity. For example, an entity itself can be a preset entity type, or entities can be classified according to preset rules to obtain multiple preset entity types. For specific methods, please refer to the prior art.

[0126] S109. Based on the knowledge graph, obtain the training data set of the relationship to be tested.

[0127] In this embodiment, the relationship to be tested includes any relationship in the knowledge graph, and the training data set of the relationship to be tested includes multiple training data. Each training data includes a training entity pair, a set of relationship paths of the training entity pair, and relationship annotations of the training entity pair.

[0128] The training entity pair includes a training head entity and a training tail entity. The relation path set includes at least one relation path, which is an ordered set of relations traversed from the training head entity to the training tail entity. Relation annotations are used to indicate whether there is a relationship to be tested between the training head entity and the training tail entity, that is, whether there is an edge in the knowledge graph that directly points from the training head entity to the training tail entity. Optionally, a relation annotation of 1 indicates that there is a relationship to be tested between the training head entity and the training tail entity, and a relation annotation of 0 indicates that there is no relationship to be tested between the training head entity and the training tail entity.

[0129] like Figure 4 As shown, taking the relationship to be tested as a credit rating example, the training dataset includes:

[0130] Training Data 1: Training entity pair D1 (Company X, Grade A), D1's relation path set (p1{credit rating}, p2{electricity usage regulations, impact}), and relation label y D1 =1.

[0131] Training Data 2: Training entity pair D2 (Company Z, Grade A), the set of relationship paths of D2 (p3{Credit Rating}, p4{Total Assets, Asset Score, Impact}, p5{Cooperation, Cooperation, Credit Rating}), and relationship label y. D2 =1.

[0132] Training data 3: D3 (Company Z, Grade B), the set of relationship paths of D3 (p6{cooperation, electricity usage standards, impact}, p7{cooperation, total assets, asset rating, impact}), and relationship annotation y. D3 =0.

[0133] S110. Using the training entity pairs and relation path set in the training data as input and the relation labeling as the target output, train the preset classification model to obtain the mining model of the relation to be tested.

[0134] Figure 5 This example illustrates the training process of a classification model, as shown below. Figure 5 As shown, the training process of the model for mining the relationship to be tested includes:

[0135] S501. The classification model calculates the feature value of each relation path corresponding to the training entity pair based on the set of relation paths of the training entity pairs and the weight parameters of the preset entity type.

[0136] In this embodiment, the feature value of a training entity pair corresponding to the target path (any relational path) represents the probability that the training head entity can reach the training tail entity along the target path. For example, let the training entity pair D be (training head entity h, training tail entity t), then let the feature value of D corresponding to the target path be S. h,p(t) That is, Sh,p(t) This represents the probability that one can reach t by starting from h along p.

[0137] One possible method for calculating the feature values ​​of training entity pairs is to determine the feature values ​​of training entity pairs by obtaining the probability Boolean value of the target path, the frequency of occurrence, and the weight parameters of the preset entity type.

[0138] It should be noted that the Path-ranking Algorithm (PRA) is a classic walk algorithm. The mathematical model of the path-ranking learning method is as follows:

[0139]

[0140] In formula (1), P(e|e';r1) represents the probability that node e' (the node indicating entity e) can be reached in one step along relation r1. Optionally, Where |r1(e',e)| represents the existence of relation r1 between entity e' and entity e; it is 1 if relation r1 exists, and 0 otherwise. |r1(e',·)| represents the existence of relation r1 between entity e' and all entities in the next step, and represents the number of existing relations r1, which is equivalent to accumulation. In the initial stage of the random walk, S h,p(e) Initialize to 1, or to 0 if e = h.

[0141] In this embodiment, an improved path ranking learning algorithm is used to calculate the feature values ​​of training entity pairs corresponding to the target path. The recursive formula of the improved path ranking learning algorithm, also known as the improved recursive formula, is as follows:

[0142] S h,p(e) =Σ e'∈range(p') S h,p'(e') (e')*P(e|e';r1)*λ'(e') (1)

[0143] In this embodiment, λ'(e') represents the weight parameter corresponding to the entity type of e'. The weight parameter corresponding to the entity type is used to indicate the importance of that entity type, S h,p(e) This formula is a recursive process; it recursively calculates and traverses the target path to ultimately obtain the feature value S. h,p(t) .

[0144] As can be seen, this method takes into account the fact that the special characteristics of entity types may affect the eigenvalues. By adding the influence factor λ of entity importance during the walk calculation process, the influence of entity special characteristics is included in the calculation process of eigenvalues, which effectively eliminates the unreasonable influence of irrelevant entities on eigenvalues ​​and improves the rationality of eigenvalue calculation.

[0145] S502. The classification model obtains the feature score of the training entity pair based on the feature value corresponding to each relation path.

[0146] Optionally, the feature values ​​of the training entity pairs corresponding to each relation path are weighted and summed according to the weight parameters of the relation paths to obtain the feature scores of the training entity pairs.

[0147] In this embodiment, the feature scores of the training entity pair D (head entity is h, tail entity is t) are calculated as follows:

[0148]

[0149] Where, θ i For the relation path p i The weight parameter represents p i The degree of influence on whether the relationship to be tested is valid. score(h,t) represents the score calculated for the training entity pair, based on different relationship paths, indicating whether the relationship to be tested is valid. Where P... r ={P1, ..., P n} represents the set of relational paths between training entities and D.

[0150] S503: The classification model obtains the confidence level of the training entity pairs based on the pre-configured Logistic function and the feature scores of the training entity pairs.

[0151] In this embodiment, the confidence level of the training entity pair is used to indicate the predicted probability that the test relationship between the training head entity and the training tail entity is valid. For example, the confidence level of D1 indicates the predicted probability that the "credit rating" relationship between the training head entity and the training tail entity in D1 is valid.

[0152] This step uses the Logistic function to generate the probability that the test relationship between the head and tail entities in the training entity pair holds true.

[0153] In this embodiment, the function formula of the pre-configured Logistic function is shown in formula (2), as follows:

[0154]

[0155] In formula (2), r = 1 indicates that the relationship to be tested is established, score(h,t) represents the feature score of the training entity pair (h,t), and q((r = 1|score(h,t)) represents the confidence level of the training entity pair, that is, the predicted value of the probability that the relationship to be tested is established between the training head entity and the training tail entity.

[0156] S504. Update the model parameters using the loss function, and use the classification model that has reached the preset training conditions as the model for mining the relationship to be tested.

[0157] In this embodiment, the loss function is constructed based on the maximum likelihood estimation, and the loss function is shown in formula (3):

[0158] l n (θ)=ω n [y n ln q n +(1-y n )ln(1-q n (3)

[0159] In formula (3), the training data is identified by the subscript n, that is, formula (3) represents the loss function when training up to the nth training data, where ω n The weights of the loss function are represented by y. n q represents the relation label in the nth training data, that is, the true value of whether the training data pair in the nth training data exists as the relation to be tested. n The confidence level of the training data pair in the nth training data is obtained by referring to the above embodiment.

[0160] In this embodiment, the model for mining the relationship to be tested is used to obtain and output the probability that the head entity and tail entity in the entity pair have a relationship to be tested based on the relationship path set of the entity pair.

[0161] It should be noted that the model parameters include the weight parameters of the preset relational paths, the weight parameters of each preset entity type, and the weights of the loss function. For specific methods of iteratively updating the model parameters and determining whether the preset training conditions have been met, please refer to existing technologies.

[0162] Continuing from the previous example, the credit rating mining model is obtained by iteratively training the classification model using training data 1 to 3. The credit rating mining model is used to output the probability that the credit rating relationship between the head entity and the tail entity in the input data is valid.

[0163] S111, Obtain the entity pair to be tested.

[0164] In this embodiment, the entity pair to be tested includes a head entity to be tested and a tail entity to be tested.

[0165] S112. Based on the knowledge graph, obtain the relationship path of the entity pair to be tested.

[0166] In this embodiment, the relational path of the entity pair to be tested is an ordered set of relations represented by the edges traversed from the head entity to the tail entity.

[0167] S113. Input the entity pairs and relation path set to be tested into the mining model of the relation to be tested, and obtain the mining results output by the mining model of the relation to be tested.

[0168] In this embodiment, the mining results output by the mining model of the relationship to be tested are used to indicate the probability that the relationship to be tested is established between the head entity and the tail entity to be tested.

[0169] Understandably, the process by which the mining model of the relationship to be tested outputs the mining results includes:

[0170] Based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, the feature value of the entity pair to be tested corresponding to the first path is obtained based on the improved recursive calculation formula.

[0171] Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training.

[0172] Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship between the head entity and the tail entity to be tested is established is obtained.

[0173] It should be noted that the weight parameters of the preset entity types and the weight parameters of the relational paths of each entity pair to be tested are all model parameters after training.

[0174] Taking credit rating as an example, let's consider the entity pair (Company Y, Grade A). Inputting the relationship path set of (Company Y, Grade A) and (Company Y, Grade A) into the credit rating mining model yields a mining result of 0.87, meaning the probability that Company Y and Grade A have a credit rating relationship is 0.87. Similarly, for the entity pair (Company Y, Grade B), inputting the relationship path set of (Company Y, Grade B) and (Company Y, Grade B) into the credit rating mining model yields a mining result of 0.32, meaning the probability that Company Y and Grade B have a credit rating relationship is 0.32. Since 0.87 is greater than the preset probability threshold and greater than 0.32, Company Y's credit rating can be determined to be Grade A.

[0175] As can be seen from the above technical solutions, the relationship mining method provided in this application utilizes a relationship mining model to obtain feature values ​​corresponding to each relationship path of the entity pair to be tested, based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type. Based on each feature value, the probability of the relationship between the head entity and the tail entity to be tested being established is obtained, and the probability of the relationship being established is output as the mining result. It is evident that this application incorporates the influence of entity type into the feature value calculation process, eliminating the unreasonable influence of irrelevant entities on the feature values, improving the rationality of feature value calculation, and further improving the accuracy of the mining results. Moreover, this method uses the path between entities as a feature, which can comprehensively learn the characteristics of the relationship and entities to be tested. Different paths illustrate the existence or non-existence of the relationship to be tested from different perspectives, further improving the accuracy of the mining results output by the relationship mining model.

[0176] Figure 6 This paper shows a schematic diagram of the structure of a relationship mining device provided in an embodiment of this application, as shown below. Figure 6 As shown, the device may include:

[0177] The test data acquisition unit 601 is used to acquire a test entity pair, the test entity pair including a test head entity and a test tail entity;

[0178] The path acquisition unit 602 is used to acquire the relation path of the entity pair to be tested based on the pre-constructed knowledge graph. The relation path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity.

[0179] The mining result acquisition unit 603 is used to input the entity pair to be tested and the relationship path of the entity pair to be tested into the mining model of the relationship to be tested, and obtain the mining result output by the mining model of the relationship to be tested;

[0180] The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result.

[0181] Optionally, the mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, including: the mining model for the relationship to be tested is specifically used for:

[0182] Based on the improved recursive operation formula, the feature values ​​of the entity pair to be tested corresponding to the relation path are obtained. The improved recursive operation formula is obtained by assigning a preset entity type weight parameter to each walking entity at each step of the path ranking learning algorithm.

[0183] Optionally, the mining model for the relationship to be tested is used to obtain the probability that the relationship to be tested is established between the head entity and the tail entity based on each feature value, including: the mining model for the relationship to be tested is specifically used for:

[0184] Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training.

[0185] Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

[0186] Optionally, the device further includes: a model training unit, used for:

[0187] Based on the knowledge graph, obtain the training data set for the relationship to be tested;

[0188] The training data set of the relationship to be tested includes multiple training data sets. The training data includes training entity pairs, relationship paths of the training entity pairs, and relationship labels of the training entity pairs. The training entity pairs include training head entities and training tail entities. The relationship path of the training entity pairs is an ordered set of relationships traversed from the training head entity to the training tail entity. The relationship labels of the training entity pairs are used to indicate whether the training head entity and the training tail entity have the relationship to be tested.

[0189] The training entity pairs and their relationship paths are input into the classification model, so that the classification model iteratively executes the parameter update process until the preset training conditions are met, thereby obtaining the mining model of the relationship to be tested.

[0190] The parameter update process includes:

[0191] Based on the improved recursive calculation formula and the weight parameters of the preset entity type, the feature values ​​of the training entity pairs corresponding to each relation path are obtained.

[0192] The confidence level of the training entity pair is obtained based on each feature value. The confidence level is used to characterize the probability that the test relationship between the training head entity and the training tail entity is true.

[0193] The confidence level of each training entity pair is used as the predicted value, and the relation label of each training entity pair is used as the true value. The preset model parameters are updated using a preset loss function, and the model parameters include the weight parameters of the preset entity type.

[0194] Optionally, the model parameters also include weight parameters for preset relational paths;

[0195] The step of obtaining the confidence level of the training entity pairs based on each feature value includes:

[0196] Based on the weight parameters of the relational paths of the training entity pairs, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the training entity pairs.

[0197] The confidence level of the training entity pair is obtained based on the Logistic function and the feature scores of the training entity pair.

[0198] Optionally, the device further includes: a map construction unit, used for:

[0199] Acquire power grid data, which includes power data and business data;

[0200] The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data.

[0201] The data to be processed is stored in a relational database according to a multi-modal data storage method;

[0202] Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples;

[0203] The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set.

[0204] The knowledge graph is constructed based on the triple dataset.

[0205] Optionally, the graph construction unit is used to generate triples of the data to be processed based on the relational database, including: the graph construction unit is specifically used for:

[0206] For the structured data in the relational database, triples are obtained by mapping according to the rule that row names are head entities, column names are relations, and data is tail entities;

[0207] For the unstructured data in the relational database, the unstructured data is input into a pre-trained entity relation extraction model to obtain triples output by the entity relation extraction model.

[0208] Figure 7 A schematic diagram of the relationship mining device is shown. The device may include: at least one processor 701, at least one communication interface 702, at least one memory 703, and at least one communication bus 704.

[0209] In this embodiment of the application, the number of processor 701, communication interface 702, memory 703 and communication bus 704 is at least one, and processor 701, communication interface 702 and memory 703 communicate with each other through communication bus 704.

[0210] The processor 701 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0211] The memory 703 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;

[0212] The memory stores a program, and the processor can execute the program stored in the memory to implement the various steps of the relationship mining method provided in this application embodiment, as follows:

[0213] A relation mining method includes:

[0214] Obtain a pair of entities to be tested, the pair of entities to be tested including a head entity to be tested and a tail entity to be tested;

[0215] Based on a pre-constructed knowledge graph, the relational path of the entity pair to be tested is obtained. The relational path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity.

[0216] The entity pair to be tested and its relationship path are input into the mining model of the relationship to be tested, and the mining results output by the mining model of the relationship to be tested are obtained.

[0217] The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result.

[0218] Optionally, obtaining the feature values ​​of the entity pair to be tested corresponding to each relation path based on the relation path of the entity pair to be tested and the weight parameters of the preset entity type includes:

[0219] Based on the improved recursive operation formula, the feature values ​​of the entity pair to be tested corresponding to the relation path are obtained. The improved recursive operation formula is obtained by assigning a preset entity type weight parameter to each walking entity at each step of the path ranking learning algorithm.

[0220] Optionally, obtaining the probability that the relationship to be tested between the head entity and the tail entity to be tested is true based on each feature value includes:

[0221] Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training.

[0222] Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

[0223] Optionally, this method also includes:

[0224] Based on the knowledge graph, obtain the training data set for the relationship to be tested;

[0225] The training data set of the relationship to be tested includes multiple training data sets. The training data includes training entity pairs, relationship paths of the training entity pairs, and relationship labels of the training entity pairs. The training entity pairs include training head entities and training tail entities. The relationship path of the training entity pairs is an ordered set of relationships traversed from the training head entity to the training tail entity. The relationship labels of the training entity pairs are used to indicate whether the training head entity and the training tail entity have the relationship to be tested.

[0226] The training entity pairs and their relationship paths are input into the classification model, so that the classification model iteratively executes the parameter update process until the preset training conditions are met, thereby obtaining the mining model of the relationship to be tested.

[0227] The parameter update process includes:

[0228] Based on the improved recursive calculation formula and the weight parameters of the preset entity type, the feature values ​​of the training entity pairs corresponding to each relation path are obtained.

[0229] The confidence level of the training entity pair is obtained based on each feature value. The confidence level is used to characterize the probability that the test relationship between the training head entity and the training tail entity is true.

[0230] The confidence level of each training entity pair is used as the predicted value, and the relation label of each training entity pair is used as the true value. The preset model parameters are updated using a preset loss function, and the model parameters include the weight parameters of the preset entity type.

[0231] Optionally, the model parameters also include weight parameters for preset relational paths;

[0232] The step of obtaining the confidence level of the training entity pairs based on each feature value includes:

[0233] Based on the weight parameters of the relational paths of the training entity pairs, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the training entity pairs.

[0234] The confidence level of the training entity pair is obtained based on the Logistic function and the feature scores of the training entity pair.

[0235] Optionally, this method also includes:

[0236] Acquire power grid data, which includes power data and business data;

[0237] The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data.

[0238] The data to be processed is stored in a relational database according to a multi-modal data storage method;

[0239] Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples;

[0240] The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set.

[0241] The knowledge graph is constructed based on the triple dataset.

[0242] Optionally, generating triples of the data to be processed based on the relational database includes:

[0243] For the structured data in the relational database, triples are obtained by mapping according to the rule that row names are head entities, column names are relations, and data is tail entities;

[0244] For the unstructured data in the relational database, the unstructured data is input into a pre-trained entity relation extraction model to obtain triples output by the entity relation extraction model.

[0245] This application embodiment also provides a readable storage medium that can store a computer program suitable for processor execution. When the computer program is executed by the processor, it implements the various steps of the relationship mining method provided in this application embodiment, as follows:

[0246] A relation mining method includes:

[0247] Obtain a pair of entities to be tested, the pair of entities to be tested including a head entity to be tested and a tail entity to be tested;

[0248] Based on a pre-constructed knowledge graph, the relational path of the entity pair to be tested is obtained. The relational path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity.

[0249] The entity pair to be tested and its relationship path are input into the mining model of the relationship to be tested, and the mining results output by the mining model of the relationship to be tested are obtained.

[0250] The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result.

[0251] Optionally, obtaining the feature values ​​of the entity pair to be tested corresponding to each relation path based on the relation path of the entity pair to be tested and the weight parameters of the preset entity type includes:

[0252] Based on the improved recursive operation formula, the feature values ​​of the entity pair to be tested corresponding to the relation path are obtained. The improved recursive operation formula is obtained by assigning a preset entity type weight parameter to each walking entity at each step of the path ranking learning algorithm.

[0253] Optionally, obtaining the probability that the relationship to be tested between the head entity and the tail entity to be tested is true based on each feature value includes:

[0254] Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training.

[0255] Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

[0256] Optionally, this method also includes:

[0257] Based on the knowledge graph, obtain the training data set for the relationship to be tested;

[0258] The training data set of the relationship to be tested includes multiple training data sets. The training data includes training entity pairs, relationship paths of the training entity pairs, and relationship labels of the training entity pairs. The training entity pairs include training head entities and training tail entities. The relationship paths of the training entity pairs are ordered sets of relationships traversed from the training head entity to the training tail entity. The relationship labels of the training entity pairs are used to indicate whether the training head entity and the training tail entity have the relationship to be tested.

[0259] The training entity pairs and their relationship paths are input into the classification model, so that the classification model iteratively executes the parameter update process until the preset training conditions are met, thereby obtaining the mining model of the relationship to be tested.

[0260] The parameter update process includes:

[0261] Based on the improved recursive calculation formula and the weight parameters of the preset entity type, the feature values ​​of the training entity pairs corresponding to each relation path are obtained.

[0262] The confidence level of the training entity pair is obtained based on each feature value. The confidence level is used to characterize the probability that the test relationship between the training head entity and the training tail entity is true.

[0263] The confidence level of each training entity pair is used as the predicted value, and the relation label of each training entity pair is used as the true value. The preset model parameters are updated using a preset loss function, and the model parameters include the weight parameters of the preset entity type.

[0264] Optionally, the model parameters also include weight parameters for preset relational paths;

[0265] The process of obtaining the confidence level of the training entity pairs based on each feature value includes:

[0266] Based on the weight parameters of the relational paths of the training entity pairs, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the training entity pairs.

[0267] The confidence level of the training entity pair is obtained based on the Logistic function and the feature scores of the training entity pair.

[0268] Optionally, this method also includes:

[0269] Acquire power grid data, which includes power data and business data;

[0270] The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data.

[0271] The data to be processed is stored in a relational database according to a multi-modal data storage method;

[0272] Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples;

[0273] The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set.

[0274] The knowledge graph is constructed based on the triple dataset.

[0275] Optionally, generating triples of the data to be processed based on the relational database includes:

[0276] For the structured data in the relational database, triples are obtained by mapping according to the rule that row names are head entities, column names are relations, and data is tail entities;

[0277] For the unstructured data in the relational database, the unstructured data is input into a pre-trained entity relation extraction model to obtain triples output by the entity relation extraction model.

[0278] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0279] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0280] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A relation mining method, characterized in that, include: Acquire power grid data, which includes power data and business data; The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data. The data to be processed is stored in a relational database according to a multi-modal data storage method; Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples; The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set. A knowledge graph is constructed based on the triplet dataset; Obtain a pair of entities to be tested, the pair of entities to be tested including a head entity to be tested and a tail entity to be tested; Based on a pre-constructed knowledge graph, the relational path of the entity pair to be tested is obtained. The relational path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity. The entity pair to be tested and its relationship path are input into the mining model of the relationship to be tested, and the mining results output by the mining model of the relationship to be tested are obtained. The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result. The feature value represents the probability that the training head entity can reach the training tail entity along the target path; the method for calculating the feature value of the training entity pair is to determine the feature value of the training entity pair by obtaining the probability Boolean value of the target path, the frequency of occurrence, and the weight parameter of the preset entity type. The step of obtaining the probability that the relationship between the head entity and the tail entity to be tested is established based on each feature value includes: Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training. Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

2. The method according to claim 1, characterized in that, The step of obtaining the feature values ​​of the entity pair under test corresponding to each relation path based on the relation path of the entity pair under test and the weight parameters of the preset entity type includes: Based on the improved recursive operation formula, the feature values ​​of the entity pair to be tested corresponding to the relation path are obtained. The improved recursive operation formula is obtained by assigning a preset entity type weight parameter to each walking entity at each step of the path ranking learning algorithm.

3. The method according to claim 2, characterized in that, The method further includes: Based on the knowledge graph, obtain the training data set for the relationship to be tested; The training data set of the relationship to be tested includes multiple training data sets. The training data includes training entity pairs, relationship paths of the training entity pairs, and relationship labels of the training entity pairs. The training entity pairs include training head entities and training tail entities. The relationship path of the training entity pairs is an ordered set of relationships traversed from the training head entity to the training tail entity. The relationship labels of the training entity pairs are used to indicate whether the training head entity and the training tail entity have the relationship to be tested. The training entity pairs and their relationship paths are input into the classification model, so that the classification model iteratively executes the parameter update process until the preset training conditions are met, thereby obtaining the mining model of the relationship to be tested. The parameter update process includes: Based on the improved recursive calculation formula and the weight parameters of the preset entity type, the feature values ​​of the training entity pairs corresponding to each relation path are obtained. The confidence level of the training entity pair is obtained based on each feature value. The confidence level is used to characterize the probability that the test relationship between the training head entity and the training tail entity is true. The confidence level of each training entity pair is used as the predicted value, and the relation label of each training entity pair is used as the true value. The preset model parameters are updated using a preset loss function, and the model parameters include the weight parameters of the preset entity type.

4. The method according to claim 3, characterized in that, The model parameters also include weight parameters for preset relationship paths; The step of obtaining the confidence level of the training entity pairs based on each feature value includes: Based on the weight parameters of the relational paths of the training entity pairs, the feature values ​​of the training entity pairs corresponding to each relational path are weighted and summed to obtain the feature score of the training entity pairs. The confidence level of the training entity pair is obtained based on the Logistic function and the feature scores of the training entity pair.

5. The method according to claim 1, characterized in that, The process of generating triples for the data to be processed based on the relational database includes: For the structured data in the relational database, triples are obtained by mapping according to the rule that row names are head entities, column names are relations, and data is tail entities; For the unstructured data in the relational database, the unstructured data is input into a pre-trained entity relation extraction model to obtain triples output by the entity relation extraction model.

6. A relationship mining device, characterized in that, include: The graph construction unit is used for: Acquire power grid data, which includes power data and business data; The power grid data is preprocessed to obtain data to be processed. The preprocessing process includes: using regular expressions to remove irregular data from the power grid data, and / or, clustering the power grid data to obtain abnormal data and removing the abnormal data. The data to be processed is stored in a relational database according to a multi-modal data storage method; Based on the relational database, generate triples of the data to be processed, and add them to the candidate triple set as candidate triples; The candidate triple set is subjected to preset data cleaning to obtain a triple dataset. The data cleaning process includes: deleting candidate triples that include preset non-standard entities, and / or performing semantic alignment on each candidate triple in the candidate triple set. A knowledge graph is constructed based on the triple dataset; The test data acquisition unit is used to acquire a test entity pair, which includes a test head entity and a test tail entity; The path acquisition unit is used to acquire the relation path of the entity pair to be tested based on the pre-constructed knowledge graph. The relation path of the entity pair to be tested is an ordered set of relations represented by the edges from the head entity to the tail entity. The mining result acquisition unit is used to input the entity pair to be tested and the relationship path of the entity pair to be tested into the mining model of the relationship to be tested, and obtain the mining result output by the mining model of the relationship to be tested; The mining model for the relationship to be tested is used to obtain the feature values ​​of the entity pair to be tested corresponding to each relationship path based on the relationship path of the entity pair to be tested and the weight parameters of the preset entity type, obtain the probability of the relationship to be tested between the head entity and the tail entity to be tested being established based on each feature value, and output the probability of the relationship to be tested being established as the mining result. The feature value represents the probability that the training head entity can reach the training tail entity along the target path; the method for calculating the feature value of the training entity pair is to determine the feature value of the training entity pair by obtaining the probability Boolean value of the target path, the frequency of occurrence, and the weight parameter of the preset entity type. The step of obtaining the probability that the relationship between the head entity and the tail entity to be tested is established based on each feature value includes: Based on the weight parameters of the relational paths of each entity pair to be tested, the feature values ​​of the training entity pair corresponding to each relational path are weighted and summed to obtain the feature score of the entity pair to be tested. The weight parameters of any relational path are obtained through pre-training. Based on the pre-configured Logistic function and the feature scores of the entity pairs to be tested, the probability that the relationship to be tested between the head entity and the tail entity to be tested is established is obtained.

7. A relationship mining device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the relationship mining method as described in any one of claims 1 to 5.

8. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the relationship mining method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Knowledge graph completion method fusing entity types and relation path information

    CN114003729A

  • Knowledge graph link error checking and repairing method and apparatus, and storage medium

    WO2021042546A1