A method, apparatus, electronic device, and storage medium for power grid knowledge reasoning.
By adjusting the power grid knowledge graph using neighborhood threshold distance and preset clustering rules, and combining a distributed computing platform and graph convolutional neural network model, the incompleteness and scalability issues of the power grid knowledge graph are solved, achieving efficient knowledge reasoning and data completeness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- STATE GRID INFORMATION & TELECOMM BRANCH
- Filing Date
- 2023-06-12
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, power grid knowledge graphs suffer from incompleteness and scalability issues. In particular, they struggle to resolve the contradiction between openness and closedness in a distributed environment, resulting in low efficiency in knowledge retrieval and reasoning.
By adjusting the preset knowledge graph using neighborhood threshold distance and preset clustering rules, a power grid knowledge reasoning model is generated. This model is then applied to a distributed computing platform for knowledge reasoning, and the knowledge reasoning results are generated using a graph convolutional neural network model for training and the computing nodes of the distributed computing platform.
It enhances the data completeness and reliability of knowledge graphs, resolves the contradiction between the openness and closedness of knowledge graph environments, and improves the accuracy and scalability of power grid knowledge reasoning.
Smart Images

Figure CN116757285B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for power grid knowledge reasoning. Background Technology
[0002] The knowledge graph in the State Grid Corporation of China's unified data model (SG-CIM) includes both physical and logical models and is widely used in State Grid management agencies and equipment at all levels. However, as the SG-CIM unified model is continuously promoted, iterated, and improved, some problems have gradually emerged. First, due to the incompleteness of the data used to construct the knowledge graph, or the inability of information extraction algorithms to identify certain relationships or extract attribute values, the SG-CIM knowledge graph suffers from incompleteness, meaning that relationships and attributes are missing or incorrect. Second, while the continuous development and iteration of distributed grid equipment has enabled the construction of large-scale distributed knowledge graphs, the scalability of knowledge graph reasoning is difficult to guarantee due to limitations in computing resources (such as memory and storage capacity) and network bandwidth.
[0003] Currently, research on learning various pattern-level axioms based on knowledge graphs to address the lack of hierarchical relationships, disjoint axioms, and constraint axioms for attributes or concepts can be broadly categorized into three types: The first type focuses on pattern induction based on Inductive Logic Programming (ILP), deriving logical conclusions from instances and background knowledge to construct ontologies. The second type focuses on pattern induction based on association rule mining, typically first collecting necessary information from the knowledge graph, then representing it using transaction tables, and finally using traditional association rule mining methods to find rules. The third type focuses on pattern induction based on machine learning, using machine learning methods to transform ontology learning into a machine learning problem, representing, modeling, and reasoning about the knowledge graph using the adopted learning model. For distributed knowledge reasoning, existing technologies can be broadly divided into two categories: the first is multi-core, multi-processor technologies in single-machine environments, such as multithreading and GPU technologies; the second is distributed technologies based on network communication in multi-machine environments, such as the MapReduce computing framework and Peer-to-Peer network frameworks.
[0004] However, knowledge graphs are based on the open-world assumption, while traditional association rule mining or machine learning employs the closed-world assumption. Currently, there is no good solution to the contradiction between openness and closedness. Furthermore, existing solutions to the knowledge graph missing information problem mainly focus on forward chain reasoning, i.e., applying reasoning rules to the knowledge graph to generate new triples, which is not well-suited for reasoning with dynamic knowledge graphs. Forward chain reasoning leads to the storage of a large amount of redundant knowledge in the knowledge graph and is also detrimental to efficient knowledge retrieval and reasoning. Summary of the Invention
[0005] This invention provides a power grid knowledge reasoning method, apparatus, electronic device, and storage medium to address the problem of missing attributes and relationships in knowledge graphs, thereby enhancing the completeness of knowledge graph data. Furthermore, by enhancing the scalability of knowledge graph applications through a distributed platform, it can resolve the contradiction between the openness and closedness of the knowledge graph's environment, thus improving the accuracy and reliability of the knowledge graph.
[0006] According to one aspect of the present invention, a method for reasoning about power grid knowledge is provided, wherein the method includes:
[0007] Adjust the elements to be adjusted in the preset knowledge graph based on the neighborhood threshold distance and preset clustering rules;
[0008] A power grid knowledge reasoning model is determined based on the adjusted preset knowledge graph;
[0009] The knowledge reasoning result is determined based on the power grid knowledge reasoning model and the distributed computing platform.
[0010] According to another aspect of the present invention, a power grid knowledge reasoning apparatus is provided, wherein the apparatus comprises:
[0011] Elements within the graph to be adjusted;
[0012] The model generation module is used to determine the power grid knowledge reasoning model based on the adjusted preset knowledge graph;
[0013] The knowledge reasoning module is used to determine the knowledge reasoning result based on the power grid knowledge reasoning model and the distributed computing platform.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] At least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the power grid knowledge reasoning method according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the power grid knowledge reasoning method according to any embodiment of the present invention.
[0019] The technical solution of this invention adjusts the elements to be adjusted within a preset knowledge graph by using neighborhood threshold distance and preset clustering rules, generating a power grid knowledge reasoning model corresponding to the preset knowledge graph. The power grid knowledge reasoning model is then applied using a distributed computing platform to generate the knowledge reasoning result. This invention solves the problem of missing attributes and relationships in the knowledge graph, enhances the completeness of the knowledge graph data, and uses a distributed platform to enhance the scalability of knowledge graph applications. It resolves the contradiction between the openness and closedness of the knowledge graph's environment, improves the reliability of the knowledge graph, and enhances the accuracy of power grid knowledge reasoning.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of a power grid knowledge reasoning method provided in Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of a power grid knowledge reasoning method provided in Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of the structure of a power grid knowledge reasoning device according to Embodiment 3 of the present invention;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the power grid knowledge reasoning method of this invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] Example 1
[0029] Figure 1 This is a flowchart of a power grid knowledge reasoning method according to Embodiment 1 of the present invention. This embodiment is applicable to the application of the unified data model knowledge graph of the State Grid Corporation of China. The method can be executed by a power grid knowledge reasoning device, which can be implemented in hardware and / or software and can be configured in a server. Figure 1 As shown, the method includes:
[0030] Step 110: Adjust the elements to be adjusted in the preset knowledge graph according to the neighborhood threshold distance and preset clustering rules.
[0031] The neighborhood threshold distance can be the minimum distance value used to classify knowledge consisting of entities and relationships within a preset knowledge graph. When the distance between two pieces of knowledge is greater than the neighborhood threshold distance, they can be considered to belong to different categories within the preset knowledge graph. The neighborhood threshold distance can be determined by the data within the preset knowledge graph or based on user business requirements. The preset knowledge graph can be a knowledge graph composed of power grid knowledge, and can include the State Grid Corporation of China's unified data model SG-CIM model. The preset clustering rules can be rules for classifying different pieces of knowledge within the preset knowledge graph. Specific preset clustering rules can be implemented using algorithms such as K-Menas clustering or Canopy clustering.
[0032] In this embodiment of the invention, knowledge within a preset knowledge graph can be clustered according to a neighborhood threshold distance and a preset clustering rule. The elements to be adjusted within the preset knowledge graph can be optimized and adjusted according to the clustering results. For example, the adjustment may include one or more of supplementing the attributes of the elements to be adjusted, supplementing the relationships of the elements to be adjusted, correcting the attributes of the elements to be adjusted, and correcting the relationships of the elements to be adjusted. The elements to be adjusted may be missing or incorrect knowledge within the preset knowledge graph. Missing or incorrect knowledge may include missing knowledge attributes or missing knowledge relationships, or incorrect knowledge attributes or incorrect knowledge relationships, etc.
[0033] Step 120: Determine the power grid knowledge reasoning model based on the adjusted preset knowledge graph.
[0034] Among them, the power grid knowledge reasoning model can be a knowledge model constructed through a pre-set knowledge graph. The power grid knowledge reasoning model can be used to reason about power grid knowledge. The model structure of the power grid knowledge reasoning model can include graph convolutional neural network model, convolutional neural network model, etc.
[0035] In this embodiment of the invention, after adjusting the elements to be adjusted in the preset knowledge graph, the preset knowledge graph can be processed into a power grid knowledge reasoning model for knowledge reasoning. This processing may include training the preset knowledge graph into a power grid knowledge reasoning model. The specific structure of the power grid knowledge reasoning model is not limited here. For example, the power grid knowledge reasoning model may specifically include a graph convolutional neural network model, a convolutional neural network model, etc.
[0036] Step 130: Determine the knowledge reasoning result based on the power grid knowledge reasoning model and the distributed computing platform.
[0037] The distributed computing platform can be a software platform that integrates data storage, data analysis, and computation on a cluster of multiple hosts. The distributed computing platform can add or remove computing nodes as needed, and can include architectures such as Hadoop and Spark. The knowledge reasoning result can be generated based on power grid knowledge within a pre-defined knowledge graph.
[0038] In this embodiment of the invention, the power grid knowledge reasoning model can be deployed in a distributed computing platform, and the computing nodes in the distributed computing platform can perform knowledge reasoning based on the power grid knowledge reasoning model to generate reasoning results.
[0039] This invention, through its embodiments, adjusts elements within a preset knowledge graph by using neighborhood threshold distance and preset clustering rules, generating a power grid knowledge reasoning model corresponding to the preset knowledge graph. The power grid knowledge reasoning model is then applied using a distributed computing platform to generate the knowledge reasoning result. This invention solves the problem of missing attributes and relationships in knowledge graphs, enhances the completeness of knowledge graph data, and uses a distributed platform to enhance the scalability of knowledge graph applications. It resolves the contradiction between the openness and closedness of the knowledge graph's environment, improving the reliability of the knowledge graph and enhancing the accuracy of power grid knowledge reasoning.
[0040] Furthermore, based on the above embodiments of the invention, it also includes: removing incomplete entities and erroneous entities from the preset knowledge graph.
[0041] In this embodiment of the invention, when using a preset knowledge graph, the entities within the preset knowledge graph can also be analyzed. If an entity is determined to be an incorrect or incomplete entity, the entity can be removed from the preset knowledge graph.
[0042] Example 2
[0043] Figure 2 This is a flowchart of a power grid knowledge reasoning method according to Embodiment 2 of the present invention. This embodiment is a specific modification based on the above-described embodiments. See also... Figure 2 The method provided in this embodiment of the invention specifically includes the following steps:
[0044] Step 210: Extract entities from the preset knowledge graph to form a sample set, wherein the entities include at least attribute data and relation data.
[0045] In this context, an entity can represent knowledge data within a predefined knowledge graph. An entity can be specifically a triple, which can include entity data, attribute data, and relation data. Attribute data represents the entity's attributes, while relation data represents the relationships between the entity and other entities. A sample set can be a dataset composed of entities within the predefined knowledge graph, and a sample set can include one or more entities.
[0046] In this embodiment of the invention, entities within a preset knowledge graph can be read sequentially and stored in a sample set. It is understood that each sample element in the sample set can be an entity. Sample elements in the sample set can include entities that lack relations, entities that lack attributes, entities with incorrect attributes, and entities with incorrect relations, etc.
[0047] Step 220: Divide the sample elements in the sample set into at least one output cluster according to the neighborhood threshold distance and the preset clustering rules.
[0048] The output cluster can be the category to which sample elements with similar or identical features belong. The sample elements within the output cluster can be entities belonging to the same category within a predefined knowledge graph. It can be understood that the smaller the value of the neighborhood threshold distance, the finer the granularity of the output cluster can be.
[0049] In this embodiment of the invention, sample elements in a sample set can be divided into one or more output clusters by a preset clustering rule. The distance between sample elements in each output cluster and sample elements in other output clusters can be greater than the neighborhood threshold distance. It is understood that the preset clustering rule can be implemented by the K-Menas clustering algorithm, the Canopy clustering algorithm, etc.
[0050] Step 230: Adjust the element to be adjusted according to the output cluster associated with the element to be adjusted in the preset knowledge graph.
[0051] The output cluster associated with the element to be adjusted can be the output cluster to which the entity of the element to be adjusted belongs or the output cluster within a certain distance range of the element to be adjusted.
[0052] Specifically, after determining the output clusters corresponding to the sample set of the preset knowledge graph, the output clusters corresponding to each element to be adjusted within the preset knowledge graph can be determined. The elements to be adjusted can be adjusted according to the output clusters, thereby improving the accuracy of the preset knowledge graph. It can be understood that the method of adjusting the elements to be adjusted according to the output clusters associated with the elements to be adjusted may include, but is not limited to, using the mean of all or some sample elements within the same output cluster as the value of the element to be adjusted, or using the relationship between sample elements of output clusters within a distance range as the relationship between the elements to be adjusted, etc.
[0053] Step 240: Extract RDF triples composed of entities, attributes, and relations from the preset knowledge graph.
[0054] In this embodiment of the invention, each piece of knowledge in the preset knowledge graph can exist in the form of an RDF triple. The RDF triples corresponding to all knowledge in the preset knowledge graph can be read. Each RDF triple can include information such as entity, attribute, and relation.
[0055] Step 250: Train the preset graph convolutional neural network model according to the RDF triples to form the power grid knowledge reasoning model.
[0056] The preset graph convolutional neural network model can represent the implicit knowledge of the preset knowledge graph in the form of an adjacency graph, and the structure of the preset graph convolutional neural network model can be constructed according to preset weights and parameters.
[0057] In this embodiment of the invention, the RDF triples collected within the preset knowledge graph can be used to train the preset graph convolutional neural network model. The trained preset graph convolutional neural network model can be used as a power grid knowledge reasoning model. It is understood that training the preset graph convolutional neural network model may include representing the RDF triples as an adjacency graph and training the preset graph convolutional neural network model based on the connection graph.
[0058] Step 260: Divide the preset knowledge graph into knowledge subgraphs corresponding to the computing nodes of the distributed computing platform.
[0059] Among them, a knowledge subgraph can be a graph representation book containing some of the knowledge in a pre-defined knowledge graph. The knowledge subgraph can be divided according to the computing power of the computing nodes in the distributed computing platform. It can be understood that the stronger the computing power of the computing node, the more knowledge the knowledge subgraph corresponding to that computing node contains.
[0060] In this embodiment of the invention, a preset knowledge graph can be divided into multiple knowledge subgraphs, and different knowledge subgraphs can be assigned to different computing nodes within a distributed computing platform, allowing the computing nodes to utilize the knowledge within the knowledge subgraphs. This assignment method can include random assignment or assignment based on the computing performance of the computing nodes.
[0061] Step 270: Distribute and deploy the power grid knowledge reasoning model and knowledge subgraph to the computing nodes of the distributed computing platform to generate reasoning sub-results for each computing node.
[0062] Specifically, the trained power grid knowledge reasoning model and the knowledge subgraphs corresponding to each computing node can be distributed to the corresponding computing nodes. Each computing node can use its configured power grid knowledge reasoning model and knowledge subgraphs to perform knowledge reasoning and determine the reasoning sub-result. It can be understood that different computing nodes can be configured with the same power grid knowledge reasoning model, which can reflect the complete knowledge features within the preset knowledge graph. However, the knowledge subgraphs within each computing node can be different, and each computing node can perform knowledge reasoning based on the knowledge subgraph it receives.
[0063] Step 280: Aggregate the reasoning sub-results of each computing node into knowledge reasoning results according to the preset aggregation rules.
[0064] Among them, the preset aggregation rule can be a rule for fusing the reasoning sub-results within different computing nodes. In some embodiments of the invention, the preset aggregation rule may include summing the reasoning sub-results of each computing node to determine the knowledge reasoning result.
[0065] In this embodiment of the invention, after each computing node determines its corresponding knowledge reasoning sub-result, the sub-results can be fused according to a preset aggregation rule, and the fused result can be used as the knowledge reasoning result. In an exemplary embodiment, the preset aggregation rule can be expressed as follows:
[0066]
[0067] in, The knowledge reasoning sub-result h is determined for each computing node i. (l) The result represents the knowledge reasoning outcome, and k represents the number of computing nodes in the distributed computing platform. This embodiment of the invention can ensure the scalability of knowledge graph reasoning through the management of computing nodes within the distributed computing platform.
[0068] This invention addresses the problem of missing entities within a predefined knowledge graph to form a sample set. It then divides the sample elements into multiple output clusters according to predefined clustering rules and neighborhood threshold distances. The elements to be adjusted are then adjusted based on their associated output clusters within the predefined knowledge graph. RDF triples, composed of entities, attributes, and relationships within the predefined knowledge graph, are extracted. A predefined graph convolutional neural network model is trained using these RDF triples to form a power grid knowledge reasoning model. The predefined knowledge graph is then segmented into knowledge subgraphs according to the computing nodes of a distributed computing platform. The knowledge subgraphs and the power grid knowledge reasoning model are distributed to the computing nodes to determine the reasoning sub-results. Finally, the reasoning sub-results are merged into a knowledge reasoning result according to predefined aggregation rules. This invention solves the problem of missing attributes and relationships in knowledge graphs, enhances the completeness of knowledge graph data, and uses a distributed platform to enhance the scalability of knowledge graph applications. It resolves the contradiction between the openness and closedness of the knowledge graph environment, improves the reliability of the knowledge graph, and enhances the accuracy of power grid knowledge reasoning.
[0069] Furthermore, based on the above embodiments of the invention, the sample elements within the sample set are divided into at least one output cluster according to the neighborhood threshold distance and the preset clustering rules, including:
[0070] For each sample element in the sample set, determine the number of sample elements whose distance to other sample elements in the sample set is less than the neighborhood threshold distance; when the number of sample elements is greater than the threshold distance, add the sample element to the core sample object set; create a core object queue for each sample element in the core sample object set, and add target samples in the sample set whose distance to the sample element is less than the neighborhood threshold distance to the core object queue corresponding to the sample element; use each core object queue as the output cluster; when the core object sample set is empty, use each sample element in the sample set as the output cluster.
[0071] In this embodiment of the invention, when dividing the sample set into multiple output clusters, the distance between each sample element and other sample elements can be determined. The number of other elements whose distance value is less than the neighborhood threshold distance under the sample element can be counted as the number of sample elements. The number of sample elements can be compared with the number threshold. If the number of sample elements is greater than the number threshold, the sample element is added to the core sample object set. After filtering all sample elements, the sample elements in the core sample object set can be processed. For each sample element, a core object queue can be created. The core object queue can store other sample elements whose distance to the sample element is less than the neighborhood threshold distance. It is understood that the core object queue can include the sample element. The core object queue for each sample element can be used as an output cluster. Furthermore, if there are sample elements inside the core object sample set, each sample element can be used as an output cluster.
[0072] Furthermore, based on the above embodiments of the invention, the step of adjusting the element to be adjusted according to the output cluster associated with the element to be adjusted within the preset knowledge graph includes:
[0073] Identify the elements to be adjusted within the preset knowledge graph, wherein the elements to be adjusted include at least one of the following: missing attribute elements, missing relation elements, erroneous attribute elements, and erroneous relation elements;
[0074] Determine the output cluster of the element to be adjusted;
[0075] When the error type of the element to be adjusted is attribute error and the attribute type is classification, the attribute of the element to be adjusted is adjusted according to the proportion of the output cluster random value;
[0076] When the error type of the element to be adjusted is attribute error and the attribute type is continuous, the attribute of the element to be adjusted is adjusted according to the weighted average of the output clusters;
[0077] When the error type of the element to be adjusted is a relation error, the multi-source information of the output cluster is fused to form the relation of the element to be adjusted.
[0078] In this embodiment of the invention, the elements to be adjusted within the preset knowledge graph can be one or more of the following: missing attribute elements, missing relation elements, erroneous attribute elements, and erroneous relation elements. For each element to be adjusted, its error type can be determined. If the error type is an attribute error and the attribute is categorical, it can be adjusted according to a random value representing the proportion of the output cluster of the element to be adjusted. This random value can be the proportion of different categories of sample elements within the output cluster. When the error type of the element to be adjusted is an attribute error and the attribute type is continuous, the weighted average of the sample elements within the output cluster to which the element to be adjusted belongs can be used as the attribute of the element to be adjusted. When the error type of the element to be adjusted is a relation error, the attribute relations of sample elements from different sources within the element to be adjusted can be fused, and the fusion result can be used as the relation of the element to be adjusted.
[0079] Example 3
[0080] This invention provides an example of distributed knowledge reasoning based on the SG-CIM model, for participating in... Figure 3 The power grid knowledge reasoning method provided in this embodiment of the invention includes the following steps:
[0081] Step S1: Process the knowledge graph data in the State Grid Corporation of China's unified data model SG-CIM model, extract the triples, and perform normalization processing to obtain relation triples and attribute triples.
[0082] Step S2: Filter and remove incomplete or incorrect entities from the SG-CIM knowledge graph.
[0083] Step S3: Filter out missing or incorrect attributes and relationships in the SG-CIM knowledge graph, and use clustering algorithms to fill in or cover them.
[0084] Step S3.1: Define the neighborhood distance threshold as ε, and the threshold for the number of samples in the neighborhood of a sample with a distance of ε as n_min. Initialize the core object set. Initialize the number of clusters k = 0, initialize the unvisited sample set Γ to contain all attribute or relation data in the knowledge graph, and initialize cluster partitioning.
[0085] Step S3.2, for each sample x i The ε-neighborhood subset N is calculated as follows: ε (x i ):
[0086] N ε (xi )={x j ∈D|distance(x i ,x j )≤ε}
[0087] Where, distance(x) i ,x j ) is the sample x i and x j The distance between them. If the number of samples in the neighborhood subset satisfies |N ε (x i If |≥n_min, then the sample x i Add to the core object sample set, i.e.
[0088] Ω=Ω∪{x i}
[0089] Step S3.3, if the core object collection If the condition is met, proceed to step S3.4; otherwise, the algorithm terminates, and each sample is treated as an independent cluster and returned.
[0090] Step S3.4: Randomly select a core object x from the core object set Ω. p Initialize the current cluster core object queue Ω cur ={x p}, initialize the category index k = k + 1, and initialize the current cluster sample set C. k ={x p Update the set of unvisited samples.
[0091] Γ=Γ-{x p}
[0092] Step S3.5, if the current cluster core object queue Then the current cluster C k Clustering is complete. Update the cluster partition C = {C1, C2, ..., C}. k}, and update the core object set Ω = Ω - C k Otherwise, proceed to step S3.6.
[0093] Step S3.6, in the current cluster core object queue Ω cur Extract a core object x from it. q Find all ε-neighborhood subsets N by using a neighborhood distance threshold. ε (x q Update the current cluster sample set.
[0094] C k =C k ∪(N ε (x q)∩Γ)
[0095] And update the unvisited sample set.
[0096] Γ=Γ-(N ε (x q )∩Γ)
[0097] and the current cluster core object queue
[0098] Ω cur =Ω cur ∪((N ε (x q )∩Γ)∩Ω)-{x q}
[0099] Step S3.7, output the cluster partitioning result C = {C1, C2, ..., C} k}
[0100] Step S3.8, for missing or erroneous samples x in the SG-CIM knowledge graph e ∈C t For categorical attributes, use proportional random values to fill or cover the original values; for continuous attributes, use weighted average values to fill or cover the original values; for missing or erroneous graph relationships, use a multi-source information fusion approach to fill or cover the original values.
[0101] Step S4: Use the data preprocessed in steps S2 and S3 to construct a knowledge graph. Entities, attributes, and relationships in the graph are represented by RDF triples. Each triple can be seen as a directed edge connecting two entity nodes, and the attributes on the edge are labeled.
[0102] Step S5: Construct a graph convolutional neural network (GCN) model based on the SG-CIM knowledge graph. Aggregate the information of adjacent nodes, including semantic and structural information, through graph convolution to obtain node representation and relation representation. Then, transfer the convolution operator to the graph structure data to effectively aggregate adjacency. The transmission and aggregation of information between adjacent nodes are represented by the convolution between the central node and its neighboring nodes, thereby capturing the complex dependencies between entities and performing reasoning.
[0103] Step S6 involves applying the graph convolutional neural network model to a distributed environment. Distributed frameworks such as Apache Spark are used to implement distributed computing. Distributed computing requires addressing issues such as data partitioning, node communication, and task scheduling, necessitating detailed design and implementation.
[0104] Step S6.1, data partitioning: the SG-CIM knowledge graph data is divided into multiple subgraphs, and each subgraph is assigned to different computing nodes for processing. Each computing node only needs to process a portion of the data, thereby reducing the computational burden on a single computing node.
[0105] Step S6.2: On each computing node, run the same GCN model, but each node only processes the subgraph data it is assigned. This accelerates model training and inference and improves computational efficiency by executing the same algorithm in parallel on different computing nodes. Specifically, the aggregation function of the GCN model is defined as follows:
[0106]
[0107] in, Let N be the representation vector of node i in the l-th layer GCN. i Let W be the set of neighboring nodes of node i. (l) Let be the weight matrix, σ be the activation function, and c be the weight matrix. ij It is a structural similarity measure used to standardize the adjacency matrix.
[0108] Step S6.3 extends the aggregation function to multiple distributed computing nodes. Assume there are k computing nodes, each processing m SG-CIM knowledge graph nodes. To ensure connectivity between nodes, each node stores the adjacency matrix and feature matrix of the nodes it processes. The GCN model is then partitioned according to a data parallelism approach:
[0109] 1) Each computing node processes its own adjacency matrix A. i and adjacency matrix X i The local representation vector is obtained.
[0110] 2) Represent the local vector and adjacency matrix A i Send to the master node;
[0111] 3) The master node aggregates the local representation vectors of all computing nodes to obtain the global representation vector h. (l)
[0112]
[0113] 4) The master node will use the global representation vector h (l) Distribute it to each compute node for the next iteration.
[0114] In the above process, the parameters of the GCN model are stored on a parameter server and shared by all nodes, thereby achieving efficient distributed knowledge reasoning.
[0115] Example 4
[0116] Figure 3 This is a schematic diagram of the structure of a power grid knowledge reasoning device according to Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a spectrum adjustment module 301,
[0117] The graph adjustment module 301 is used to adjust the elements to be adjusted in the preset knowledge graph according to the neighborhood threshold distance and preset clustering rules.
[0118] The model generation module 302 is used to determine the power grid knowledge reasoning model based on the adjusted preset knowledge graph.
[0119] The knowledge reasoning module 303 is used to determine the knowledge reasoning result based on the power grid knowledge reasoning model and the distributed computing platform.
[0120] In this embodiment of the invention, the graph adjustment module adjusts the elements to be adjusted within a preset knowledge graph based on the neighborhood threshold distance and preset clustering rules. The model generation module generates a power grid knowledge reasoning model corresponding to the preset knowledge graph. The knowledge reasoning module applies the power grid knowledge reasoning model to a distributed computing platform to generate the knowledge reasoning result. This embodiment of the invention solves the problem of missing attributes and relationships in the knowledge graph, enhances the completeness of the knowledge graph data, and uses a distributed platform to enhance the scalability of knowledge graph applications. It resolves the contradiction between the openness and closedness of the environment in which the knowledge graph exists, improves the reliability of the knowledge graph, and enhances the accuracy of power grid knowledge reasoning.
[0121] In some embodiments of the invention, a graph processing module is also included, used to remove incomplete entities and erroneous entities from the preset knowledge graph.
[0122] In some embodiments of the invention, the spectrum adjustment module 301 includes:
[0123] The sample set unit is used to extract entities from the preset knowledge graph to form a sample set, wherein the entities include at least attribute data and relation data.
[0124] The sample classification unit is used to divide the sample elements in the sample set into at least one output cluster according to the neighborhood threshold distance and the preset clustering rules.
[0125] An element adjustment unit is used to adjust the element to be adjusted according to the output cluster associated with the element to be adjusted in the preset knowledge graph.
[0126] In some embodiments of the invention, the sample classification unit specifically includes: for each sample element in the sample set, determining the number of sample elements whose distance value to other sample elements in the sample set is less than the neighborhood threshold distance; when the number of sample elements is greater than the number threshold, adding the sample element to the core sample object set; creating a core object queue for each sample element in the core sample object set, and adding target samples in the sample set whose distance to the sample element is less than the neighborhood threshold distance to the core object queue corresponding to the sample element; using each core object queue as the output cluster; and when the core object sample set is empty, using each sample element in the sample set as the output cluster.
[0127] In other embodiments of the invention, the element adjustment unit specifically includes: identifying the element to be adjusted within the preset knowledge graph, wherein the element to be adjusted includes at least one of the following: missing attribute element, missing relation element, erroneous attribute element, and erroneous relation element; determining the output cluster of the element to be adjusted; when the error type of the element to be adjusted is attribute error and the attribute type is classification, adjusting the attribute of the element to be adjusted according to the proportion random value of the output cluster; when the error type of the element to be adjusted is attribute error and the attribute type is continuous, adjusting the attribute of the element to be adjusted according to the weighted average value of the output cluster; when the error type of the element to be adjusted is relation error, fusing the multi-source information of the output cluster into the relation of the element to be adjusted.
[0128] In some embodiments of the invention, the model generation module 302 includes:
[0129] The data extraction unit is used to extract RDF triples composed of entities, attributes, and relationships within the preset knowledge graph.
[0130] The model training unit is used to train a preset graph convolutional neural network model according to the RDF triples to form the power grid knowledge reasoning model.
[0131] In other embodiments of the invention, the knowledge reasoning module 303 includes:
[0132] The subgraph splitting unit is used to divide the preset knowledge graph into knowledge subgraphs corresponding to the computing nodes of the distributed computing platform.
[0133] The reasoning subunit is used to distribute and deploy the power grid knowledge reasoning model and the knowledge subgraph to the computing nodes of the distributed computing platform to generate reasoning sub-results for each computing node.
[0134] The reasoning fusion unit is used to aggregate the reasoning sub-results of each computing node into the knowledge reasoning result according to a preset aggregation rule.
[0135] The power grid knowledge reasoning device provided in the embodiments of the present invention can execute the power grid knowledge reasoning method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0136] Example 5
[0137] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0138] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0139] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0140] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the power grid knowledge reasoning method.
[0141] In some embodiments, the power grid knowledge reasoning method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the power grid knowledge reasoning method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the power grid knowledge reasoning method by any other suitable means (e.g., by means of firmware).
[0142] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0143] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0144] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0146] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0147] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0148] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0149] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for reasoning about power grid knowledge, characterized in that, The method includes: Adjusting elements to be adjusted within a preset knowledge graph based on a neighborhood threshold distance and preset clustering rules includes: extracting entities from the preset knowledge graph to form a sample set, wherein the entities include at least attribute data and relation data; dividing the sample elements in the sample set into at least one output cluster according to the neighborhood threshold distance and the preset clustering rules; and adjusting the elements to be adjusted according to the output clusters associated with the elements to be adjusted within the preset knowledge graph, wherein the preset clustering rules include at least one of the K-Menas clustering algorithm and the Canopy clustering algorithm. A power grid knowledge reasoning model is determined based on the adjusted preset knowledge graph; Determining the knowledge reasoning result based on the power grid knowledge reasoning model and the distributed computing platform includes: segmenting the preset knowledge graph into knowledge subgraphs corresponding to the computing nodes of the distributed computing platform; distributing and deploying the power grid knowledge reasoning model and the knowledge subgraphs to the computing nodes of the distributed computing platform to generate reasoning sub-results for each computing node; and aggregating the reasoning sub-results of each computing node into the knowledge reasoning result according to preset aggregation rules, wherein the preset aggregation rules are expressed as follows: in, For each computing node i Determined knowledge reasoning sub-results The result is the knowledge reasoning result, and k is the number of computing nodes in the distributed computing platform.
2. The method according to claim 1, characterized in that, Also includes: Incomplete and erroneous entities are removed from the preset knowledge graph.
3. The method according to claim 1, characterized in that, The step of dividing sample elements in the sample set into at least one output cluster according to the neighborhood threshold distance and the preset clustering rule includes: For each sample element in the sample set, determine the number of sample elements whose distance value between the sample element and other sample elements in the sample set is less than the neighborhood threshold distance; When the number of sample elements exceeds the quantity threshold, the sample elements are added to the core sample object set. For each sample element in the core sample object set, a core object queue is created, and target samples in the sample set whose distance from the sample element is less than the neighborhood threshold distance are added to the core object queue corresponding to the sample element. Each of the aforementioned core object queues is respectively used as the output cluster; When the core sample object set is empty, each sample element in the sample set is used as the output cluster.
4. The method according to claim 1, characterized in that, The step of adjusting the element to be adjusted based on the output cluster associated with the element to be adjusted within the preset knowledge graph includes: Identify the elements to be adjusted within the preset knowledge graph, wherein the elements to be adjusted include at least one of the following: missing attribute elements, missing relation elements, erroneous attribute elements, and erroneous relation elements; Determine the output cluster of the element to be adjusted; When the error type of the element to be adjusted is attribute error and the attribute type is classification, the attribute of the element to be adjusted is adjusted according to the proportion of the output cluster random value; When the error type of the element to be adjusted is attribute error and the attribute type is continuous, the attribute of the element to be adjusted is adjusted according to the weighted average of the output clusters; When the error type of the element to be adjusted is a relation error, the multi-source information of the output cluster is fused to form the relation of the element to be adjusted.
5. The method according to claim 1, characterized in that, The process of determining the power grid knowledge reasoning model based on the adjusted preset knowledge graph includes: Extract RDF triples composed of entities, attributes, and relations from the preset knowledge graph; The pre-defined graph convolutional neural network model trained according to the RDF triples is the power grid knowledge reasoning model.
6. A power grid knowledge reasoning device, characterized in that, The device includes: The knowledge graph adjustment module is used to adjust elements to be adjusted within a preset knowledge graph based on a neighborhood threshold distance and preset clustering rules. This includes: extracting entities from the preset knowledge graph to form a sample set, wherein the entities include at least attribute data and relation data; dividing the sample elements within the sample set into at least one output cluster according to the neighborhood threshold distance and the preset clustering rules; and adjusting the elements to be adjusted based on the output clusters associated with the elements to be adjusted within the preset knowledge graph, wherein the preset clustering rules include at least one of the K-Menas clustering algorithm and the Canopy clustering algorithm. The model generation module is used to determine the power grid knowledge reasoning model based on the adjusted preset knowledge graph; The knowledge reasoning module is used to determine the knowledge reasoning result based on the power grid knowledge reasoning model and the distributed computing platform, including: segmenting the preset knowledge graph into knowledge subgraphs corresponding to the computing nodes of the distributed computing platform; distributing and deploying the power grid knowledge reasoning model and the knowledge subgraphs to the computing nodes of the distributed computing platform to generate reasoning sub-results for each computing node; and aggregating the reasoning sub-results of each computing node into the knowledge reasoning result according to a preset aggregation rule, wherein the preset aggregation rule is expressed as follows: in, For each computing node i Determined knowledge reasoning sub-results The result is the knowledge reasoning result, and k is the number of computing nodes in the distributed computing platform.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the power grid knowledge reasoning method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the power grid knowledge reasoning method according to any one of claims 1-5.