A power grid information processing method and device, electronic equipment, and storage medium
By constructing a power grid information knowledge graph and using a link prediction model to mine the relationships between unrecorded entity nodes, the problem of poor readability of the power grid public information model was solved, and efficient and accurate analysis and improvement of the information model were achieved.
Patent Information
- Application Number
- CN202211618019.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-15
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-12-15
AI Technical Summary
Existing technologies have poor readability in building public information models for power grids, and they cannot efficiently and accurately analyze information about objects that are not included in the data.
By obtaining the original files of the power grid public information model, a power grid information knowledge graph is constructed. The score of the target triple is calculated using a link prediction model. The target triples ranked in the top N that do not exist in the knowledge graph are added to the power grid information knowledge graph to explore the relationships between uncollected entity nodes.
This improved the readability of the power grid information model, accurately analyzed and added relationships between entities that were not previously included, and enhanced the completeness and accuracy of the information model.
Smart Images

Figure CN115982377B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power grid information management technology, and in particular to a method and apparatus for processing power grid information, an electronic device, and a storage medium. Background Technology
[0002] With the continuous development of power business and power technology, the number of objects to be managed and the information of those objects is also increasing. Therefore, in order to facilitate the management and use of power object information, it is necessary to establish a power grid public information model to manage the information.
[0003] Currently, the establishment of a public information model for the power grid mainly involves relevant personnel analyzing documents to determine the descriptive information of each object that needs to be managed and the relationships between these objects. Then, based on the analyzed information, a public information model for the power grid is established using a CIM model.
[0004] However, the readability of the public information model of the power grid constructed by existing technology is poor, and it is also impossible to efficiently and accurately analyze the information of objects that are not included by manual analysis. Summary of the Invention
[0005] In view of the shortcomings of the prior art, this application provides a method and apparatus for processing power grid information, an electronic device, and a storage medium to solve the problems of readability gaps and inability to accurately analyze unrecorded information in the prior art.
[0006] To achieve the above objectives, this application provides the following technical solution:
[0007] The first aspect of this application provides a method for processing power grid information, including:
[0008] Obtain the original files of the power grid public information model;
[0009] Based on the original files of the power grid public information model, a power grid information knowledge graph is constructed;
[0010] Multiple objects to be predicted are selected from the power grid information knowledge graph; wherein, each object to be predicted includes an entity node and an entity relationship of a certain type;
[0011] Each of the objects to be predicted is input into a pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each of the objects to be predicted. The decoder in the link prediction model calculates the score of multiple target triples composed of each of the objects to be predicted and each of the random entity nodes based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes. The random entity nodes are randomly selected entity nodes in the power grid information knowledge graph.
[0012] Sort the target triples in ascending order according to their scores.
[0013] Each of the target triples that is ranked in the top N positions and does not exist in the power grid information knowledge graph is added to the power grid information knowledge graph.
[0014] Optionally, in the above-mentioned method for processing power grid information, the decoder in the link prediction model is an R-GCN model, and the decoder is a DistMult model; wherein, the weight matrix in the R-GCN model is trained based on an attention mechanism.
[0015] Optionally, in the above-described method for processing power grid information, the step of constructing a power grid information knowledge graph based on the original files of the power grid public information model includes:
[0016] From the original file of the power grid public information model, the key information of each entity node is found under the first-level topic domain and the second-level topic domain of each entity node;
[0017] Based on the key information of each entity node, the power grid information knowledge graph is constructed and stored in a graph database.
[0018] Optionally, in the above-described method for processing power grid information, the training method for the link prediction model includes:
[0019] The triplet consisting of every two entity nodes with entity relationships in the power grid information knowledge graph and the entity relationship between the two entity nodes is taken as a positive sample.
[0020] Each positive sample is input into the link prediction model. The encoder in the link prediction model calculates the vector of each entity node in the positive sample. The decoder in the link prediction model calculates the scores of each positive sample and negative sample based on the vector of each entity node in the positive sample. The negative sample is obtained by replacing the entities in the positive sample, and the two entity nodes included do not have the entity relationship in the power grid information knowledge graph.
[0021] Based on the scores and labels of each of the positive and negative samples, the current error is calculated using a loss function;
[0022] Determine whether the current error has converged;
[0023] If it is determined that the current error has not converged, the parameters in the link prediction model are adjusted, and the process of inputting each positive sample into the link prediction model is returned.
[0024] If it is determined that the current error has converged, then the training of the link prediction model ends.
[0025] Optionally, in the above-described method for processing power grid information, adding each of the target triples that is ranked in the top N positions and does not exist in the power grid information knowledge graph to the power grid information knowledge graph includes:
[0026] Based on the number of target triples and a preset score threshold, the top N target triples are selected as triples to be added.
[0027] For each triple to be added, in the power grid information knowledge graph, the two entity nodes in the triple to be added are linked by the entity key in the triple to be added.
[0028] A second aspect of this application provides a power grid information processing apparatus, comprising:
[0029] The file acquisition unit is used to acquire the original files of the power grid public information model;
[0030] The graph construction unit is used to construct a power grid information knowledge graph based on the original files of the power grid public information model.
[0031] The selection unit is used to select multiple objects to be predicted from the power grid information knowledge graph; wherein, one object to be predicted includes an entity node and an entity relationship of a certain type;
[0032] The prediction unit is used to input each of the objects to be predicted into a pre-trained link prediction model, calculate the vector of the entity node in each of the objects to be predicted through the encoder in the link prediction model, and calculate the score of multiple target triples composed of each of the objects to be predicted and each of the random entity nodes through the decoder in the link prediction model based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes; wherein, the random entity nodes are randomly selected entity nodes in the power grid information knowledge graph.
[0033] The sorting unit is used to sort the target triples in ascending order according to the scores of the target triples.
[0034] An adding unit is used to add each of the target triples that are ranked in the top N positions and do not exist in the power grid information knowledge graph to the power grid information knowledge graph.
[0035] Optionally, in the above-mentioned power grid information processing device, the decoder in the link prediction model is an R-GCN model, and the decoder is a DistMult model; wherein, the weight matrix in the R-GCN model is trained based on an attention mechanism.
[0036] Optionally, in the above-mentioned power grid information processing apparatus, the map construction unit includes:
[0037] The query unit is used to query the key information of each entity node from the first-level subject domain and the second-level subject domain of each entity node in the original file of the power grid public information model.
[0038] A sub-unit is constructed to build the power grid information knowledge graph based on the key information of each entity node, and to store the power grid information knowledge graph in a graph database.
[0039] Optionally, the above-mentioned power grid information processing device further includes:
[0040] The sample acquisition unit is used to take every two entity nodes with entity relationships in the power grid information knowledge graph and the triplet formed by the entity relationship between the two entity nodes as positive samples.
[0041] The training unit is used to input each of the positive samples into the link prediction model, calculate the vector of each entity node in the positive sample through the encoder in the link prediction model, and calculate the score of each positive sample and negative sample based on the vector of each entity node in the positive sample through the decoder in the link prediction model; wherein, the negative sample is obtained by replacing the entity in the positive sample, and the two entity nodes included do not have the entity relationship in the power grid information knowledge graph.
[0042] An error calculation unit is used to calculate the current error based on the scores and labels of each of the positive samples and each of the negative samples using a loss function.
[0043] The judgment unit is used to determine whether the current error has converged;
[0044] An adjustment unit is used to adjust the parameters in the linked prediction model when it is determined that the current error has not converged, and then return to the training unit.
[0045] The termination unit is used to end the training of the link prediction model when it is determined that the current error has converged.
[0046] Optionally, in the above-mentioned power grid information processing apparatus, the adding unit includes:
[0047] The filtering unit is used to filter out the top N target triplets as triplets to be added based on the number of target triplets and a preset score threshold.
[0048] The linking unit is used to link the two entity nodes in the triplet to be added in the power grid information knowledge graph for each triplet to be added, using the entity key in the triplet to be added.
[0049] A third aspect of this application provides an electronic device, comprising:
[0050] Memory and processor;
[0051] The memory is used to store programs;
[0052] The processor is used to execute the program, which, when executed, is specifically used to implement the power grid information processing method as described in any of the above.
[0053] A fourth aspect of this application provides a computer storage medium for storing a computer program, which, when executed, implements the power grid information processing method as described in any of the preceding claims.
[0054] This application provides a method for processing power grid information. It obtains the original file of a power grid public information model and then constructs a power grid information knowledge graph based on this file, thereby improving the readability of the information model. Multiple objects to be predicted are then selected from the power grid information knowledge graph. Each object to be predicted includes an entity node and a type of entity relationship. These objects are input into a pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each object, and the decoder in the model calculates the score of multiple target triples composed of the object and the random entity nodes based on the vectors of the entity nodes and multiple random entity nodes. The random entity nodes are randomly selected entity nodes from the power grid information knowledge graph. Finally, the target triples are sorted in ascending order according to their scores. The top N target triples that are not present in the power grid information knowledge graph are added to the power grid information knowledge graph. In this way, the relationships between the uncollected entity nodes are mined through the link prediction model and added to the knowledge graph. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0056] Figure 1 A flowchart illustrating a method for processing power grid information provided in this application embodiment;
[0057] Figure 2 A flowchart illustrating a method for constructing a power grid information knowledge graph, provided in an embodiment of this application;
[0058] Figure 3 A flowchart illustrating a training method for a link prediction model provided in an embodiment of this application;
[0059] Figure 4 A flowchart illustrating a method for adding a target triple to a power grid information knowledge graph, as provided in this application embodiment;
[0060] Figure 5 A schematic diagram of the architecture of a power grid information processing device provided in an embodiment of this application;
[0061] Figure 6 This is a schematic diagram of the architecture of an electronic device provided in an embodiment of this application. Detailed Implementation
[0062] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0063] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0064] This application provides a method for processing power grid information, such as... Figure 1 As shown, it includes the following steps:
[0065] S101. Obtain the original file of the power grid public information model.
[0066] Specifically, we obtain the original XML file of the power grid public information model built on the CIM model. The original file contains detailed descriptions of each entity node, so the XML file can be used to construct the subsequent knowledge graph.
[0067] S102. Based on the original files of the power grid public information model, construct a power grid information knowledge graph.
[0068] Specifically, the descriptive information of each object that needs to be associated and the relationships between them can be determined from the original documents of the power grid public information model. Therefore, each object can be treated as an entity node, and based on the relationships between the entity nodes, they can be connected to obtain a power grid information knowledge graph. Compared with existing models, the knowledge graph can more clearly express the information of entity nodes and the relationships between them, thereby effectively improving readability.
[0069] Optionally, in another embodiment of this application, one specific implementation of step S103 is as follows: Figure 2As shown, it includes the following steps:
[0070] S201. Find the key information of each entity node from the first-level subject domain and the second-level subject domain of each entity node in the original file of the power grid public information model.
[0071] Key information may include the Chinese name of the entity node, the entity description, and the entity's relationship information.
[0072] Specifically, based on the structure of the original file, the key information of each entity node can be found from the first-level subject domain and the second-level subject domain of each entity node in the original file.
[0073] S202. Based on the key information of each entity node, construct a power grid information knowledge graph and store the power grid information knowledge graph in a graph database.
[0074] Optionally, node information extraction and knowledge graph construction can be implemented using two separate classes. Furthermore, the Neo4j graph database can be used.
[0075] S103. Select multiple objects to be predicted from the power grid information knowledge graph.
[0076] One object to be predicted includes an entity node and an entity relationship of a certain type.
[0077] It should be noted that since the knowledge graph constructed in the above steps is based on existing original files, the relationships between entity nodes in the constructed knowledge graph are already recorded. In order to make the information in the knowledge graph more comprehensive, the relationships between entity nodes will be further mined and predicted in this embodiment of the application.
[0078] Therefore, it is necessary to first select multiple entity nodes and entity relationships from the entity nodes and various types of entity relationships included in the power grid information knowledge graph to form the objects to be predicted. Since each object to be predicted includes an entity node and an entity relationship of a certain type, an entity node can form different objects to be predicted with entity relationships of different types.
[0079] Optionally, the objects to be predicted can be composed of all entity nodes and entity relationships in the power grid information knowledge graph, thereby enabling comprehensive data mining.
[0080] S104. Input each object to be predicted into the pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each object to be predicted. The decoder in the link prediction model calculates the score of multiple target triples composed of each object to be predicted and each random entity node based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes.
[0081] Here, random entity nodes are randomly selected entity nodes from the power grid information knowledge graph. It should be noted that since the link prediction model is trained using entity nodes from the already constructed power grid information knowledge graph, the vectors of each entity node in the current knowledge graph are already learned at the end of training. Therefore, random entity nodes can be selected from the entity nodes whose corresponding vectors have already been learned during training. Alternatively, random entity nodes can be selected from the entity nodes whose vectors are obtained from the input model and the encoder.
[0082] Specifically, in this embodiment, the encoder of a pre-trained model encodes the entity nodes in the input object to be predicted, thereby obtaining a vector representation of an entity node under the influence of other entity nodes. Then, the object to be predicted is combined with random entity nodes to obtain a target triple consisting of two entity nodes and an entity relationship. This target triple represents the entity relationship between the two entity nodes. The decoder in the model then scores each target triple, assessing the probability that the two entity nodes in the target triple have the included entity relationship.
[0083] Optionally, in another embodiment of this application, the decoder in the link prediction model is an R-GCN model and the decoder is a DistMult model.
[0084] The weight matrix in the R-GCN model is trained based on an attention mechanism.
[0085] It should be noted that, in the embodiments of this application, the R-GCN model is used as the decoder in the link prediction model, so as to consider the importance of the connection between nodes according to the different types of edges between entity nodes, that is, different types of entity relationships.
[0086] The specific expression for the R-GCN model is as follows:
[0087]
[0088] Where i represents a current node; j represents the adjacent nodes of the current node; This represents the set of adjacent nodes of the current node under entity relation r, that is, the set of adjacent nodes that have entity relation r with the current node; c i,r This is a defined constant, which can specifically be the number of all adjacent nodes of the current node; and This refers to the parameter matrix that needs to be learned during the training process; It is the weight matrix corresponding to the entity relation r; It is the weight matrix of the current node itself; the σ activation function set contains node information of the current node at layer l. Information on adjacent nodes under different entity relationships The information of the (l+1)th layer of the current node is generated iteratively.
[0089] Optionally, the number of parameters increases rapidly as the number of relations in the knowledge graph increases. This is because, as can be seen from the formula above, for each relation r, we need to calculate a parameter matrix when deriving the node vector. Therefore, in order to reduce the amount of computation, for the parameter matrix... The decomposition can be performed using the basis function decomposition method, which can be specifically expressed as:
[0090]
[0091] in, It is a two-dimensional matrix, which is the matrix that needs to be learned during the training process, and This is a numerical value corresponding to different entity relationships. Therefore, for different entity relationships, only the value needs to be changed. And for this matrix Different entity relationships can be shared, thereby reducing the range of parameter changes required during training and accelerating training efficiency.
[0092] In a knowledge graph, denser regions contain richer information, making nodes in those regions more important. Therefore, in this embodiment, an attention mechanism is incorporated to train the R-GCN model.
[0093] Since each relation has varying importance to the entity node, an attention mechanism is introduced to train all relation embeddings of an entity node, resulting in a weight matrix for each relation embedding. These weight matrices are then fused to obtain the relation embedding vector for that entity node. We adjust the weights of the relation vector for each entity node to simulate the focus of human attention when processing information. The attention mechanism allows us to initially focus on nodes with higher clustering, i.e., nodes with a larger number of neighboring nodes and stronger relationships with other nodes.
[0094] In this embodiment, the DistMult model is used as the decoder to score the triples. During the calculation, each entity relation r corresponds to a diagonal matrix R. r This matrix can be obtained through the attention mechanism. Therefore, the expression for the triple score is:
[0095]
[0096] Where s represents the head entity node in the triple, r represents the entity relation, and o represents the tail entity node; e s and e o Each represents a vector of the two entities in the triplet obtained by the encoder.
[0097] Optionally, embodiments of this application provide a method for training a link prediction model, such as... Figure 3 As shown, it includes the following steps:
[0098] S301. Take every pair of entity nodes with entity relationships in the power grid information knowledge graph and the triple formed by the entity relationships between the two entity nodes as positive samples.
[0099] S302. Input each positive sample into the link prediction model. The encoder in the link prediction model calculates the vector of each entity node in the positive sample. The decoder in the link prediction model calculates the score of each positive sample and negative sample based on the vector of each entity node in the positive sample.
[0100] Negative samples are obtained by replacing entities in positive samples, and the two entity nodes included do not have any entity relationship in the power grid information knowledge graph.
[0101] S303. Based on the scores and labels of each positive and negative sample, the current error is calculated using the loss function.
[0102] In the design of the loss function, the score of positive samples should be as small as possible, while the score of negative samples should be as large as possible.
[0103] Optionally, in the embodiments of this application, the following loss function may be used:
[0104]
[0105] Where y represents the label of a positive sample; y is 1 when the triplet is a positive sample and 0 when the triplet is a negative sample. w is the number of positive samples converted to negative samples; l is the activation function; and ε is a set coefficient.
[0106] S304. Determine whether the current error has converged.
[0107] If it is determined that the current error has not converged, then step S305 is executed. If it is determined that the current error has converged, then step S306 is executed.
[0108] S305. Adjust the parameters in the link prediction model.
[0109] After executing step S305, the process returns to execute step S302 to proceed to the next round of iterative training.
[0110] S306. End training of the link prediction model.
[0111] S105. Sort each target triplet in ascending order according to the score of each target triplet.
[0112] It should be noted that, since the model training process aims to minimize the scores of positive samples—that is, to minimize the scores of triples that are certain to exist in the power grid information knowledge graph—the lower the score of a triple, the higher its probability of actual existence. Therefore, in this embodiment, the target triples are sorted in ascending order of their scores to facilitate the selection of target triples to be added.
[0113] S106. Add the target triples that are ranked in the top N positions and do not exist in the power grid information knowledge graph to the power grid information knowledge graph.
[0114] It should be noted that since the target triple is composed of the object to be predicted and randomly selected entity nodes, it may not necessarily exist in the power grid information knowledge graph. Furthermore, the target triples are sorted in ascending order of scores, and the triples at the top are more likely to actually exist. Therefore, for the target triples ranked in the top N, if they do not yet exist in the power grid information knowledge graph (i.e., the power grid information knowledge graph does not show the entity relationship between the two entity nodes in the target triple), then the power grid information knowledge graph needs to add the entity relationship between the two entity nodes in the target triple, thereby realizing the mining of relationships between unrecorded entity nodes.
[0115] Optionally, in another embodiment of this application, one specific implementation of step S106 is as follows: Figure 4 As shown, it includes the following steps:
[0116] S401. Based on the number of target triples and the preset score threshold, select the top N target triples as the triples to be added.
[0117] It should be noted that if there are many target triples, there may also be many triples with high scores. Therefore, in this embodiment, N is a dynamically changing value that varies according to the number of target triples; that is, the more target triples there are, the larger N becomes. Furthermore, to ensure that the scores of the selected target triples meet the requirements, N needs to be determined based on a preset score threshold; that is, the scores of the top N target triples should be greater than the preset threshold.
[0118] S402. For each triple to be added, link the two entity nodes in the triple to be added in the power grid information knowledge graph using the entity key in the triple to be added.
[0119] This application provides a method for processing power grid information. It obtains the original file of a power grid public information model and then constructs a power grid information knowledge graph based on this file, thereby improving the readability of the information model. Multiple objects to be predicted are then selected from the power grid information knowledge graph. Each object to be predicted includes an entity node and a type of entity relationship. These objects are input into a pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each object, and the decoder in the model calculates the score of multiple target triples composed of the object and the random entity nodes based on the vectors of the entity nodes and multiple random entity nodes. The random entity nodes are randomly selected entity nodes from the power grid information knowledge graph. Finally, the target triples are sorted in ascending order according to their scores. The top N target triples that are not present in the power grid information knowledge graph are added to the power grid information knowledge graph. In this way, the relationships between the uncollected entity nodes are mined through the link prediction model and added to the knowledge graph.
[0120] Another embodiment of this application provides a power grid information processing apparatus, such as... Figure 5 As shown, it includes:
[0121] The file acquisition unit 501 is used to acquire the original file of the power grid public information model.
[0122] The graph construction unit 502 is used to construct a power grid information knowledge graph based on the original files of the power grid public information model.
[0123] Unit 503 is used to select multiple objects to be predicted from the power grid information knowledge graph.
[0124] One object to be predicted includes an entity node and an entity relationship of a certain type.
[0125] The prediction unit 504 is used to input each object to be predicted into a pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each object to be predicted, and the decoder in the link prediction model calculates the score of multiple target triples composed of each object to be predicted and each random entity node based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes.
[0126] Among them, random entity nodes are entity nodes randomly selected from the power grid information knowledge graph.
[0127] The sorting unit 505 is used to sort each target triplet in ascending order according to the score of each target triplet.
[0128] Add unit 506 is used to add each target triplet that is ranked in the top N positions and does not exist in the power grid information knowledge graph to the power grid information knowledge graph.
[0129] Optionally, in another embodiment of the power grid information processing apparatus provided in this application, the decoder in the link prediction model is an R-GCN model, and the decoder is a DistMult model. The weight matrix in the R-GCN model is trained based on an attention mechanism.
[0130] Optionally, in another embodiment of the power grid information processing apparatus provided in this application, the map construction unit includes:
[0131] The query unit is used to retrieve key information of each entity node from the primary and secondary subject domains of each entity node in the original file of the power grid public information model.
[0132] Construct sub-units to build a power grid information knowledge graph based on the key information of each entity node, and store the power grid information knowledge graph in a graph database.
[0133] Optionally, in another embodiment of the power grid information processing apparatus provided in this application, the apparatus further includes:
[0134] The sample acquisition unit is used to take every two entity nodes with entity relationships in the power grid information knowledge graph and the triple formed by the entity relationship between the two entity nodes as positive samples.
[0135] The training unit is used to input each positive sample into the link prediction model. The encoder in the link prediction model calculates the vector of each entity node in the positive sample, and the decoder in the link prediction model calculates the score of each positive sample and negative sample based on the vector of each entity node in the positive sample.
[0136] Negative samples are obtained by replacing entities in positive samples, and the two entity nodes included do not have any entity relationship in the power grid information knowledge graph.
[0137] The error calculation unit is used to calculate the current error based on the scores and labels of each positive and negative sample using a loss function.
[0138] The judgment unit is used to determine whether the current error has converged.
[0139] The adjustment unit is used to adjust the parameters in the linked prediction model when it is determined that the current error has not converged, and then return to the training unit.
[0140] The termination unit is used to end the training of the link prediction model when it is determined that the current error has converged.
[0141] Optionally, in another embodiment of the power grid information processing apparatus provided in this application, a unit is added, including:
[0142] The filtering unit is used to filter out the top N target triplets as triplets to be added, based on the number of target triplets and a preset score threshold.
[0143] The linking unit is used to link the two entity nodes in each triplet to be added in the power grid information knowledge graph using the entity key in the triplet.
[0144] It should be noted that the specific working process of each unit provided in the above embodiments of this application can be referred to the corresponding steps in the above method embodiments, and will not be repeated here.
[0145] Another embodiment of this application provides an electronic device, such as... Figure 6 As shown, it includes:
[0146] Memory 601 and processor 602.
[0147] The memory 601 is used to store the program.
[0148] The processor 602 is used to execute the program stored in the memory 601. When the program is executed, it is specifically used to implement the power grid information processing method provided in any of the above embodiments.
[0149] Another embodiment of this application provides a computer storage medium for storing a computer program, which, when executed, implements the power grid information processing method provided in any of the above embodiments.
[0150] Computer storage media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0151] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0152] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing power grid information, characterized in that, include: Obtain the original files of the power grid public information model; Based on the original files of the power grid public information model, a power grid information knowledge graph is constructed; Multiple objects to be predicted are selected from the power grid information knowledge graph; wherein, each object to be predicted includes an entity node and an entity relationship of a certain type; Each of the objects to be predicted is input into a pre-trained link prediction model. The encoder in the link prediction model calculates the vector of the entity node in each of the objects to be predicted. The decoder in the link prediction model calculates the score of multiple target triples composed of each of the objects to be predicted and each of the random entity nodes based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes. The random entity nodes are randomly selected entity nodes in the power grid information knowledge graph. Sort the target triples in ascending order according to their scores. Each of the target triples that is ranked in the top N positions and does not exist in the power grid information knowledge graph is added to the power grid information knowledge graph; The construction of a power grid information knowledge graph based on the original files of the power grid public information model includes: From the original file of the power grid public information model, the key information of each entity node is found under the first-level topic domain and the second-level topic domain of each entity node; Based on the key information of each entity node, the power grid information knowledge graph is constructed and stored in a graph database; The training method for the link prediction model includes: The triplet consisting of every two entity nodes with entity relationships in the power grid information knowledge graph and the entity relationship between the two entity nodes is taken as a positive sample. Each positive sample is input into the link prediction model. The encoder in the link prediction model calculates the vector of each entity node in the positive sample. The decoder in the link prediction model calculates the score of each positive sample and the score of each negative sample based on the vector of each entity node in the positive sample. The negative sample is obtained by replacing the entities in the positive sample, and the two entity nodes included do not have the entity relationship in the power grid information knowledge graph. Based on the scores and labels of each of the positive and negative samples, the current error is calculated using a loss function. Determine whether the current error has converged; If it is determined that the current error has not converged, the parameters in the link prediction model are adjusted, and the process of inputting each positive sample into the link prediction model is returned. If it is determined that the current error has converged, then the training of the link prediction model ends.
2. The method according to claim 1, characterized in that, The decoder in the link prediction model is an R-GCN model, and the decoder is a DistMult model; wherein, the weight matrix in the R-GCN model is trained based on an attention mechanism.
3. The method according to claim 1, characterized in that, The step of adding each of the target triples that are ranked in the top N positions and do not exist in the power grid information knowledge graph to the power grid information knowledge graph includes: Based on the number of target triples and a preset score threshold, the top N target triples are selected as triples to be added. For each triple to be added, in the power grid information knowledge graph, the two entity nodes in the triple to be added are linked by the entity key in the triple to be added.
4. A power grid information processing device, characterized in that, include: The file acquisition unit is used to acquire the original files of the power grid public information model; The graph construction unit is used to construct a power grid information knowledge graph based on the original files of the power grid public information model. The selection unit is used to select multiple objects to be predicted from the power grid information knowledge graph; wherein, one object to be predicted includes an entity node and an entity relationship of a certain type; The prediction unit is used to input each of the objects to be predicted into a pre-trained link prediction model, calculate the vector of the entity node in each of the objects to be predicted through the encoder in the link prediction model, and calculate the score of multiple target triples composed of each of the objects to be predicted and each of the random entity nodes through the decoder in the link prediction model based on the vector of the entity node in the object to be predicted and the vector of multiple random entity nodes; wherein, the random entity nodes are randomly selected entity nodes in the power grid information knowledge graph. The sorting unit is used to sort the target triples in ascending order according to the scores of the target triples. An adding unit is used to add each of the target triples that are ranked in the top N positions and do not exist in the power grid information knowledge graph to the power grid information knowledge graph; The sample acquisition unit is used to take every two entity nodes with entity relationships in the power grid information knowledge graph and the triplet formed by the entity relationship between the two entity nodes as positive samples. The training unit is used to input each of the positive samples into the link prediction model, calculate the vector of each entity node in the positive samples through the encoder in the link prediction model, and calculate the scores of each positive sample and negative sample based on the vector of each entity node in the positive samples through the decoder in the link prediction model; wherein, the negative sample is obtained by replacing the entities in the positive sample, and the two entity nodes included do not have the entity relationship in the power grid information knowledge graph; An error calculation unit is used to calculate the current error based on the scores and labels of each of the positive samples and each of the negative samples using a loss function. The judgment unit is used to determine whether the current error has converged; An adjustment unit is used to adjust the parameters in the linked prediction model when it is determined that the current error has not converged, and then return to the training unit. The termination unit is used to end the training of the link prediction model when it is determined that the current error has converged. The map construction unit includes: The query unit is used to find the key information of each entity node from the first-level topic domain and the second-level topic domain of each entity node in the original file of the power grid public information model; A sub-unit is constructed to build the power grid information knowledge graph based on the key information of each entity node, and to store the power grid information knowledge graph in a graph database.
5. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program, which, when executed, is specifically used to implement the power grid information processing method as described in any one of claims 1 to 3.
6. A computer storage medium, characterized in that, Used to store computer programs, which, when executed, are used to implement the method for processing power grid information as described in any one of claims 1 to 3.
Citation Information
Patent Citations
A knowledge map embedding method based on adaptive negative sampling
CN109376249A
Industrial knowledge graph completion method and device, electronic equipment and storage medium
CN114610883A