Power equipment knowledge graph error detection method and system based on knowledge reconstruction
Through a knowledge reconstruction method, the text and structural features of the power equipment knowledge graph are extracted, combined with the improved neural network for detection, the accuracy and generalization capabilities of error detection in the power equipment knowledge graph are solved, and more efficient error detection is achieved and feature capture.
Patent Information
- Application Number
- CN202411029038.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-29
AI Technical Summary
In the process of building a power equipment knowledge graph, there are a large number of errors and redundant information, which will affect the application effect and may even have adverse effects on the operation of the power system.
Using a method based on knowledge reconstruction, by establishing a triple of power knowledge graph, extracting text features and graph structure features, and combining with improved neural networks for text reconstruction and structure reconstruction, a power equipment knowledge graph detection model is established for detection. Errors in the knowledge graph.
The model's reconstruction accuracy and error detection ability of the power knowledge graph are improved, the capture of feature information in the power knowledge graph is enhanced, the model is overfitted, and the generalization ability is improved.
Smart Images

Figure CN119046474A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power equipment knowledge graph error detection, and in particular to a power equipment knowledge graph error detection method and system based on knowledge reconstruction. Background Art
[0002] In the context of the rapid progress and continuous expansion of today's smart grid, building and maintaining the knowledge graph of power equipment has become particularly critical and urgent. As a basic technical resource, the knowledge graph of power equipment plays an irreplaceable role in improving the operating efficiency of the power system, ensuring the safety and stability of the power grid, and promoting innovation in the power industry.
[0003] However, faced with data from a wide range of sources and in a variety of formats, it is inevitable that errors and redundant information will appear in the knowledge graph during the construction process. The existence of these errors and redundant information may affect the application effect of the power equipment knowledge graph and may even have an adverse impact on the operation of the power system. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the above existing problems, the present invention is proposed.
[0006] Therefore, the present invention provides a method and system for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction, which can solve the problems mentioned in the background technology.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In a first aspect, the present invention provides a method for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction, comprising:
[0009] According to the electric power unstructured knowledge base, establish an electric power knowledge graph triple of the target electric power equipment knowledge graph, and obtain a text description input sequence and a structure description input sequence for constructing the electric power knowledge graph triple according to the electric power knowledge graph triple;
[0010] According to the preset text encoder and structure encoder, the text features and graph structure features of the power knowledge graph triples are extracted, and the text and structure of the power knowledge graph triples are reconstructed by combining the improved neural network, and the power equipment knowledge graph detection model is established based on the reconstructed power knowledge graph triples;
[0011] The knowledge graph to be detected is used as the input of the power equipment knowledge graph detection model, and the power equipment knowledge graph error detection is performed based on the output results of the power equipment knowledge graph detection model.
[0012] As a preferred solution of the power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, wherein: the power knowledge graph triple of the target power equipment knowledge graph established according to the power unstructured knowledge base includes:
[0013] Preprocessing the electric power unstructured knowledge base and establishing a first entity recognition model, wherein the first entity recognition model is used to identify electric power equipment in the preprocessed electric power unstructured knowledge base;
[0014] Establishing a second relationship matching model, wherein the second relationship matching model is used to match the relationship between the power devices identified by the first entity recognition model;
[0015] According to the first entity recognition model and the second relationship matching model, a power knowledge graph triple of the target power equipment knowledge graph is established.
[0016] As a preferred solution of the electric power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, wherein: the text description input sequence and structure description input sequence of constructing the electric power knowledge graph triple are obtained according to the electric power knowledge graph triple, including:
[0017] The power equipment context in the power knowledge graph triples is extracted and word embedding is performed. After word embedding is completed, the embedded vectors of the context words are combined using a preset feedforward neural network to generate a context vector about the power equipment and complete the acquisition of the text description input sequence;
[0018] An adjacency matrix is established for the set of power equipment in the power knowledge graph triples, and the graph convolutional network is improved. The feature update formula for each layer of nodes is established to complete the acquisition of the structural description input sequence.
[0019] As a preferred solution of the power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, wherein: the extraction of text features and graph structure features of the power knowledge graph triples according to the preset text encoder and structure encoder includes:
[0020] An improved bidirectional long short-term memory network is used as the preset text encoder to encode the text description input sequence of the power knowledge graph triples to capture the contextual dependency of the power equipment text information and generate a text feature vector.
[0021] The improved graph attention network is used as the structural encoder to encode the structural description input sequence of the power knowledge graph triples. By calculating the attention weights between the nodes in the graph, the nodes that are important to the power equipment are focused on to generate the graph structure feature vector.
[0022] As a preferred solution of the power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, the text reconstruction and structure reconstruction of the power knowledge graph triples in combination with the improved neural network include:
[0023] According to the text feature vector and graph structure feature vector of the electric power knowledge graph triple, an improved neural network model is designed, wherein the improved neural network model can process both text information and graph structure information at the same time;
[0024] By improving the decoder part of the neural network model, the text feature vector and the graph structure feature vector are fused, and the text description sequence and relationship description sequence of the reconstructed power knowledge graph triples are generated;
[0025] For the text description sequence, an improved attention mechanism is used to focus on the preset vocabulary description of the power equipment target;
[0026] For the relationship description sequence, the attention weights between nodes in the graph are calculated by improving the attention mechanism, focusing on the relationship description of the preset nodes of the power equipment relationship.
[0027] As a preferred solution of the power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, wherein: the establishment of a power equipment knowledge graph detection model according to the reconstructed power knowledge graph triples includes:
[0028] The reconstructed power knowledge graph triples are divided into training set, validation set and test set. The training set is used to train the power equipment knowledge graph detection model, the validation set is used to adjust the model's hyperparameters to prevent overfitting, and the test set is used to evaluate the model's performance.
[0029] The main framework of the electric power equipment knowledge graph detection model is constructed, and the main framework includes an input layer, a feature extraction layer, a fusion layer, a reconstruction layer and an output layer. The input layer is used to receive the electric power knowledge graph triples to be detected; the feature extraction layer uses a preset text encoder and a structure encoder to extract text features and graph structure features; the fusion layer is used to effectively fuse the two features; the reconstruction layer is used to reconstruct the electric power knowledge graph triples according to the fused features; the output layer is used to output the difference between the reconstruction result and the original triples as an indicator of error detection.
[0030] During the training process, the parameters of the model are optimized through the back-propagation algorithm and the gradient descent method, so that the power equipment knowledge graph detection model can identify errors in the power knowledge graph. At the same time, the validation set is used to adjust the hyperparameters of the model.
[0031] As a preferred solution of the electric power equipment knowledge graph error detection method based on knowledge reconstruction described in the present invention, wherein: the knowledge graph to be detected is used as the input of the electric power equipment knowledge graph detection model, and the electric power equipment knowledge graph error detection is performed according to the output result of the electric power equipment knowledge graph detection model, including:
[0032] For the input knowledge graph to be detected, it is first preprocessed to ensure that it matches the input format expected by the power equipment knowledge graph detection model;
[0033] The knowledge graph to be detected is taken as input and processed through various levels of the power equipment knowledge graph detection model;
[0034] In the feature extraction layer, the preset text encoder and structure encoder are used to extract the text features and graph structure features of the knowledge graph to be detected respectively;
[0035] In the fusion layer, the extracted text features and graph structure features are effectively fused;
[0036] In the reconstruction layer, based on the fused features, the improved neural network model is used to reconstruct the triples of the power knowledge graph;
[0037] In the output layer, the difference between the reconstruction result with the highest confidence and the original triplet is used as the indicator of error detection;
[0038] According to the size of the difference, determine whether there are errors in the power knowledge graph.
[0039] In a second aspect, the present invention provides a knowledge graph error detection system for electric power equipment based on knowledge reconstruction, comprising:
[0040] An input sequence acquisition module is used to establish a power knowledge graph triple of a target power equipment knowledge graph according to a power unstructured knowledge base, and to acquire a text description input sequence and a structure description input sequence for constructing the power knowledge graph triple according to the power knowledge graph triple;
[0041] A model building module is used to extract text features and graph structure features of the power knowledge graph triples according to a preset text encoder and structure encoder, and to perform text reconstruction and structure reconstruction on the power knowledge graph triples in combination with an improved neural network, and to establish a power equipment knowledge graph detection model based on the reconstructed power knowledge graph triples;
[0042] The detection module is used to use the knowledge graph to be detected as the input of the power equipment knowledge graph detection model, and perform power equipment knowledge graph error detection based on the output results of the power equipment knowledge graph detection model.
[0043] In a third aspect, the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method when executing the computer program.
[0044] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method described above when executed by a processor.
[0045] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention proposes a method and system for detecting errors in the knowledge graph of electric equipment based on knowledge reconstruction, establishes an electric knowledge graph triple of the target electric equipment knowledge graph according to the electric power unstructured knowledge base, and obtains the text description input sequence and the structure description input sequence for constructing the electric knowledge graph triple according to the electric knowledge graph triple; extracts the text features and graph structure features of the electric knowledge graph triple according to the preset text encoder and structure encoder, and performs text reconstruction and structure reconstruction on the electric knowledge graph triple in combination with the improved neural network, and establishes an electric equipment knowledge graph detection model according to the reconstructed electric knowledge graph triple; uses the knowledge graph to be detected as the input of the electric equipment knowledge graph detection model, and performs electric equipment knowledge graph error detection according to the output result of the electric equipment knowledge graph detection model. The present application realizes the simultaneous processing of the text information and graph structure information of the electric knowledge graph triple by improving the design of the neural network model, so as to more comprehensively capture the feature information in the electric knowledge graph. This design not only improves the model's reconstruction accuracy of the power knowledge graph triples, but also enhances the model's ability to detect errors in the power knowledge graph.
[0046] The power equipment knowledge graph detection model proposed in this application uses the back propagation algorithm and gradient descent method to optimize the model parameters during the training process, so that the model can better adapt to the characteristics of the power knowledge graph data. At the same time, using the validation set to adjust the model's hyperparameters can effectively prevent the model from overfitting and improve the model's generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0048] Figure 1 A method flow chart of a method and system for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction provided by an embodiment of the present invention;
[0049] Figure 2 An internal structure diagram of a computer device of a method and system for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0051] Example 1
[0052] Reference Figure 1-Figure 2 , is the first embodiment of the present invention, which provides a method and system for detecting errors in a knowledge graph of electric equipment based on knowledge reconstruction, including a method for detecting errors in a knowledge graph of electric equipment based on knowledge reconstruction and a system for detecting errors in a knowledge graph of electric equipment based on knowledge reconstruction, wherein a method for detecting errors in a knowledge graph of electric equipment based on knowledge reconstruction includes:
[0053] Before describing the embodiments of the present application in detail, some related concepts are first explained for the sake of clarity.
[0054] Electric power unstructured knowledge base: This refers to a large collection of unorganized or semi-organized data containing information about the electric power industry. This data may come from various sources, such as technical documents, manuals, research papers, meeting minutes, expert interview records, regulatory standards documents, etc. The information in unstructured knowledge bases usually does not follow a fixed pattern or format, so special technologies and methods are required to parse and understand this information. For example, text mining, natural language processing (NLP) and machine learning technologies are often used to extract meaningful information from such knowledge bases.
[0055] Power knowledge graph: A knowledge graph is a data structure that organizes information in a graphical form, where nodes represent entities and edges represent relationships between entities. In the power sector, the power knowledge graph represents various concepts, equipment, standards, specifications, and interactions between power systems in a structured manner. This helps in decision-making, fault diagnosis, operation and maintenance management, and automated control within the power industry. The knowledge graph stores information in the form of triples (Subject, Predicate, Object), where Subject is the subject, Predicate is the predicate, and Object is the object.
[0056] Text encoder: A text encoder is a component in natural language processing that converts text into numerical representations that can be understood by computers, i.e., vectors or tensors. Common text encoders include word embedding models such as Word2Vec and GloVe, as well as neural network-based encoders such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), gated recurrent units (GRUs), and Transformers. These encoders can capture the meaning, grammatical structure, and contextual information of words, so that they can be used in subsequent tasks (such as classification, clustering, and question-answering systems).
[0057] Structural encoder: The structural encoder mainly processes graph structure data and is used to extract the features of nodes and edges in the graph. In the context of the power knowledge graph, the structural encoder may refer to a graph convolutional network (GCN), a graph attention network (GAT), or other types of graph neural networks (GNN). These models can learn the embedded representation of nodes while taking into account the position of the node in the graph and the features of other nodes connected to it. The structural encoder updates the representation of each node by iteratively aggregating the information of neighboring nodes to obtain the feature vector of the graph structure.
[0058] In the related art, there are some methods for detecting errors in the knowledge graph of power equipment, but these methods often only focus on the processing of text information and ignore the importance of graph structure information. Such methods may lose some key structural information when processing the power knowledge graph, resulting in low accuracy of error detection.
[0059] This application provides an effective solution to the above-mentioned problems. Next, we will combine multiple embodiments to explain in detail how to implement the knowledge graph error detection method for power equipment based on knowledge reconstruction;
[0060] Figure 1 A method flow chart of a method and system for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction is shown, including:
[0061] S101. Based on the power unstructured knowledge base, establish the power knowledge graph triples of the target power equipment knowledge graph, and obtain the text description input sequence and the structure description input sequence for constructing the power knowledge graph triples according to the power knowledge graph triples;
[0062] Among them, establishing the power knowledge graph triples of the target power equipment knowledge graph based on the power unstructured knowledge base includes:
[0063] Preprocess the power unstructured knowledge base and establish a first entity recognition model, which is used to identify power equipment in the preprocessed power unstructured knowledge base;
[0064] Establish a second relationship matching model, which is used to match the relationships between the power equipment identified by the first entity recognition model;
[0065] Based on the first entity recognition model and the second relationship matching model, establish the power knowledge graph triples of the target power equipment knowledge graph.
[0066] In the embodiment of the present application, the establishment steps of the first entity recognition model are as follows:
[0067] For the preprocessed power unstructured knowledge base, remove irrelevant characters such as punctuation marks, numbers (unless they are part of an entity), HTML tags, etc. Use a tokenizer suitable for the power field to split the text into lexical units. Restore the words to their basic forms to reduce lexical variations. Remove common stop words such as "of", "and", "in", etc. Use a named entity recognition (NER) tool or model to identify the names of power equipment.
[0068] For example, let's assume the scenario "In a 500kV substation, transformer T1 is connected to circuit breaker CB1 via bus BB1, and circuit breaker CB1 is responsible for controlling the on and off of line L1." First, remove all irrelevant punctuation and numbers (unless they are part of an entity), as well as any HTML tags (if they exist). In this example, just remove commas: such as "In a 500kV substation, transformer T1 is connected to circuit breaker CB1 via bus BB1, and circuit breaker CB1 is responsible for controlling the on and off of line L1." Use a pre-trained or custom tokenizer to segment the text into vocabulary units. Here, we use the Jieba tokenizer and add a dictionary of special terms in the power field: such as "in", "500kV", "substation", "in", "transformer", "T1", "through", "busbar", "BB1", "and", "circuit breaker", "CB1", "connected", "and", "circuit breaker", "CB1", "responsible for", "control", "line", "L1", "of", "on and off"; stemming and morphological restoration, this step is to reduce vocabulary variants, for example, "control" and "controller" are both converted to "control". However, in Chinese, stemming and morphological restoration are usually not as important as in English, because Chinese vocabulary has fewer morphological changes. However, some phrases can be simplified, such as simplifying "responsible for control" to "control": such as "in", "500kV", "substation", "in", "transformer", "T1", "through", "busbar", "BB1", "and", "circuit breaker", "CB1", "connected", "and", "circuit breaker", "CB1", "control", "line", "L1", "on and off"; remove common stop words, such as "of", "and", "in", etc., which usually do not carry important information in semantic analysis: such as "500kV", "substation", "transformer", "T1", "through", "busbar", "BB1", "and", "circuit breaker", "CB1", "connected", "and", "circuit breaker", "CB1", "control", "line", "L1", "on and off"; use named entity recognition tools Tools are used to mark the names of power equipment: such as "500kV": voltage level; "substation": location / facility; "transformer T1": entity, type is transformer; "busbar BB1": entity, type is busbar; "circuit breaker CB1": entity, type is circuit breaker; "line L1": entity, type is line; the final processing result can be: entities: [("transformer T1", "Transformer"), ("busbar BB1", "Busbar"), ("circuit breaker CB1", "CircuitBreaker"), ("line L1", "Line")]; relationship candidates: ["connected", "controlled"]; context vocabulary: ["500kV", "substation"].
[0069] Furthermore, features that are helpful for entity recognition are extracted from the text, such as part of speech, contextual vocabulary, vocabulary frequency, etc. Use the labeled power equipment name dataset to train CRF (conditional random field), LSTM (long short-term memory network) or other deep learning models (this application uses CRF). Apply the model to unlabeled text to identify power equipment entities.
[0070] For example, let X = {x1, x2, ..., x n} is the input feature vector sequence, Y = {y1,y2,...,y n} is the corresponding entity label sequence, then the objective function of the CRF model can be expressed as:
[0071]
[0072] Among them, φ(x i ,y i ) represents the state characteristic function, ψ(y i ,y i+1 ) represents the transfer characteristic function, and Z(X) is the normalization factor.
[0073] In an optional embodiment, the first entity recognition model can also be established through deep learning models, multi-task learning, transfer learning, semi-supervised learning and other steps.
[0074] In the embodiment of the present application, the steps for establishing the second relationship matching model are as follows:
[0075] Define the possible relationship types between power equipment, such as connection relationship, inclusion relationship, etc. Extract features that are helpful for relationship classification from the entity (power equipment) context. Use labeled relationship datasets to train models such as SVM (support vector machine) and neural network to classify different relationship types. Apply the model to predict the relationship between entities.
[0076] For example, let R be a set of relation types, Given two entities (electrical equipment) e1 and e2, the model output can be expressed as:
[0077]
[0078] In an embodiment of the present application, a power knowledge graph triple is constructed, and the results of entity recognition and relationship matching are combined into a triple form (e1, r, e2), where e1 and e2 are entities, and r is the relationship between them.
[0079] In an optional embodiment, the second relationship matching model can also be established through integrated learning, reinforcement learning, rule-based model and other means.
[0080] In the embodiment of the present application, obtaining a text description input sequence and a structure description input sequence for constructing a power knowledge graph triple according to the power knowledge graph triple includes:
[0081] The power equipment context in the power knowledge graph triples is extracted and word embedding is performed. After word embedding is completed, the embedded vectors of the context words are combined using a preset feedforward neural network to generate a context vector about the power equipment and complete the acquisition of the text description input sequence;
[0082] An adjacency matrix is established for the set of power equipment in the power knowledge graph triples, and the graph convolutional network is improved. The feature update formula for each layer of nodes is established to complete the acquisition of the structural description input sequence.
[0083] In the embodiment of the present application, the specific steps of obtaining the text description input sequence may be:
[0084] Step 1: Power equipment context extraction,For each power equipment, extract the sentence containing the equipment from the text as its context. Use a tokenizer to segment the sentence into words or morphemes.
[0085] Step 2: Word embedding, apply word embedding technology (such as Word2Vec, GloVe or FastText) to convert each word into a fixed-length vector. Assuming the word embedding dimension is d, then word w i The embedding vector is represented as
[0086] Step 3: Feedforward neural network combination, input the word embedding vector in each context into a preset feedforward neural network. This neural network can be composed of a series of fully connected layers. Assuming that the network has L layers, the output of the lth layer is expressed as Where i represents the index of the input word embedding.
[0087] The output of each layer is calculated as follows:
[0088]
[0089] in, is the weight matrix, is the bias vector and σ is the nonlinear activation function (such as ReLU).
[0090] set up
[0091] Step 4: Generate context vector. For all word embedding vectors in a given context, combine the output of the last layer into a context vector c through an average or maximum pooling operation.
[0092] In the embodiment of the present application, the specific steps of obtaining the structure description input sequence may be:
[0093] Step 1: Establish an adjacency matrix. Establish an adjacency matrix A based on the set of power equipment, where A ij = 1 if device i has a direct relationship with device j, otherwise A ij =0.
[0094] Step 2: Improve the graph convolutional network and use the graph convolutional network (GCN) or its variants (such as GraphSAGE, GAT, etc.) to update node features. The feature update formula of GCN can be expressed as:
[0095]
[0096] Among them, H (k) is the node feature matrix of the kth layer, W (k) is the weight matrix, σ is the nonlinear activation function is the diagonal plus the identity matrix to include self-loops, is the symmetric normalized degree matrix.
[0097] Step 3: Generate a structure description vector. After K layers of GCN update, the final feature vector of each node can be expressed as For a specific power device, its structural description vector is
[0098] For example, an example is set as follows: "A transformer is a stationary electrical device used to increase or decrease AC voltage through the principle of electromagnetic induction. It is usually composed of an iron core with two or more windings, one of which is called a primary winding and the other is called a secondary winding." When obtaining a text description input sequence, the specific operations are as follows:
[0099] Step 1: Context extraction, extracting sentences containing “transformer”: “A transformer is a stationary electrical device used to increase or decrease alternating voltage through the principle of electromagnetic induction.”
[0100] Step 2: Word Embedding, segment and embed words, for example, "transformer" may be mapped to the vector [0.1, 0.5, -0.3, ...] [0.1, 0.5, -0.3, ...].
[0101] Step 3: Feedforward neural network combination. Input all word embedding vectors into the feedforward neural network. For example, for the word "transformer", the output after the first layer may be [0.2, 0.6, -0.4, ...][0.2, 0.6, -0.4, ...], and after the second layer may be [0.3, 0.7, -0.5, ...][0.3, 0.7, -0.5, ...].
[0102] Step 4: Generate context vector, the output vector of the last layer is pooled (e.g., average or maximum) to create the context vector. If the final output vectors are [0.3, 0.7, -0.5, ...] and [0.4, 0.8, -0.6, ...], then the vector after average pooling may be [0.35, 0.75, -0.55, ...] [0.35, 0.75, -0.55, ...].
[0103] When obtaining the structure description input sequence, the specific operations are as follows:
[0104] Suppose there are three devices: transformer T, generator G, and circuit breaker B. Suppose T is connected to G but not directly to B, while G is connected to B. The adjacency matrix A may look like this:
[0105]
[0106] Step 2: Improve the graph convolutional network, assuming that the initial feature matrix H (0) is composed of word embeddings, such as Iteratively update the feature matrix through the GCN update formula to obtain H (1) , H (2) , until H (K) .
[0107] Step 3: Generate structure description vector, It is the structural description vector of the transformer, which contains the information about the connection relationship with other devices.
[0108] It should be noted that S101 can effectively extract contextual information related to power equipment from text, and encode this information through word embedding technology and feedforward neural network, thereby generating a context vector that can accurately reflect the characteristics of the equipment. This step not only helps to deeply understand the properties and functions of power equipment, but also provides strong data support for subsequent analysis and prediction.
[0109] S102, extracting text features and graph structure features of the electric power knowledge graph triples according to a preset text encoder and structure encoder, and reconstructing the text and structure of the electric power knowledge graph triples in combination with an improved neural network, and establishing an electric power equipment knowledge graph detection model according to the reconstructed electric power knowledge graph triples;
[0110] In the embodiment of the present application, according to the preset text encoder and structure encoder, extracting the text features and graph structure features of the power knowledge graph triples includes:
[0111] An improved bidirectional long short-term memory network is used as the preset text encoder to encode the text description input sequence of the power knowledge graph triples to capture the contextual dependency of the power equipment text information and generate a text feature vector.
[0112] The improved graph attention network is used as the structural encoder to encode the structural description input sequence of the power knowledge graph triples. By calculating the attention weights between the nodes in the graph, the nodes that are important to the power equipment are focused on to generate the graph structure feature vector.
[0113] In the embodiment of the present application, the specific steps of using the improved BiLSTM encoding text description are as follows:
[0114] Step 1.1: Preprocessing and word embedding, convert the text description of the power equipment into a sequence of words. Apply word embedding to map each word to a vector in a high-dimensional space.
[0115] Step 1.2: Improve BiLSTM encoding and use bidirectional LSTM (BiLSTM) to process the sequence. The improved BiLSTM reads the sequence from front to back and back to front at the same time, thereby capturing contextual dependencies.
[0116] The mathematical expression is:
[0117]
[0118] in, is the hidden state from left to right, is the hidden state from right to left. → and LSTM ← Represent the forward and backward LSTM units respectively.
[0119] Step 1.3: Output the sequence feature vector. You can choose the hidden state of the last time step in the sequence or the average / maximum pooling of the hidden states of all time steps as the feature representation of the entire sequence.
[0120] In the embodiment of the present application, the specific steps described using the improved graph attention network coding structure are as follows:
[0121] Step 2.1: Construct an adjacency matrix. Construct an adjacency matrix A based on the relationship between power equipment.
[0122] Step 2.2: Improved graph attention network encoding, use the improved graph attention mechanism to calculate the relationship weights between nodes, which allows the network to focus on more important neighbor nodes. The mathematical expression is:
[0123] In the improved GAT, for nodes i and j, the attention coefficient α ijis based on their embedding h i and h j Computational
[0124]
[0125] Where a is the learnable weight vector, W is the shared weight matrix, is the set of neighbors of node i.
[0126] Step 2.3: Update node features and use the attention coefficient to weight the features of neighboring nodes to update the node's feature vector. Use the attention coefficient to weight the features of neighboring nodes to update the node's feature vector. The mathematical expression is:
[0127] The updated feature vector h′ of node i i for:
[0128]
[0129] Here, σ is the activation function, such as ReLU.
[0130] In the embodiment of the present application, text reconstruction and structural reconstruction of the power knowledge graph triples in combination with the improved neural network include:
[0131] According to the text feature vector and graph structure feature vector of the electric power knowledge graph triple, an improved neural network model is designed to meet the requirements of processing text information and graph structure information at the same time;
[0132] By improving the decoder part of the neural network model, the text feature vector and the graph structure feature vector are fused, and the text description sequence and relationship description sequence of the reconstructed power knowledge graph triples are generated;
[0133] For the text description sequence, an improved attention mechanism is used to focus on the preset vocabulary description of the power equipment target;
[0134] For the relationship description sequence, the attention weights between nodes in the graph are calculated by improving the attention mechanism, focusing on the relationship description of the preset nodes of the power equipment relationship.
[0135] In the embodiment of the present application, the text reconstruction and structure reconstruction of the power knowledge graph triples are performed in combination with the improved neural network as follows:
[0136] Use a text encoder (such as BiLSTM, BERT, etc.) to convert the description of each entity into a fixed-length vector. Assume that the input text description is T, and its vector is represented by h T .
[0137] h T =Encoder(T)
[0138] The improved graph convolutional network (GCN), graph attention network (GAT) or other graph neural network (GNN) is used to encode the graph structure. Assume that the graph structure is G and its vector is represented as h G .
[0139] h G =GNN(G)
[0140] Fuse the text feature vector and graph structure feature vector into a unified representation. This can be achieved through simple concatenation, weighted summation, or more complex interaction mechanisms.
[0141] h fusion =Fusion(h T ,h G )
[0142] For example, this application uses a weighted sum:
[0143] h fusion =α·h T +β·h G
[0144] Among them, α and β are learnable weights.
[0145] Design a decoder based on the fused feature vector h fusion Generate a sequence of reconstructed text descriptions and relationship description sequence
[0146]
[0147] The attention mechanism is added to the decoder so that the model can focus on the preset vocabulary of power equipment targets when generating text descriptions. Attention weight a t Based on the preset vocabulary V target calculate.
[0148] a t =Attention(h fusion ,V target )
[0149] Relational attention: For a relational description sequence, the attention weight a between nodes in the graph is calculated r , focusing on the relationship description of preset nodes of power equipment relationship.
[0150] a r =Attention(h fusion ,E relation )
[0151] Define a suitable loss function for comparing the generated sequences and with the actual sequences T and R.
[0152] This may include cross entropy loss, mean squared error, or other suitable loss functions.
[0153]
[0154] In an embodiment of the present application, establishing a power equipment knowledge graph detection model according to the reconstructed power knowledge graph triples includes:
[0155] The reconstructed power knowledge graph triples are divided into training set, validation set and test set. The training set is used to train the power equipment knowledge graph detection model, the validation set is used to adjust the model's hyperparameters to prevent overfitting, and the test set is used to evaluate the model's performance.
[0156] The main framework of the power equipment knowledge graph detection model is constructed. The main framework includes an input layer, a feature extraction layer, a fusion layer, a reconstruction layer and an output layer. The input layer is used to receive the power knowledge graph triples to be detected; the feature extraction layer uses a preset text encoder and a structure encoder to extract text features and graph structure features; the fusion layer is used to effectively fuse the two features; the reconstruction layer is used to reconstruct the power knowledge graph triples according to the fused features; the output layer is used to output the difference between the reconstruction result and the original triples as an indicator for error detection.
[0157] During the training process, the parameters of the model are optimized through the back-propagation algorithm and the gradient descent method, so that the power equipment knowledge graph detection model can identify errors in the power knowledge graph. At the same time, the validation set is used to adjust the hyperparameters of the model.
[0158] It should be noted that, by combining the improved bidirectional long short-term memory network and the improved graph attention network, the electric power equipment knowledge graph detection model in the embodiment of the present application can simultaneously capture the text features and graph structure features of the electric power knowledge graph triples, thereby more comprehensively understanding and analyzing the information in the electric power equipment knowledge graph. This not only improves the model's ability to parse the electric power knowledge graph, but also provides a solid foundation for subsequent electric power equipment knowledge graph error detection.
[0159] S103, using the knowledge graph to be detected as the input of the power equipment knowledge graph detection model, and performing power equipment knowledge graph error detection based on the output results of the power equipment knowledge graph detection model.
[0160] In an embodiment of the present application, the knowledge graph to be detected is used as the input of the electric equipment knowledge graph detection model, and the electric equipment knowledge graph error detection is performed according to the output result of the electric equipment knowledge graph detection model, including:
[0161] For the input knowledge graph to be detected, it is first preprocessed to ensure that it matches the input format expected by the power equipment knowledge graph detection model;
[0162] The knowledge graph to be detected is taken as input and processed through various levels of the power equipment knowledge graph detection model;
[0163] In the feature extraction layer, the preset text encoder and structure encoder are used to extract the text features and graph structure features of the knowledge graph to be detected respectively;
[0164] In the fusion layer, the extracted text features and graph structure features are effectively fused;
[0165] In the reconstruction layer, based on the fused features, the improved neural network model is used to reconstruct the triples of the power knowledge graph;
[0166] In the output layer, the difference between the reconstruction result with the highest confidence and the original triplet is used as the indicator of error detection;
[0167] According to the size of the difference, determine whether there are errors in the power knowledge graph.
[0168] In the embodiment of the present application, accuracy, recall rate and F1 value are used as the main indicators for evaluating the error detection performance of the power equipment knowledge graph.
[0169] In summary, the present invention proposes a method for detecting errors in the knowledge graph of electric equipment based on knowledge reconstruction. According to the electric power unstructured knowledge base, the electric power knowledge graph triple of the target electric power equipment knowledge graph is established, and the text description input sequence and the structure description input sequence for constructing the electric power knowledge graph triple are obtained according to the electric power knowledge graph triple; according to the preset text encoder and structure encoder, the text features and graph structure features of the electric power knowledge graph triple are extracted, and the text and structure reconstruction of the electric power knowledge graph triple are performed in combination with the improved neural network, and the electric power equipment knowledge graph detection model is established according to the reconstructed electric power knowledge graph triple; the knowledge graph to be detected is used as the input of the electric power equipment knowledge graph detection model, and the electric power equipment knowledge graph error detection is performed according to the output result of the electric power equipment knowledge graph detection model. This application realizes the simultaneous processing of the text information and graph structure information of the electric power knowledge graph triple by improving the design of the neural network model, so that the feature information in the electric power knowledge graph can be captured more comprehensively. This design not only improves the reconstruction accuracy of the model for the electric power knowledge graph triple, but also enhances the model's ability to detect errors in the electric power knowledge graph.
[0170] This embodiment also provides a power equipment knowledge graph error detection system based on knowledge reconstruction, including:
[0171] An input sequence acquisition module is used to establish a power knowledge graph triple of a target power equipment knowledge graph according to a power unstructured knowledge base, and to acquire a text description input sequence and a structure description input sequence for constructing the power knowledge graph triple according to the power knowledge graph triple;
[0172] A model building module is used to extract text features and graph structure features of the power knowledge graph triples according to a preset text encoder and structure encoder, and to perform text reconstruction and structure reconstruction on the power knowledge graph triples in combination with an improved neural network, and to establish a power equipment knowledge graph detection model based on the reconstructed power knowledge graph triples;
[0173] The detection module is used to use the knowledge graph to be detected as the input of the power equipment knowledge graph detection model, and perform power equipment knowledge graph error detection based on the output results of the power equipment knowledge graph detection model.
[0174] The above-mentioned unit modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above-mentioned modules.
[0175] This embodiment also provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 2As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0176] This embodiment further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0177] According to the electric power unstructured knowledge base, establish the electric power knowledge graph triple of the target electric power equipment knowledge graph, and obtain the text description input sequence and structure description input sequence for constructing the electric power knowledge graph triple according to the electric power knowledge graph triple;
[0178] According to the preset text encoder and structure encoder, the text features and graph structure features of the power knowledge graph triples are extracted, and the text and structure of the power knowledge graph triples are reconstructed by combining the improved neural network, and the power equipment knowledge graph detection model is established based on the reconstructed power knowledge graph triples;
[0179] The knowledge graph to be detected is used as the input of the power equipment knowledge graph detection model, and the power equipment knowledge graph error detection is performed based on the output results of the power equipment knowledge graph detection model.
[0180] Example 2
[0181] Reference Figure 1-Figure 2 , which is an embodiment of the present invention, provides a method and system for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.
[0182] Experimental setup,Several public data sets in the power field are selected, which contain unstructured text data, structured knowledge graph data and corresponding error annotation information of power equipment.,By preprocessing these data, a knowledge graph dataset for training and testing is constructed.
[0183] Different baseline methods and whether to improve the neural network model in the power equipment knowledge graph detection model. In order to find the best model configuration, multiple experiments were conducted on the training set and parameters were adjusted based on the performance indicators of the validation set.
[0184] The accuracy, recall and F1 value are used as the main indicators to evaluate the error detection performance of the power equipment knowledge graph. At the same time, the performance indicators such as the model training time and detection time are also recorded to evaluate the efficiency of the model.
[0185] Table 1: Experimental results:
[0186]
[0187] The accuracy of the method of the present application (improved neural network) reached 0.91, which is about 9% and 6% higher than the baseline methods A and B, respectively, which shows that our method is more accurate in identifying errors. The recall rate was improved to 0.88, which means that we can detect more actual errors, and the recall rate was improved by 17% and 10% respectively compared with the baseline methods A and B. The F1 value is the harmonic mean of the accuracy and recall rate. The F1 value of the method of the present invention (improved neural network) is 0.89, showing a good balance between accuracy and comprehensiveness of the model. Although the training time increased slightly (from 3.5 hours to 4.2 hours), this is usually due to the increase in model complexity and deeper feature extraction, which is an expected sacrifice in exchange for higher accuracy. It is worth noting that the method of the present invention (improved neural network) is shorter in detection time, which is 0.015 seconds per item, which shows that our model can respond quickly and efficiently in practical applications.
[0188] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
[0189] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0190] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0191] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0192] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0193] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0194] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for detecting errors in a knowledge graph of electric power equipment based on knowledge reconstruction, characterized in that: include: According to the electric power unstructured knowledge base, establish an electric power knowledge graph triple of the target electric power equipment knowledge graph, and obtain a text description input sequence and a structure description input sequence for constructing the electric power knowledge graph triple according to the electric power knowledge graph triple; According to the preset text encoder and structure encoder, the text features and graph structure features of the power knowledge graph triples are extracted, and the text and structure of the power knowledge graph triples are reconstructed by combining the improved neural network, and the power equipment knowledge graph detection model is established based on the reconstructed power knowledge graph triples; The knowledge graph to be detected is used as the input of the power equipment knowledge graph detection model, and the power equipment knowledge graph error detection is performed based on the output results of the power equipment knowledge graph detection model.
2. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 1, characterized in that: The electric power knowledge graph triples for establishing the target electric power equipment knowledge graph according to the electric power unstructured knowledge base include: Preprocessing the electric power unstructured knowledge base and establishing a first entity recognition model, wherein the first entity recognition model is used to identify electric power equipment in the preprocessed electric power unstructured knowledge base; Establishing a second relationship matching model, wherein the second relationship matching model is used to match the relationship between the power devices identified by the first entity recognition model; According to the first entity recognition model and the second relationship matching model, a power knowledge graph triple of the target power equipment knowledge graph is established.
3. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 2, characterized in that: The step of acquiring a text description input sequence and a structure description input sequence for constructing a power knowledge graph triple according to the power knowledge graph triple comprises: The power equipment context in the power knowledge graph triples is extracted and word embedding is performed. After word embedding is completed, the embedded vectors of the context words are combined using a preset feedforward neural network to generate a context vector about the power equipment and complete the acquisition of the text description input sequence; An adjacency matrix is established for the set of power equipment in the power knowledge graph triples, and the graph convolutional network is improved. The feature update formula for each layer of nodes is established to complete the acquisition of the structural description input sequence.
4. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 3 is characterized in that: The extracting of text features and graph structure features of the electric power knowledge graph triples according to the preset text encoder and structure encoder includes: An improved bidirectional long short-term memory network is used as the preset text encoder to encode the text description input sequence of the power knowledge graph triples to capture the contextual dependency of the power equipment text information and generate a text feature vector. The improved graph attention network is used as the structural encoder to encode the structural description input sequence of the power knowledge graph triples. By calculating the attention weights between the nodes in the graph, the nodes that are important to the power equipment are focused on to generate the graph structure feature vector.
5. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 4, characterized in that: The text reconstruction and structure reconstruction of the electric power knowledge graph triples by combining the improved neural network includes: According to the text feature vector and graph structure feature vector of the electric power knowledge graph triple, an improved neural network model is designed, wherein the improved neural network model can process both text information and graph structure information at the same time; By improving the decoder part of the neural network model, the text feature vector and the graph structure feature vector are fused, and the text description sequence and relationship description sequence of the reconstructed power knowledge graph triples are generated; For the text description sequence, an improved attention mechanism is used to focus on the preset vocabulary description of the power equipment target; For the relationship description sequence, the attention weights between nodes in the graph are calculated by improving the attention mechanism, focusing on the relationship description of the preset nodes of the power equipment relationship.
6. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 5, characterized in that: The step of establishing a power equipment knowledge graph detection model according to the reconstructed power knowledge graph triples includes: The reconstructed power knowledge graph triples are divided into training set, validation set and test set. The training set is used to train the power equipment knowledge graph detection model, the validation set is used to adjust the model's hyperparameters to prevent overfitting, and the test set is used to evaluate the model's performance. The main framework of the electric power equipment knowledge graph detection model is constructed, and the main framework includes an input layer, a feature extraction layer, a fusion layer, a reconstruction layer and an output layer. The input layer is used to receive the electric power knowledge graph triples to be detected; the feature extraction layer uses a preset text encoder and a structure encoder to extract text features and graph structure features; the fusion layer is used to effectively fuse the two features; the reconstruction layer is used to reconstruct the electric power knowledge graph triples according to the fused features; the output layer is used to output the difference between the reconstruction result and the original triples as an indicator of error detection. During the training process, the parameters of the model are optimized through the back-propagation algorithm and the gradient descent method, so that the power equipment knowledge graph detection model can identify errors in the power knowledge graph. At the same time, the validation set is used to adjust the hyperparameters of the model.
7. The method for detecting errors in the knowledge graph of electric power equipment based on knowledge reconstruction according to claim 6, characterized in that: The method of using the knowledge graph to be detected as the input of the electric equipment knowledge graph detection model and performing electric equipment knowledge graph error detection according to the output result of the electric equipment knowledge graph detection model includes: For the input knowledge graph to be detected, it is first preprocessed to ensure that it matches the input format expected by the power equipment knowledge graph detection model; The knowledge graph to be detected is taken as input and processed through various levels of the power equipment knowledge graph detection model; In the feature extraction layer, the preset text encoder and structure encoder are used to extract the text features and graph structure features of the knowledge graph to be detected respectively; In the fusion layer, the extracted text features and graph structure features are effectively fused; In the reconstruction layer, based on the fused features, the improved neural network model is used to reconstruct the triples of the power knowledge graph; In the output layer, the difference between the reconstruction result with the highest confidence and the original triplet is used as the indicator of error detection; According to the size of the difference, determine whether there are errors in the power knowledge graph.
8. A knowledge graph error detection system for electric power equipment based on knowledge reconstruction, characterized in that: include: An input sequence acquisition module is used to establish a power knowledge graph triple of a target power equipment knowledge graph according to a power unstructured knowledge base, and to acquire a text description input sequence and a structure description input sequence for constructing the power knowledge graph triple according to the power knowledge graph triple; A model building module is used to extract text features and graph structure features of the power knowledge graph triples according to a preset text encoder and structure encoder, and to perform text reconstruction and structure reconstruction on the power knowledge graph triples in combination with an improved neural network, and to establish a power equipment knowledge graph detection model based on the reconstructed power knowledge graph triples; The detection module is used to use the knowledge graph to be detected as the input of the power equipment knowledge graph detection model, and perform power equipment knowledge graph error detection based on the output results of the power equipment knowledge graph detection model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Power grid fault diagnosis method, system and device based on prior knowledge reinforcement learning
CN119293669A
Process industry safety knowledge graph error detection method and system based on large language model
CN119740644A
Knowledge graph proposition error correction method and system based on artificial intelligence
CN119940511A
Artificial intelligence-based knowledge graph proposition correction method and system
CN119940511B
