A phased domain knowledge graph expansion method and storage medium
Through the phased domain knowledge graph expansion method, power equipment inspection data and neural network models are used to build power field knowledge graphs, solving the problem of data sparsity in power equipment detection and improving detection accuracy.
Patent Information
- Application Number
- CN202210409533.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-19
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-04-19
AI Technical Summary
The sparseness of knowledge graph data in the field of power equipment defect detection leads to insufficient detection accuracy.
A phased domain knowledge graph expansion method is adopted, including obtaining daily inspection data of power equipment, pre-processing corpus, using a neural network model with remote supervision and attention mechanism to obtain predicted triplet data, filtering real triplets through similarity matching and attribute discriminators, and building a power domain knowledge graph expansion model.
It effectively solves the problem of data sparsity in power equipment defect detection, improves the prediction feedback accuracy of the detection system, and ensures that the data redundancy is not improved.
Smart Images

Figure CN115203425B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data graph technology, and specifically to a phased domain knowledge graph expansion method and storage medium. Background Art
[0002] In recent years, with the rapid development of my country's economy, the scale of its industry and various sectors has continued to expand, and the demand for electric energy has increased dramatically. Consequently, the coverage of power equipment has continued to expand. These equipment not only has to withstand high loads of power operation but also faces the influence and erosion of a harsh external environment. Given this situation, power equipment defect detection in the power sector is crucial for protecting people's lives and property. To ensure high-precision power equipment defect detection, large-scale datasets are required to support monitoring systems and provide comprehensive and accurate predictions and feedback on the status of power equipment. Currently, most datasets used in the field of power equipment defect detection suffer from various shortcomings, such as data sparsity or data redundancy, and data expansion is difficult.
[0003] In the era of rapid internet development, online information is rapidly increasing. Knowledge graphs, as large-scale knowledge bases for storing and organizing information, have emerged and become one of the most widely used data modeling approaches. A knowledge graph is essentially a semantic network constructed from real-world data, consisting of many factual entities and various relationships between them, with its data storage structure being a directed graph. However, in the application and research of knowledge graphs and related technologies, problems such as incomplete and sparse graph content caused by missing information have gradually emerged. Based on this phenomenon, knowledge graph completion technology has gradually gained attention. Knowledge graph completion technology can predict missing entities, relationships, attributes, and other related information in a knowledge graph based on known information. It then completes the graph structure by mining new facts, thereby improving its quality and reliability. Knowledge graph completion technology can be divided into two main effective approaches: inferring new facts from known facts in an existing knowledge graph, and extracting new facts from external information to expand the existing knowledge graph. Due to the information prediction ability of knowledge graph completion technology, it has also become an important way to acquire new knowledge. It is of great significance to solve the problem of sparse knowledge graph data and improve the integrity of knowledge graphs. Summary of the Invention
[0004] The present invention proposes a phased domain knowledge graph expansion method, which can solve the problem of knowledge graph data sparsity in the field of power equipment defect detection and improve the prediction feedback accuracy of the defect detection system.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A phased domain knowledge graph expansion method, including:
[0007] Obtain daily inspection data of power equipment, pre-process the original corpus and remove invalid corpus that does not contain sensitive entity words;
[0008] Based on the preprocessed corpus text, a remotely supervised extended annotation dataset is used, and the dataset is divided into positive and negative samples by a data splitter, wherein the positive samples serve as initial training data for entity relationship extraction, and the negative samples serve as supplementary data;
[0009] Use a neural network model combined with an attention mechanism to obtain the predicted triplet data to be expanded;
[0010] The predicted triplets that exceed the threshold are removed through the similarity matching algorithm, and the remaining triplets are used to find the corresponding local graph structure through the local locator;
[0011] The attribute discriminator is used to determine the truth or falsity of the triples to be expanded, and the triples with true attribute values are placed into the candidate domain of predicted triples;
[0012] Construct an electric power domain knowledge graph expansion model, and use the initialization training data to train the model, and obtain a complete domain knowledge graph through the trained electric power domain knowledge graph expansion model.
[0013] Furthermore, the acquisition of daily inspection data of power equipment, preprocessing of original corpus and removal of invalid corpus that does not contain sensitive entity words includes:
[0014] Preload the original corpus of power equipment defect inspections and use the Hidden Markov Model to evaluate and obtain the optimal corpus segmentation results.
[0015] Eliminate invalid corpus that does not contain sensitive entity words based on pre-labeled entity tags;
[0016] The filtered valid corpus is classified, sorted and arranged according to the entity tags it contains for subsequent loading and use.
[0017] Furthermore, the method of using remote supervision to expand the labeled dataset and dividing the dataset into positive and negative samples by a data splitter includes:
[0018] Use the triplets in the existing knowledge base as manually selected seed sets;
[0019] Align the corpus text to be processed with the knowledge base, extract sentences containing two entities, mark the corresponding relationship, and obtain a large amount of annotated training corpus;
[0020] The training corpus is divided into data using a data segmenter, and sentences containing the same entity pair are used as positive samples of the corresponding relationship of the entity pair in the knowledge base;
[0021] Semantic matching is performed on the positive sample and the corresponding relationship triplet. If the semantic difference is greater than a set value, it is listed as noise data and incorporated into the negative sample.
[0022] Furthermore, the method of obtaining the predicted triplet data to be expanded by using the neural network model combined with the attention mechanism includes:
[0023] Use the glove pre-training tool to convert the corpus sentences to be processed into matrix form;
[0024] Use zero-value vectors to fill statements of different lengths so that all statements have the same length;
[0025] In the neural network model, a sliding window of size n is set to perform convolution operation with the feature matrix T of each sentence. Each sentence feature matrix T is regarded as a sequence, that is, T = {t1, t2, ..., t |s|}, where t i is the word vector representation obtained by the embedding layer, t i ∈R d , |s| represents the length of the sentence; assuming t i:j Indicates t in the corpus sentence i to t j The vector connection, the convolution operation formula is as follows:
[0026] x j =Nt j-n+1:j +b, 1≤j≤|s|≤n-1
[0027] Among them, x j It is the new feature generated by the convolution operation between the sentence feature and the filter, N represents the filter group in the model, t j-n+1:j Represents the features overlapping with the filter, b represents the bias vector, x∈R |s| +n-1, R represents the spatial domain of the variable value;
[0028] After the filter group N in the above formula is expanded, it is represented as multiple filters, that is, N = {N1, N2, ..., N m}, where m represents the number of filters in the convolutional model, then each filter gets a feature vector representation formula as follows:
[0029] x ij =N i t j-n+1:j +b i , 1≤i≤m, 1≤j≤|s|+n-1
[0030] Among them, x ijRepresents the new features generated after the sentence feature and the filter convolution operation, t j-n+1:j Represents the features that overlap with the filter, N i represents the filter in the model, and b represents the bias vector;
[0031] After the convolution layer operation is completed, a feature matrix X = {x1, x2, ..., x m}, X∈R m×(|s|+n-1) , R represents the spatial domain of variable values;
[0032] Obtain the feature matrix X obtained after the convolution operation = {x1, x2, ..., x m}, each feature vector x is divided into the following three segments with the head entity and the tail entity as the segmentation points: {x i1 , x i2 , x i3}, and respectively from x ij The formula for obtaining the maximum value is as follows:
[0033] z ij =max{x ij}, 1≤i≤m, 1≤j≤3
[0034] After that, each eigenvector x i We get a three-dimensional pooling feature vector z i ={z i1 , z i2 , z i3}, based on this, all three-dimensional pooling feature vectors are connected to form z 1:m Finally, the hyperbolic tangent function tanh is used for activation to generate a feature vector representing β. The calculation formula is as follows:
[0035] β=tanh(z 1:m ), β∈R 3×m
[0036] Finally, the input sentence feature matrix T is transformed to generate a high-level feature vector β, and the high-level feature vector representation set of each sentence is obtained. where β i It is for the sentence s i The feature vector generated by processing, θ r is the number of sentences expressing relation r;
[0037] The attention mechanism is used to calculate a weight for each sentence to represent the support degree of the sentence for the relation r. The sentences are sorted from high to low according to the weight, and then processed to generate a set of combined sentence feature vectors.
[0038] The combined sentence feature vectors contained in the above combined sentence feature vector set are sequentially input into the softmax classifier, and then the conditional probability of each combined sentence feature vector on the relation r is calculated, and the best combined sentence feature vector is selected from them;
[0039] Then the softmax layer selects the relationship label prediction structure of the best combined feature vector k with the highest score on the relationship r, and calculates the relationship prediction label vector λ for each sentence. The calculation formula is as follows:
[0040] λ=arg max(k)
[0041] Among them, k is the best combined feature vector, and λ is the relation prediction label vector for each sentence.
[0042] Furthermore, the method of using the glove pre-training tool to convert the corpus sentences to be processed into a matrix form includes:
[0043] Use underscores to connect entities that appear in a sentence into a single word;
[0044] Input the processed corpus into the glove model tool for training to obtain pre-trained word vectors;
[0045] Then concatenate the words in the sentence one by one to obtain the feature representation matrix of the sentence.
[0046] Furthermore, the steps of setting the iterative update parameters of the model loss function include:
[0047] During model training, a multi-classification cross entropy function is set as the loss function of the entire model. The loss function formula is:
[0048]
[0049] Among them, δ is the parameter that the model needs to optimize, q represents the number of sentence sets, Indicates that when the parameter δ is known, the eigenvector Classification relation r j The probability of Represents the best combined sentence feature vector in the j-th sentence set.
[0050] Furthermore, predicted triplets exceeding a threshold are removed through a similarity matching algorithm, including:
[0051] Map entities and relations in the original knowledge graph into vector representations;
[0052] Set the upper similarity threshold to f;
[0053] Taking the feature vectors corresponding to the head and tail entities of the predicted triple as the benchmark, scan the original knowledge graph and calculate the cosine similarity of the predicted triple to be expanded;
[0054] Prediction triplets whose similarity exceeds the threshold are discarded;
[0055] The qualified predicted triples are input into the local locator, and the corresponding local graph structure is matched through the head entity label to reduce the computational complexity;
[0056] The common sense labels in the attribute discriminator are used to determine the attribute values of the predicted triples, and the predicted triples that seriously deviate from the facts are screened out and discarded.
[0057] Furthermore, the step of obtaining a complete domain knowledge graph by expanding the trained electric power domain knowledge graph model includes:
[0058] Build an initialized knowledge graph expansion model for the power sector;
[0059] Training the model using initial training data and iteratively updating model parameters;
[0060] Input the test corpus into the trained electric power domain knowledge graph expansion model to obtain the complete expanded domain knowledge graph.
[0061] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the above method.
[0062] From the above technical solution, it can be seen that the phased domain knowledge graph expansion method of the present invention has the following beneficial effects:
[0063] The phased domain knowledge graph expansion method of the present invention preprocesses the unstructured data of daily inspections of power equipment defects into structured data, extracts the entities and relationships contained in the original corpus, constructs a knowledge graph expansion model for the power field, and uses training data to train the model, which can effectively solve the expansion needs of the power field defect inspection data set.
[0064] The phased domain knowledge graph expansion method of the present invention can effectively utilize the continuously collected new data to solve the data sparsity problem of the power domain knowledge graph, while ensuring that the data redundancy of the power domain knowledge graph will not be significantly increased.
[0065] The phased domain knowledge graph expansion method of the present invention effectively solves the need for iterative update of data sets of equipment defect detection systems in the power field that use knowledge graphs as database support, and can fundamentally improve the detection accuracy of defect detection systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A workflow diagram of a phased domain knowledge graph expansion method provided in an embodiment of the present application;
[0067] Figure 2 Provided in the embodiments of this application Figure 1 A workflow diagram of step S1 of a phased domain knowledge graph expansion method;
[0068] Figure 3 Provided in the embodiments of this application Figure 1 A workflow diagram of step S2 of a phased domain knowledge graph expansion method;
[0069] Figure 4 Provided in the embodiments of this application Figure 1 A workflow diagram of step S3 of a phased domain knowledge graph expansion method;
[0070] Figure 5 Provided in the embodiments of this application Figure 1 A workflow diagram of steps S4 and S5 of a phased domain knowledge graph expansion method;
[0071] Figure 6 Provided in the embodiments of this application Figure 1 A workflow diagram of steps S6 and S7 of a phased domain knowledge graph expansion method;
[0072] Figure 7 A module architecture diagram of a phased domain knowledge graph expansion system provided in an embodiment of the present application;
[0073] Figure 8 A schematic diagram of the embedding layer of a phased domain knowledge graph expansion method provided in an embodiment of the present application;
[0074] Figure 9 A schematic diagram of the framework of a phased domain knowledge graph expansion method provided in an embodiment of the present application;
[0075] Component number description
[0076] 10 Corpus Preprocessing Equipment
[0077] 20 Data Splitter
[0078] 30 Relationship Extractor
[0079] 40 Local locator
[0080] 50 Attribute Discriminator
[0081] 60 Model creation and training equipment. DETAILED DESCRIPTION
[0082] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0083] In the field of power equipment defect detection, there are problems such as difficulty in integrating daily inspection data, difficulty in expanding data sets, and sparse knowledge graph data in the power field. In view of this, the present invention provides a phased domain knowledge graph expansion method described in this embodiment.
[0084] See also Figure 1 , Figure 1 This is a workflow diagram for a phased domain knowledge graph expansion method provided in an embodiment of the present application. The phased domain knowledge graph expansion method provided by the present invention addresses the need for iterative updates to data sets in equipment defect detection systems in the power sector that use knowledge graphs as database support. It effectively utilizes continuously collected new data to address data sparsity issues in the power sector knowledge graph, while ensuring that the data redundancy of the power sector knowledge graph does not increase significantly.
[0085] The phased domain knowledge graph expansion method includes:
[0086] Step S1: Obtain the equipment defect daily inspection corpus through the corpus preprocessing device 10, and preprocess the original corpus. The original data can be divided into a training set and a test set according to a ratio of 7:3, but is not limited to it. Specifically, the original corpus data that needs to be eliminated can be divided into the following categories: ① sentences that do not contain sensitive entity words; ② invalid corpus with disordered relational word order; ③ isolated single word data that is irrelevant to the context.
[0087] Step S2: using the remote supervision method to expand the labeled data set, and dividing the data set into positive and negative samples through the data splitter 20;
[0088] Step S3: Using the relationship extractor 30, a neural network model combined with an attention mechanism is used to obtain the predicted triples to be expanded.
[0089] Step S4: removing predicted triples exceeding a threshold based on a similarity matching algorithm, and finding the corresponding local graph structure through the local locator 40;
[0090] Step S5: The attribute discriminator 50 determines whether the triples to be expanded are true or false, and puts the triples with true attribute values into the candidate domain of predicted triples.
[0091] Step S6: construct a knowledge graph expansion model in the power field through the model creation and training device 60, and use the initialization training data to train the model.
[0092] Step S7: input the test corpus into the trained model to obtain an expanded domain knowledge graph.
[0093] See also Figure 2 , Figure 2 Provided in the embodiments of this application Figure 1 The workflow diagram of step S1 of a phased domain knowledge graph expansion method in step S1 includes the following steps:
[0094] Step S11: preload the original corpus. Corpus segmentation can be performed using, but is not limited to, an N-gram model, a conditional random field model, a Chinese word segmentation model based on a word perceptron algorithm, a Chinese word segmentation model combining a character-based generative model and a discriminative model, etc. Preferably, a hidden Markov model is used to evaluate and obtain the optimal corpus segmentation result.
[0095] Step S12: Eliminate invalid corpus that does not contain sensitive entity words based on pre-labeled entity tags;
[0096] Step S13: classify and sort the filtered valid corpus according to the entity tags it contains for subsequent loading and use;
[0097] See also Figure 3 , Figure 3 Provided in the embodiments of this application Figure 1 The workflow diagram of step S2 of a phased domain knowledge graph expansion method in
[15] is shown. Step S2 uses remote supervision to expand the labeled dataset and divides the dataset into positive and negative samples using a data splitter, including:
[0098] Step S21: using triples in an existing knowledge base as manually selected seed sets, which may include but are not limited to using CSC Chinese semantic lexicon, CN-DBpedia, and YAGO as supplementary lexicons for entity words;
[0099] Step S22: Align the corpus to be processed with the knowledge base, extract sentences containing two entities, and mark the corresponding relationship to obtain a large amount of annotated training corpus. Specifically, the labels of the head entity or the tail entity can be used as a benchmark to group sentences with the same label into one category;
[0100] Step S23: By partitioning the training corpus, sentences containing the same entity pair are used as positive samples of the corresponding relationship in the knowledge base. Semantic matching is performed between the positive samples and the corresponding relationship triples. If the semantic differences are significant, they are classified as noise data and incorporated into negative samples. Here, the negative samples are retained to supplement model training.
[0101] See also Figure 4 , Figure 4 Provided in the embodiments of this application Figure 1 The workflow diagram of step S3 of a phased domain knowledge graph expansion method in step S3 is as follows. The step of obtaining the prediction triple data to be expanded by using a neural network model combined with an attention mechanism in step S3 includes:
[0102] Step S31: The corpus sentences to be processed may be converted into a matrix form using, but not limited to, pre-training tools such as glove or Word2vec;
[0103] Step S32: Use zero-valued vectors to fill sentences of unequal lengths so that all sentences maintain a uniform length. Specifically, zero-valued vectors can be used to fill the sentence length before the corpus is converted into a matrix, or zero-valued vectors can be used to fill the matrix length after the sentence is converted into a matrix.
[0104] Step S33, obtain the word vector representation of the corpus through the embedding layer, set a sliding window of size n in the neural network model, and perform convolution operation with the feature matrix T of each sentence, and regard each sentence feature matrix T as a sequence, that is, T = {t1, t2, ..., t |s|}, where t i is the word vector representation obtained by the embedding layer, t i ∈R d , |s| represents the length of the sentence. Assume t i:j Indicates t in the corpus sentence i to t j The convolution operation formula is as follows:
[0105] x j =Nt j-n+1:j +b, 1≤j≤|s|≤n-1
[0106] Among them, x j It is the new feature generated by the convolution operation between the sentence feature and the filter, N represents the filter group in the model, t j-n+1:j Represents the features overlapping with the filter, b represents the bias vector, x∈R |s|+n-1 , R represents the spatial domain of the variable value.
[0107] After the filter group N in the above formula is expanded, it can be expressed as multiple filters, that is, N = {N1, N2, ..., N m}, where m represents the number of filters in the convolutional model, each filter gets a feature vector representation formula as shown below.
[0108] x ij =N i t j-n+1:j +b i , 1≤i≤m, 1≤j≤|s|+n-1
[0109] Among them, x ij Represents the new features generated after the sentence feature and the filter convolution operation, t j-n+1:j Represents the features that overlap with the filter, N i represents the filter in the model and b represents the bias vector.
[0110] After the convolution layer operation is completed, a feature matrix X = {x1, x2, ..., x m}, X∈R m×(|s|+n-1) , R represents the spatial domain of the variable value.
[0111] Obtain the feature matrix X obtained after the convolution operation = {x1, x2, ..., x m}, each feature vector x is divided into the following three segments with the head entity and the tail entity as the segmentation points: {x i1 , x i2 , x i3}, and respectively from x ij The formula to obtain the maximum value is as follows.
[0112] z ij =max{x ij}, 1≤i≤m, 1≤j≤3
[0113] After that, each eigenvector x i You can get a three-dimensional pooling feature vector z i ={z i1 , z i2 , z i3}, based on this we can connect all the three-dimensional pooling feature vectors to form z 1:m Finally, the hyperbolic tangent function tanh is used for activation to generate a feature vector representing β. The calculation formula is as follows.
[0114] β=tanh(z 1:m ), β∈R 3×m
[0115] Finally, the input sentence feature matrix T is transformed to generate a high-level feature vector β, and the high-level feature vector representation set of each sentence is obtained. where β i It is for the sentence s i The feature vector generated by processing, θ r is the number of sentences representing relation r.
[0116] Step S34: Calculate a weight for each sentence through the attention mechanism to represent the support of the sentence for the relation r, sort the sentences from high to low according to the weight, and then process them to generate a set of combined sentence feature vectors. Specifically, the sentence-level attention weight calculation formula is used to calculate a weight As shown below:
[0117]
[0118] in, represents the support of the statement to the relation r, β n represents the feature vector of the nth sentence in the sentence set, D is a diagonal weight matrix, r is the query vector of label relation r, w r is the number of sentences representing relation r.
[0119] When processing a set of sentence feature vectors to generate a combined sentence feature vector, the number of combined features needs to be considered. The specific calculation formula is as follows:
[0120]
[0121] Among them, h n represents the feature vector of the combined sentence generated after processing, s represents the number of feature combinations, β n represents the feature vector of the nth sentence in the sentence set, D is a diagonal weight matrix, r is the query vector of label relation r, β' n A vector in a set of weighted ordered sentence feature vectors.
[0122] Step S35: Calculate and output the relationship prediction label vector for each sentence through the softmax layer. Specifically, the combined sentence feature vectors contained in the combined sentence feature vector set are sequentially input into the softmax classifier, and the conditional probability of each combined sentence feature vector on the relationship r is calculated, and the best combined sentence feature vector is selected from them.
[0123] Then the softmax layer selects the relationship label prediction structure with the best combined feature vector k with the highest score on the relationship r, and calculates the relationship prediction label vector λ for each sentence. The calculation formula is as follows.
[0124] λ=arg max(k)
[0125] Among them, k is the best combined feature vector, and λ is the relation prediction label vector for each sentence.
[0126] See also Figure 5 , Figure 5 Provided in the embodiments of this application Figure 1 The workflow diagram of steps S4 and S5 of a phased domain knowledge graph expansion method in FIG. Steps S4 and S5 include removing predicted triples exceeding a threshold based on a similarity matching algorithm and determining whether the attribute value of the triple to be expanded is true using an attribute discriminator, including:
[0127] Step S41: Map the entities and relationships in the original knowledge graph into vector representations, and set the upper similarity threshold to f; specifically, map the entities and relationships in the original knowledge graph into vector representations through a vector pre-training tool. The dimension of the vector should be consistent with the vector dimension of the prediction triple to be expanded. Here, the feature vector dimension can be set to, but is not limited to, 300 dimensions.
[0128] Step S42: Using the feature vectors corresponding to the head entity and the tail entity of the predicted triple as a benchmark, scan the original knowledge graph, calculate the similarity of the predicted triples to be expanded, and discard the predicted triples whose similarity exceeds a threshold. Specifically, the similarity between vectors here can be calculated using, but not limited to, cosine similarity, Pearson Correlation Coefficient, Euclidean Distance, Tanimoto Coefficient, Manhattan Distance and other similarity calculation methods. Preferably, Cosine Similarity is selected as the calculation method here.
[0129] Step S43: The qualified predicted triples are input into the local locator, and the corresponding local graph structure is matched through the head entity label to reduce the computational complexity; specifically, the radiation range of the local graph structure determined by the local locator can be, but is not limited to, set to the distance of 10-100 entities adjacent to the entity label.
[0130] Step S44: Use the common sense labels in the attribute discriminator to determine the attribute values of the predicted triples, and filter out the predicted triples that seriously deviate from the facts and discard them; specifically, it can be but not limited to using an artificially constructed common sense label library to further determine the attribute values of the predicted triples to be expanded, filter out the predicted triples with incorrect factual relationships and discard them.
[0131] See also Figure 6 , Figure 6 Provided in the embodiments of this application Figure 1 The workflow diagram of steps S6 and S7 of a phased domain knowledge graph expansion method in steps S6 and S7 is as follows. The steps of constructing a knowledge graph expansion model and obtaining a complete domain knowledge graph through the trained power domain knowledge graph expansion model in steps S6 and S7 include:
[0132] Step S61, construct an initialized electric power field knowledge graph expansion model; specifically, integrate the modules of natural language preprocessing, entity relationship extraction, entity alignment, predicted triple determination, knowledge fusion of triples to be expanded in the above steps into the electric power field knowledge graph expansion model.
[0133] Step S62: Use the initial training data to train the model and iteratively update the model parameters. Specifically, the training set data divided according to the ratio of 7:3 is input into the constructed knowledge graph expansion model for model training and the model parameters are iteratively updated. During model training, a multi-classification cross entropy function is set as the loss function of the entire model. The loss function formula is:
[0134]
[0135] Among them, δ is the parameter that the model needs to optimize, q represents the number of sentence sets, Indicates that when the parameter δ is known, the eigenvector Classification relation r j The probability of Represents the best combined sentence feature vector in the j-th sentence set.
[0136] Step S63: input the test corpus into the trained electric power domain knowledge graph expansion model to obtain a complete expanded domain knowledge graph.
[0137] See also Figure 7 , Figure 7A module architecture diagram of a phased domain knowledge graph expansion system provided in an embodiment of the present application. Similar in principle to the phased domain knowledge graph expansion method of the present invention, the present invention also provides a phased domain knowledge graph expansion system, which includes but is not limited to a corpus preprocessing device 10, a data segmenter 20, a relationship extractor 30, a local locator 40, an attribute discriminator 50, and a model creation and training device 60. The corpus preprocessing device 10 is used to obtain daily inspection data of power field equipment, preprocess the original corpus and eliminate invalid corpus that does not contain sensitive entity words, and then use remote supervision to expand the annotated data set based on the preprocessed corpus text. The data segmenter 20 is used to divide the data set into positive and negative samples, where the positive samples serve as the initial training data for entity relationship extraction and the negative samples serve as supplements. The relationship extractor 30 is used to obtain the predicted triple data to be expanded using a neural network model combined with an attention mechanism. The local locator 40 is used to match the corresponding local graph structure through the head entity label to reduce computational complexity. The attribute discriminator 50 is used to use common sense labels to determine the attribute values of the predicted triples, and filter out predicted triples that seriously deviate from the facts and discard them. The model creation and training device 60 is used to create the staged domain knowledge graph expansion model, train the model using initial training data, and iteratively update the model parameters.
[0138] In summary, the phased domain knowledge graph expansion method of the present invention can effectively solve the expansion needs of the power field defect inspection data set by pre-processing the unstructured data of daily inspections of power equipment defects into structured data, extracting the entities and relationships contained in the original corpus, and constructing and training the power field knowledge graph expansion model. This method can effectively use the continuously collected new data to solve the data sparsity problem of the power field knowledge graph, while ensuring that the data redundancy of the power field knowledge graph will not increase significantly, solving the need for iterative update of the data set of the equipment defect detection system in the power field that uses the knowledge graph as the database support, and can fundamentally improve the detection accuracy of the defect detection system.
[0139] In another aspect, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of any of the above methods.
[0140] On the other hand, the present invention further discloses a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any of the above methods.
[0141] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of any one of the methods in the above embodiments.
[0142] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts of the above method.
[0143] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0144] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A phased domain knowledge graph expansion method, characterized in that: include Obtain daily inspection data of power equipment, pre-process the original corpus and remove invalid corpus that does not contain sensitive entity words; Based on the preprocessed corpus text, a remotely supervised extended annotation dataset is used, and the dataset is divided into positive and negative samples by a data splitter, wherein the positive samples serve as initial training data for entity relationship extraction, and the negative samples serve as supplementary data; Use a neural network model combined with an attention mechanism to obtain the predicted triplet data to be expanded; The predicted triplets that exceed the threshold are removed through the similarity matching algorithm, and the remaining triplets are used to find the corresponding local graph structure through the local locator; The attribute discriminator is used to determine the truth or falsity of the triples to be expanded, and the triples with true attribute values are placed into the candidate domain of predicted triples; Constructing an electric power domain knowledge graph expansion model, and using the initial training data to train the model, and obtaining a complete domain knowledge graph through the trained electric power domain knowledge graph expansion model; Among them, the predicted triples exceeding the threshold are removed through the similarity matching algorithm, including: Map entities and relations in the original knowledge graph into vector representations; Set the upper similarity threshold to f; Taking the feature vectors corresponding to the head entity and the tail entity of the predicted triple as the benchmark, scan the original knowledge graph and calculate the cosine similarity of the predicted triple to be expanded; Prediction triplets whose similarity exceeds the threshold are discarded; The qualified predicted triples are input into the local locator, and the corresponding local graph structure is matched through the head entity label to reduce the computational complexity; The common sense labels in the attribute discriminator are used to determine the attribute values of the predicted triples, and the predicted triples that seriously deviate from the facts are screened out and discarded.
2. The phased domain knowledge graph expansion method according to claim 1 is characterized by: The acquisition of daily inspection data of power equipment, preprocessing of original corpus and removal of invalid corpus that does not contain sensitive entity words includes: Preload the original corpus of power equipment defect inspections and use the Hidden Markov Model to evaluate and obtain the optimal corpus segmentation results. Eliminate invalid corpus that does not contain sensitive entity words based on pre-labeled entity tags; The filtered valid corpus is classified, sorted and arranged according to the entity tags it contains for subsequent loading and use.
3. The phased domain knowledge graph expansion method according to claim 1 is characterized by: The method uses remote supervision to expand the labeled dataset and divides the dataset into positive and negative samples through a data splitter, including: Use the triplets in the existing knowledge base as manually selected seed sets; Align the corpus text to be processed with the knowledge base, extract sentences containing two entities, mark the corresponding relationship, and obtain a large amount of annotated training corpus; The training corpus is divided into data using a data segmenter, and sentences containing the same entity pair are used as positive samples of the corresponding relationship of the entity pair in the knowledge base; Semantic matching is performed on the positive sample and the corresponding relationship triplet. If the semantic difference is greater than a set value, it is listed as noise data and incorporated into the negative sample.
4. The phased domain knowledge graph expansion method according to claim 1 is characterized by: The method of obtaining the predicted triplet data to be expanded by using a neural network model combined with an attention mechanism includes: Use the glove pre-training tool to convert the corpus sentences to be processed into matrix form; Use zero-value vectors to fill statements of different lengths so that all statements have the same length; In the neural network model, a sliding window of size n is set to perform convolution operation with the feature matrix T of each sentence, and each sentence feature matrix T is regarded as a sequence, that is, ,in is the word vector representation obtained by the embedding layer, , Indicates the length of the sentence; assuming Indicates the content of the sentence arrive The vector connection, the convolution operation formula is as follows: in, It is the new feature generated by the convolution operation between the sentence feature and the filter. N represents the filter group in the model. Represents the features of the overlapping part with the filter, b represents the bias vector, , Represents the spatial domain of variable values; After expanding the filter group N in the above formula, it is expressed as multiple filters, that is, , where m represents the number of filters in the convolutional model, each filter gets a feature vector representation formula as follows: in, Represents the new features generated after the sentence features and filter convolution operations, Represents the features that overlap with the filter, represents the filter in the model, and b represents the bias vector; After the convolution layer operation is completed, a feature matrix will be output. , Represents the spatial domain of variable values; Get the feature matrix obtained after the convolution operation , each eigenvector , with the head entity and the tail entity as the dividing points, it is divided into the following three sections: , and respectively from The formula for obtaining the maximum value is as follows: After that, each eigenvector We get a three-dimensional pooling feature vector , based on this, all three-dimensional pooling feature vectors are connected to form Finally, the hyperbolic tangent function tanh is used for activation to generate a feature vector representation , the calculation formula is as follows: Finally, the input sentence feature matrix Perform conversion operations to generate high-level feature vectors , get the high-level feature vector representation set of each sentence ,in It is a sentence The feature vector generated by processing, is the number of sentences expressing relation r; The attention mechanism is used to calculate a weight for each sentence to represent the support degree of the sentence for the relation r. The sentences are sorted from high to low according to the weight, and then processed to generate a set of combined sentence feature vectors. The combined sentence feature vectors contained in the above combined sentence feature vector set are sequentially input into the softmax classifier, and then the conditional probability of each combined sentence feature vector on the relation r is calculated, and the best combined sentence feature vector is selected from them; Then the softmax layer selects the relationship label prediction structure of the best combined feature vector k with the highest score on the relationship r, and calculates the relationship prediction label vector of each sentence , and its calculation formula is as follows: Among them, k is the best combination feature vector, is the relation prediction label vector for each sentence.
5. The method for expanding domain knowledge graph in stages according to claim 4 is characterized in that: The method of using the glove pre-training tool to convert the corpus sentences to be processed into a matrix form includes: Use underscores to connect entities that appear in a sentence into a single word; Input the processed corpus into the glove model tool for training to obtain pre-trained word vectors; Then concatenate the words in the sentence one by one to obtain the feature representation matrix of the sentence.
6. The phased domain knowledge graph expansion method according to claim 1, characterized in that: The steps to set the iterative update parameters of the model loss function include: During model training, a multi-classification cross entropy function is set as the loss function of the entire model. The loss function formula is: in, is the parameter that the model needs to optimize, q represents the number of sentence sets, Indicates that the known parameters When the eigenvector Classification relationship The probability of Represents the best combined sentence feature vector in the j-th sentence set.
7. The phased domain knowledge graph expansion method according to claim 1 is characterized by: The step of obtaining a complete domain knowledge graph by expanding the trained electric power domain knowledge graph model includes: Build an initialized knowledge graph expansion model for the power sector; Training the model using initial training data and iteratively updating model parameters; Input the test corpus into the trained electric power domain knowledge graph expansion model to obtain the complete expanded domain knowledge graph.
8. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
A text relationship extraction method and system based on a hierarchical knowledge graph attention model
CN109902171A
Knowledge extraction method, apparatus, electronic device, and storage medium
WO2021212682A1