Fault diagnosis method and device based on hybrid knowledge graph reasoning and storage medium

By employing a hybrid knowledge graph reasoning method, combining graph attention mechanisms and the TranSparse model, along with logical rules and reinforcement learning, and optimizing path selection, the problem of expanding sparse and large knowledge graphs is solved, thereby improving the accuracy of fault diagnosis.

CN116561302BActive Publication Date: 2025-12-16TONGJI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310072544.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-13
Publication Date
2025-12-16
Estimated Expiration
2043-01-13

AI Technical Summary

Technical Problem

Existing knowledge graph reasoning methods struggle to accurately select the search direction when dealing with sparse knowledge graphs, and rule-based methods are difficult to extend to large knowledge graphs, making them ineffective for fault diagnosis in complex manufacturing environments such as steel production lines.

Method used

A hybrid knowledge graph reasoning approach is adopted, which combines graph attention mechanism and TranSparse model to construct knowledge graph embedding model, and combines logical rules and reinforcement learning to construct reasoning model, and uses an improved beam search algorithm to optimize path selection.

Benefits of technology

It improves the interpretability and accuracy of knowledge graph reasoning, can be extended to large knowledge graphs, and improves the accuracy of fault diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116561302B_ABST
    Figure CN116561302B_ABST
Patent Text Reader

Abstract

The application relates to a fault diagnosis method and device based on mixed knowledge graph reasoning and a storage medium, wherein the method comprises the following steps: acquiring data related to steel production line faults and equipment, and constructing a fault knowledge graph; constructing a mixed knowledge graph reasoning model, wherein the mixed knowledge graph reasoning model comprises a knowledge graph embedding model constructed based on a graph attention mechanism and TranSparse and a knowledge graph reasoning model constructed based on logical rules and reinforcement learning; training the mixed knowledge graph reasoning model; and using the trained mixed knowledge graph reasoning model to diagnose steel production line equipment faults. Compared with the prior art, the application has the advantages of high accuracy, stable training and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge discovery technology, and in particular to a fault diagnosis method, apparatus and storage medium based on hybrid knowledge graph reasoning. Background Technology

[0002] The goal of knowledge graph reasoning is to infer unknown facts or relationships based on existing facts or relationships within a knowledge graph. Numerous knowledge graph reasoning methods have been proposed, such as those based on embedding learning, rule-based reasoning, and reinforcement learning. To achieve interpretable reasoning results, reinforcement learning-based multi-hop reasoning methods have been proposed, including classic knowledge graph models such as DeepPath, DIVA, MINERVA, M-Walk, and MultiHop. However, these reinforcement learning-based knowledge graph reasoning models face a significant challenge when dealing with sparse knowledge graphs. Due to insufficient information in sparse knowledge graphs, there are not enough paths between some entity pairs to serve as reasoning evidence, making it difficult for the agent to accurately select the correct search direction and perform the reasoning process. Furthermore, to improve the interpretability of knowledge graph reasoning, several symbolic rule-based models have been proposed, including classic knowledge graph models such as NTP, NeuralLP, RuleN, DRUM, and RNNLogic. These rule-based knowledge graph reasoning models improve interpretability by learning logical rules and also enable the models to generalize to similar tasks. However, rule-based knowledge graph reasoning methods are difficult to extend to large knowledge graphs. Rule-based knowledge graph reasoning models only focus on the relationships composed of rules, without considering the properties of related entities.

[0003] Steel production lines mainly include steelmaking, continuous casting, and hot rolling processes, encompassing a large number of complex mechanical equipment such as walking beam furnaces, finishing mills, coilers, and motors. This is a typical complex manufacturing environment with intricate mechanisms, numerous parameters, and frequent changes in various factors, posing significant challenges to equipment failure maintenance. Knowledge graphs are of great importance in many applications and are one of the latest research directions in the field of fault diagnosis. However, due to the highly dispersed nature of knowledge, traditional text search methods are inefficient in fault diagnosis, while rule-based knowledge graph reasoning methods suffer from limitations such as inability to scale to large knowledge graphs and failure to consider the properties of related entities. Summary of the Invention

[0004] The purpose of this invention is to provide a fault diagnosis method, device, and storage medium based on hybrid knowledge graph reasoning, taking into account the properties of related entities, so that knowledge graph reasoning can be extended to large knowledge graphs, thereby improving the accuracy of fault diagnosis.

[0005] The objective of this invention can be achieved through the following technical solutions:

[0006] A fault diagnosis method based on hybrid knowledge graph reasoning includes the following steps:

[0007] S1. Obtain data related to steel production line faults and equipment, and construct a fault knowledge graph;

[0008] S2. Construct a hybrid knowledge graph reasoning model, which includes a knowledge graph embedding model and a knowledge graph reasoning model;

[0009] Step S2 includes:

[0010] S21. Constructing a knowledge graph embedding model based on graph attention mechanism and TranSparse:

[0011] S211. Obtain entity embeddings in the fault knowledge graph based on a multi-level graph attention mechanism module.

[0012] S212. Encoding relation embeddings in fault knowledge graphs based on the TranSparse model;

[0013] S22. Combining knowledge graph embedding models, constructing knowledge graph reasoning models based on logical rules and reinforcement learning;

[0014] S3. Train a hybrid knowledge graph reasoning model;

[0015] S4. Use the trained hybrid knowledge graph reasoning model to diagnose equipment faults in steel production lines.

[0016] Step S211 includes the following steps:

[0017] S2111. Represent the constructed fault knowledge graph as G = {V, R, F}, where V represents the entity set, R represents the relation set, and F = {(e0, r, e...}. t )|e0,e t ∈V, r∈R} represents a fact triple, meaning that the knowledge graph is composed of a large number of triples;

[0018] S2112. Use a relation-level attention mechanism to rank the importance of relations related to the current entity:

[0019] v hR =W R [h||R]

[0020]

[0021] In this process, the head entity vector h and the relation vector R are merged into a single vector, and all neighborhood relation vectors related to the head entity h are evaluated, W.R and w R N represents the learnable parameters. h The neighborhood relation vector representing the head entity h;

[0022] S2113. Given the current entity h and the various relationships of different importance obtained in the previous step, evaluate the entity groups corresponding to different relationships;

[0023] v hRr =W T [v hR ||r]

[0024]

[0025] Where, N hR This represents the intersection of the sub-relations of R and the adjacent sub-relations of h;

[0026] The relations in the triples are pre-converted into corresponding sub-relations, and attention at these two levels is defined as follows:

[0027] v hr =W1[h||r]

[0028]

[0029] γ hr =α hR ·β hRr

[0030] Where W1 and w1 represent learnable parameters;

[0031] S2114. Entity-level attention-based evaluation of the importance of each neighboring entity to the current entity within a given neighborhood relationship:

[0032] v hrt =W2[v hr ||t]

[0033]

[0034] Where W2 and w2 represent learnable parameters, N hr This represents the neighboring entities of the head entity h under relation r;

[0035] S2115. The degree of attention of the head entity h to the fact triple (h, r, t) is defined as follows:

[0036] att hrt =γ hr ·η hrt

[0037] Where, γ hrη represents attention at the type level and the relation level. hrt This represents attention at the entity level;

[0038] S2116. Define the neighborhood information of an entity:

[0039]

[0040] r′=W3r

[0041] Where W3 represents the learnable parameter;

[0042] S2117. The entity encoding method in the knowledge graph is obtained as follows:

[0043] h = LeakyReLU(W4(h+h) N ))

[0044] Where W4 represents the learnable parameter;

[0045] The encoded entity has rich neighborhood information, relationship type information and entity type information.

[0046] Step S212 specifically involves:

[0047] The TranSparse model is used to encode relation embeddings in knowledge graphs, and the objective loss function for the relation embedding stage is defined as:

[0048]

[0049]

[0050] Where ||·||2 represents the L2 distance function, T represents the set of entity pairs aligned with positive examples, T′ represents the set of entity pairs of negative examples obtained by negative sampling, and γ2 is a boundary hyperparameter;

[0051] The objective function for the entity phase is defined as:

[0052]

[0053] Wherein, γ1 is a boundary hyperparameter;

[0054] The objective function for the knowledge graph embedding stage is defined as:

[0055] L Embed =L Ent +L Rel

[0056] During model training, the objective function L is continuously optimized by adjusting parameters. Embed This leads to better knowledge graph embedding.

[0057] Step S22 includes the following steps:

[0058] S221. Combine knowledge graph embedding models to construct a knowledge graph reasoning model based on reinforcement learning;

[0059] S232. Based on the improved beam search algorithm, save the top K paths of the knowledge graph reasoning model at each time step, where K is the beam size;

[0060] S233. Employ a high-level policy network based on logical rules to select the most likely path and expand the path at each time step until the target entity is reached.

[0061] Step S221 specifically involves:

[0062] For knowledge graph reasoning tasks, the goal is to base the reasoning on the question q = (e q r q , ?) Infer the correct a from the knowledge graph G nsw , where e q Represents the query entity, r q This indicates a query relationship; the core of the reinforcement learning-based knowledge graph reasoning model is that a reinforcement learning network trains an agent to learn the interaction with the knowledge graph environment.

[0063] Reinforcement learning is essentially a Markov decision process, defined as a quadruple. That is, state, action, transition, and reward, among which,

[0064] The state is: in state of time Defined as in and These represent historical trajectory embedding, comprehensive entity embedding, and node-level graph attention embedding, respectively.

[0065] Using a Long Short-Term Memory (LSTM) network as the memory component, historical trajectories are embedded. Defined as:

[0066] in, Represents the previous entity and current entity The relationship between them;

[0067] Integrated Entity Embedding It consists of two parts:

[0068]

[0069] in, Indicates the current entity and target entity e targ The distance;

[0070] Node-level graphs should be embedded. Used to help the agent focus on the current entity. Neighbor information:

[0071]

[0072] Where W5 represents a linear transformation matrix, N s express The knowledge graph's internal neighborhood entities, For the first The attention weights between the j-th entity and the j-th entity are calculated using a single-layer self-attention neural network:

[0073]

[0074] in, Represents the learnable weight vector shared by all entities;

[0075] The action is the next-step relational path chosen by the agent: the agent starts from the source entity e. s Initially, a high-level policy network based on logical rules is applied to select the most probable path, and then the path is expanded at each step until the target entity e is reached. targ ;state Action space It is the current entity The set of directional edges extended in a knowledge graph:

[0076] The transition is represented as a transition matrix. Its function is to ensure the probability distribution of the next state, and it is defined as a mapping function. The policy network encodes the current state and then outputs a probability distribution. in, The goal of the transition strategy is to Choose the action with the highest probability.

[0077] The reward R a It is the feedback given to the agent based on whether the behavior is effective and whether a series of behaviors can help the agent achieve the target entity; given a pair And knowledge graphs, if the agent reaches the target entity, i.e. The agent receives a positive reward if it reaches the wrong entity; a negative reward if the agent reaches the wrong entity; and a negative reward if the agent reaches an entity with no answer. The agent will receive a neutral reward; therefore, the three-element reward structure is as follows:

[0078]

[0079] The improved beam search algorithm is specifically as follows:

[0080] In time The path set obtained at the location Defined as:

[0081]

[0082] Select candidate path The principle is that the relation sequence can match the relevant rule from left to right; that is, only the relation sequence in the previous path that can successfully match the rule will be selected for generation.

[0083] The selection of candidate actions is divided into three stages:

[0084] a) Random action sampling: To eliminate the harmful effects of pseudo-paths, the knowledge graph uses random sampling based on... Random from Choose λ1K P Instead of choosing K, select one candidate path. P The candidate path with the highest score;

[0085] b) Action matching rules: Select λ2K that matches the relevant rules based on the action score. P There are 1 action, and λ2+λ1≤1;

[0086] c) Actions with higher scores: Select λ3K from the remaining paths of non-matching rules based on their scores. P There are several actions as supplements, where stage c) does not exist when λ2+λ1=1.

[0087] The high-level policy network based on logical rules is specifically as follows:

[0088] Knowledge graph reasoning is formalized probabilistically, where a set of logical rules z are considered as latent variables, and the target distribution p(a) is... nsw |G, q) is modeled jointly by the rule generator and the inference predictor:

[0089]

[0090] Rule generator p θ The aim is to generate a set of latent logical rules z for reasoning on a knowledge graph G to answer the query question q = (e q r q ,?), formally, given a query q=(e q r q, ? ), by only considering the query relation r q Without considering the query entity e q This generates combinational logic rules, which allows the defined rules to be generalized across entities;

[0091] For the abbreviation r q ←r1∧…∧r l Each combination rule is considered as a relation sequence [r] q r1, r2…r l r END ], where r q To query relations or rule headers, As the rule subject, r END A special relation that indicates the end of a relation sequence;

[0092] Introducing an LSTM network to parameterize the rule generator:

[0093] Given a query relation r q LSTM θ Generate each relation in the rule body sequentially until the final relation r is reached. END During this process, the probability of generating the rule is calculated simultaneously;

[0094] Then, the distribution over a set of rules z is defined as a multinomial distribution:

[0095] p θ (z|q)=Mu(z|N,LSTM θ (·|r q ))

[0096] Where Mu represents the multinomial distribution, N represents the hyperparameter of the size of the set z, and LSTM... θ (·|r q A distribution of combination rules is defined, with rule head r. q ;

[0097] Inference predictor p w The goal is to infer candidate answers e on G based on a given query q and a set of rules z. cand For each candidate answer e cand scalar score w (e cand The calculation is as follows:

[0098]

[0099]

[0100] Among them, e cand ∈A cand Acand It is a set of candidate answers that can be recognized by any logical rule in set z, P(e q ,rule,e cand ) indicates that, under the condition of following the rule, from e q Start to e cand The set of actual paths to the end, and These represent the scalar weights of each rule and path, respectively; each candidate answer e cand The score is the sum of the scores contributed by each rule. w (e cand The rule is obtained by summing up each real path found in the knowledge graph;

[0101] The answer to query q is a nsw It is entity e cand The probability is defined by applying the softmax function:

[0102]

[0103] Step S3 includes the following steps:

[0104] S31, Rule Generator p θ First, generate a set of rules. The score H for each rule is calculated as follows:

[0105]

[0106] Among them, A cand express The set of all candidate answers learned by the rules, score w (e|rule) represents the contribution rate of each rule to entity e, RNN θ (rule|r) represents the prior probability of the rule calculated by the generator;

[0107] S32. Update the inference predictor p according to the rules. w ;

[0108] S33, By drawing samples for query q Each training instance (G, q, a) nsw The objective function is approximated as follows:

[0109]

[0110] Regarding the rules A subset, log p θ,w (z I |G, q, a nswApproximately:

[0111]

[0112]

[0113] Where const represents a variable independent of z I The constant term, γ(z) I ) represents set z I Given a size, rule represents each rule in z. I The number of times a rule appears in the text, and the sampling probability for each rule is calculated as follows:

[0114]

[0115] S34. Use the H(rule) of each rule as an evaluation of rule quality: Select the K rules with the highest H(rule), and for each data instance (G, q, a) nsw Form a set of high-quality logical rules The objective function is then expressed as:

[0116]

[0117] S35. Update the rule generator to match the selected high-quality rules, and apply the high-quality rules to update the parameter θ in the rule generator, for each data instance (G, q, a nsw High-quality logical rules Considered part of the training data, by maximizing Log-likelihood is used to update and optimize the rule generator p θ .

[0118] A fault diagnosis device based on hybrid knowledge graph reasoning includes a memory, a processor, and a program stored in the memory, wherein the processor executes the program to implement the method described above.

[0119] A storage medium having a program stored thereon, which, when executed, implements the method described above.

[0120] Compared with the prior art, the present invention has the following beneficial effects:

[0121] (1) The knowledge graph embedding model based on graph attention mechanism and TranSparse proposed in this invention is particularly suitable for solving the problem of embedding complex heterogeneous knowledge graphs. It can capture the entity neighborhood information, relation type information and entity type information in the knowledge graph, so that the model can embed richer semantic information. The discrete graph search is transformed into vector space calculation, which greatly reduces the search space.

[0122] (2) This invention proposes a knowledge graph reasoning model based on logical rules and reinforcement learning, which greatly improves the interpretability of knowledge graph reasoning and effectively solves the problem of lack of paths in sparse knowledge graphs. It is not only suitable for small knowledge graphs, but can also be extended to large knowledge graphs.

[0123] (3) The present invention introduces an optimized beam search algorithm, which helps to explore low-scoring paths that are abandoned in standard beams, improves the accuracy of the agent in selecting the correct action, and makes the reasoning results more accurate. Attached Figure Description

[0124] Figure 1 This is a flowchart of the method of the present invention;

[0125] Figure 2 A schematic diagram for constructing a knowledge graph;

[0126] Figure 3 This is a schematic diagram of a hybrid knowledge graph reasoning model;

[0127] Figure 4 This is a schematic diagram of a high-level policy network based on logical rules. Detailed Implementation

[0128] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are based on the technical solution of the present invention and provide detailed implementation methods and specific operating procedures. However, the scope of protection of the present invention is not limited to the following embodiments.

[0129] This embodiment provides a fault diagnosis method based on hybrid knowledge graph reasoning, such as... Figure 1 As shown, it includes the following steps:

[0130] S1. Obtain data related to steel production line faults and equipment, and construct a fault knowledge graph, such as... Figure 2 As shown.

[0131] Specifically, the acquired data is divided into structured data, semi-structured data, and unstructured data.

[0132] Building a fault knowledge graph includes the following steps:

[0133] S11, Obtaining relation triples;

[0134] S12. Knowledge fusion; In this embodiment, knowledge fusion is achieved through referential resolution, entity disambiguation, and entity linking.

[0135] S13. Construct a fault knowledge graph.

[0136] S2. Construct a hybrid knowledge graph reasoning model, such as Figure 3 As shown.

[0137] S21. Construct a knowledge graph embedding model based on graph attention mechanism and TranSparse.

[0138] S211. Obtain entity embeddings in the fault knowledge graph based on the multi-level graph attention mechanism module.

[0139] S2111. Represent the constructed fault knowledge graph as G = {V, R, F}, where V represents the entity set, R represents the relation set, and F = {(e0, r, e...}. t )|e0,e t ∈V, r∈R} represents a fact triple, meaning that the knowledge graph is composed of a large number of triples;

[0140] S2112. Use a relation-level attention mechanism to rank the importance of relations related to the current entity:

[0141] v hR =W R [h||R]

[0142]

[0143] In this process, the head entity vector h and the relation vector R are merged into a single vector, and all neighborhood relation vectors related to the head entity h are evaluated, W. R and w R N represents the learnable parameters. h The neighborhood relation vector representing the head entity h;

[0144] S2113. Given the current entity h and the various relationships of different importance obtained in the previous step, evaluate the entity groups corresponding to different relationships;

[0145] v hRr =W T [v hR ||r]

[0146]

[0147] Where, N hR This represents the intersection of the sub-relations of R and the adjacent sub-relations of h;

[0148] The relations in the triples are pre-converted into corresponding sub-relations, and attention at these two levels is defined as follows:

[0149] v hr =W1[h||r]

[0150]

[0151] γ hr =αhR ·β hRr

[0152] Where W1 and w1 represent learnable parameters;

[0153] S2114. Entity-level attention-based evaluation of the importance of each neighboring entity to the current entity within a given neighborhood relationship:

[0154] v hrt =W2[v hr ||t]

[0155]

[0156] Where W2 and w2 represent learnable parameters, N hr This represents the neighboring entities of the head entity h under relation r;

[0157] S2115. The degree of attention of the head entity h to the fact triple (h, r, t) is defined as follows:

[0158] att hrt =γ hr ·η hrt

[0159] Where, γ hr η represents attention at the type level and the relation level. hrt This represents attention at the entity level;

[0160] S2116. Define the neighborhood information of an entity:

[0161]

[0162] r′=W3r

[0163] Where W3 represents the learnable parameter;

[0164] S2117. The entity encoding method in the knowledge graph is obtained as follows:

[0165] h = LeakyReLU(W4(h+h) N ))

[0166] Where W4 represents the learnable parameter;

[0167] The encoded entity has rich neighborhood information, relationship type information and entity type information.

[0168] S212. Relational embedding in fault knowledge graph based on TranSparse model.

[0169] Because the constructed knowledge graph of steel production line equipment faults is complex, exhibiting severe heterogeneity and imbalance, and because the aforementioned optimized multi-level graph convolutional attention network model cannot encode relation embeddings, the TranSparse model is used to encode the relation embeddings of the knowledge graph. The objective loss function for the relation embedding stage is defined as:

[0170]

[0171]

[0172] Where ||·||2 represents the L2 distance function, T represents the set of entity pairs aligned with positive examples, T′ represents the set of entity pairs of negative examples obtained from negative sampling, and γ2 is a boundary hyperparameter.

[0173] The objective function for the entity phase is defined as:

[0174]

[0175] Here, γ1 is a boundary hyperparameter.

[0176] The objective function for the knowledge graph embedding stage is defined as:

[0177] L Embed =L Ent +L Rel

[0178] During model training, the objective function L is continuously optimized by adjusting parameters. Embed This leads to better knowledge graph embedding.

[0179] S22. Combining knowledge graph embedding models, construct knowledge graph reasoning models based on logical rules and reinforcement learning.

[0180] S221. Combine knowledge graph embedding models to construct a knowledge graph reasoning model based on reinforcement learning.

[0181] For knowledge graph reasoning tasks, the goal is to base the reasoning on the question q = (e q r q , ?) Infer the correct a from the knowledge graph G nsw , where e q Represents the query entity, r q It indicates an inquiry relationship.

[0182] The core of a reinforcement learning-based knowledge graph reasoning model is that a reinforcement learning network is trained to allow an agent to learn the interaction with the knowledge graph environment; reinforcement learning is essentially a Markov decision process, defined as a quadruple. That is, state, action, transition, and reward, specifically.

[0183] A) State

[0184] exist state of time Defined as in and These represent historical trajectory embedding, comprehensive entity embedding, and node-level graph attention embedding, respectively.

[0185] Introducing historical trajectory embedding The reason is that the agent needs to make sequential decisions, and historical trajectory embedding. It can record historical information, thereby effectively guiding agents to navigate effectively on the knowledge graph.

[0186] To better assist agents in recording and learning historical paths, a Long Short-Term Memory (LSTM) network is used as the memory component, which can greatly reduce the dependence of knowledge graphs on pre-training.

[0187] Embedding historical trajectory Defined as:

[0188]

[0189] Where, r t Indicates the previous entity e t-1 and current entity e t The relationship between them.

[0190] in, Represents the previous entity and current entity The relationship between them;

[0191] Integrated Entity Embedding It consists of two parts:

[0192]

[0193] in, Indicates the current entity and target entity e targ The distance;

[0194] Node-level graphs should be embedded. Used to help the agent focus on the current entity. Neighbor information:

[0195]

[0196] Where W5 represents a linear transformation matrix, N s express The knowledge graph's internal neighborhood entities, For the first The attention weights between the j-th entity and the j-th entity are calculated using a single-layer self-attention neural network:

[0197] in, Represents the learnable weight vector shared by all entities;

[0198] B) Actions

[0199] The action is the next relational path chosen by the agent. The agent starts from the source entity e. s Initially, a high-level policy network based on logical rules is applied to select the most probable path, and then the path is expanded at each step until the target entity e is reached. targ .

[0200] state Action space It is the current entity The set of directional edges extended in a knowledge graph:

[0201]

[0202] C) Transition

[0203] Transition matrix Its function is to ensure the probability distribution of the next state, and it is defined as a mapping function. The policy network encodes the current state and then outputs a probability distribution. in, The goal of the transition strategy is to Choose the action with the highest probability.

[0204] D) Rewards

[0205] Reward R a It is the feedback given to the agent based on whether the behavior is effective and whether a series of behaviors can help the agent achieve the target entity.

[0206] To address the issue of failing to reach a response entity within a limited number of steps of proxy execution, this embodiment adds an additional "no answer" condition. NOANSWER Therefore, a ternary reward structure is proposed. Given a pair And knowledge graphs, if the agent reaches the target entity, i.e. The agent receives a positive reward if it reaches the wrong entity; a negative reward if the agent reaches the wrong entity; and a negative reward if the agent reaches an entity with no answer. The agent will receive a neutral reward; therefore, the three-element reward structure is as follows:

[0207]

[0208] S232. Based on an improved beam search algorithm, store the top K paths of the knowledge graph reasoning model at each time step, where K is the beam size.

[0209] In time The path set obtained at the location Defined as:

[0210]

[0211] Select candidate path The principle is that the relation sequence can match relevant rules from left to right. For example, given rule r q ←r1∧r2 and two candidate paths (e s (r1, e1, r2, e2), (e s Only if the relation sequence in the preceding path (r2, e3, r3, e4) successfully matches the rule will it be selected for generation.

[0212] The selection of candidate actions is divided into three stages:

[0213] a) Random action sampling: To eliminate the harmful effects of pseudo-paths, the knowledge graph uses random sampling based on... Random from Choose λ1K P Instead of choosing K, select one candidate path. P The candidate path with the highest score;

[0214] b) Action matching rules: Select λ2K that matches the relevant rules based on the action score. P There are 1 action, and λ2+λ1≤1;

[0215] c) Actions with higher scores: Select λ3K from the remaining paths of non-matching rules based on their scores. P There are several actions as supplements, where stage c) does not exist when λ2+λ1=1.

[0216] With the optimized three-stage beam search algorithm described above, low-scoring paths that are discarded in the standard beam can also be explored. Furthermore, the action random sampling scheme can prevent the model from only selecting rewarded paths.

[0217] S233. Employ a high-level policy network based on logical rules to select the most likely path and expand the path at each time step until the target entity is reached.

[0218] The action selection process in the aforementioned Markov decision-making process faces two main challenges: 1) Random initialization of initial parameters and increased path length make it difficult for the model to select the correct action to reach the target entity; 2) Due to the complexity of knowledge graphs, the action space can be very large, and reinforcement learning-based methods often require a large number of trials from scratch to find a reliable evidence path to obtain a non-zero reward. Since rules can accurately describe the mapping from query relations to semantic combination paths, this embodiment designs a high-level policy network based on logical rules, such as... Figure 4 As shown, a reinforcement learning agent in a sequential space is modeled. Using rules as prior information for actions can both increase the probability of a path receiving a reward and facilitate efficient exploration.

[0219] This embodiment uses five types of Horn rules to mine knowledge graphs: inverse rules, symmetric rules, transitive rules, combination rules, and closed path rules.

[0220] Knowledge graph reasoning is formalized probabilistically, where a set of logical rules z are considered as latent variables, and the target distribution p(a) is... nsw |G, q) is modeled jointly by the rule generator and the inference predictor:

[0221]

[0222] Rule generator p θ The aim is to generate a set of latent logical rules z for reasoning on a knowledge graph G to answer the query question q = (e q r q ,?), formally, given a query q=(e q r q , ? ), by only considering the query relation r q Without considering the query entity e q This generates combinational logic rules, which allows the defined rules to be generalized across entities.

[0223] For the abbreviation r q ←r1∧…∧r l Each combination rule is considered as a relation sequence [r] q r1, r2…r l r END ], where r q To query relations or rule headers, As the rule subject, r END A special relation that indicates the end of a relation sequence.

[0224] Introducing an LSTM network to parameterize the rule generator:

[0225] Given a query relation rq LSTM θ Generate each relation in the rule body sequentially until the final relation r is reached. END During this process, the probability of generating the rule is calculated simultaneously.

[0226] Then, the distribution over a set of rules z is defined as a multinomial distribution:

[0227] p θ (z|q)=Mu(z|N,LSTM θ (·|r q ))

[0228] Where Mu represents the multinomial distribution, N represents the hyperparameter of the size of the set z, and LSTM... θ (·|r q A distribution of combination rules is defined, with rule head r. q .

[0229] Inference predictor p w The goal is to infer candidate answers e on G based on a given query q and a set of rules z. cand For each candidate answer e cand scalar score w (e cand The calculation is as follows:

[0230]

[0231] Among them, e cand ∈A cand A cand It is a set of candidate answers that can be recognized by any logical rule in set z, P(e q ,rule,e cand ) indicates that, under the condition of following the rule, from e q Start to e cand The set of actual paths to the end, and These represent the scalar weights of each rule and path, respectively; each candidate answer e cand The score is the sum of the scores contributed by each rule. w (e cand The rule is obtained by summing up each real path found in the knowledge graph.

[0232] The answer to query q is a nsw It is entity e cand The probability is defined by applying the softmax function:

[0233]

[0234] S3. Train a hybrid knowledge graph reasoning model.

[0235] S31, Rule Generator p θ First, generate a set of rules. The score H for each rule is calculated as follows:

[0236]

[0237] Among them, A cand express The set of all candidate answers learned by the rules, score w (e|rule) represents the contribution rate of each rule to entity e, RNN θ (rule|r) represents the prior probability of the rule calculated by the generator.

[0238] S32. Update the inference predictor p according to the rules. w .

[0239] S33, By drawing samples for query q Each training instance (G, q, a) nsw The objective function is approximated as follows:

[0240]

[0241] Regarding the rules A subset, log p θ,w (z I |G, q, a nsw Approximately:

[0242]

[0243]

[0244] Where const represents a variable independent of z I The constant term, γ(z) I ) represents set z I Given a size, rule represents each rule in z. I The number of times a rule appears in the text, and the sampling probability for each rule is calculated as follows:

[0245]

[0246] S34. Use the H(rule) of each rule as an evaluation of rule quality: Select the K rules with the highest H(rule), and for each data instance (G, q, a) nsw Form a set of high-quality logical rules The objective function is then expressed as:

[0247]

[0248] S35. Update the rule generator to match the selected high-quality rules, and apply the high-quality rules to update the parameter θ in the rule generator, for each data instance (G, q, a nsw High-quality logical rules Considered part of the training data, by maximizing Log-likelihood is used to update and optimize the rule generator p θ .

[0249] Therefore, the rule generator can learn to generate high-quality rules for the inference predictor to explore, reducing the search space and producing better inference results.

[0250] S4. Use the trained hybrid knowledge graph reasoning model to diagnose equipment faults in steel production lines.

[0251] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0252] In this embodiment, the dataset comes from a steel factory. Nineteen types of relationships and 2136 entities were identified through statistical analysis. The training set contains 32,500 triples, the test set contains 2080 triples, and the validation set contains 7600 triples. Our model was compared with other classic models in link prediction experiments, using MRR and Hit@1 as evaluation metrics. The experimental results are shown in Table 1. The experimental results demonstrate that the proposed hybrid knowledge graph reasoning model has higher accuracy compared to other methods.

[0253] Table 1 Experimental Results

[0254] Model MRR hits@1 TransE 70.1 63.1 TransH 73.4 64.8 TransD 74.2 67.9 PRA 68.5 72.3 DeepPath 73.3 65.8 Multi-hop 74.1 66.7 This invention 83.5 78.1

[0255] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A fault diagnosis method based on hybrid knowledge graph reasoning, characterized in that, Includes the following steps: S1. Obtain data related to steel production line faults and equipment, and construct a fault knowledge graph; S2. Construct a hybrid knowledge graph reasoning model, which includes a knowledge graph embedding model and a knowledge graph reasoning model; Step S2 includes: S21. Constructing a knowledge graph embedding model based on graph attention mechanism and TranSparse: S211. Obtain entity embeddings in the fault knowledge graph based on a multi-level graph attention mechanism module. S212. Encoding relation embeddings in fault knowledge graphs based on the TranSparse model; S22. Combining knowledge graph embedding models, constructing knowledge graph reasoning models based on logical rules and reinforcement learning; S221. Combine knowledge graph embedding models to construct a knowledge graph reasoning model based on reinforcement learning; S232. Based on the improved beam search algorithm, the knowledge graph reasoning model is ranked first in each time step. K The path, where K Beam size; S233. Employ a high-level policy network based on logical rules to select the most likely path and expand the path at each time step until the target entity is reached. S3. Train a hybrid knowledge graph reasoning model; S4. Use the trained hybrid knowledge graph reasoning model to diagnose equipment faults in steel production lines.

2. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 1, characterized in that, Step S211 includes the following steps: S2111, Represent the constructed fault knowledge graph as ,in, Represents a set of entities. Represents a set of relations. This indicates that fact triples represent knowledge graphs, which are composed of a large number of triples. S2112. Use a relation-level attention mechanism to rank the importance of relations related to the current entity: Among them, the head entity vector and relation vector Merge into a single vector and evaluate with the head entity. All related neighborhood relation vectors, and Indicates learnable parameters, Represents head entity The neighborhood relation vector; S2113, in the current entity Under the various relationships of different importance obtained in the previous step, evaluate the entity groups corresponding to different relationships; in, express sub-relations and The intersection of adjacent sub-relationships; The relations in the triples are pre-converted into corresponding sub-relations, and attention at these two levels is defined as follows: in, and Indicates learnable parameters; S2114. Entity-level attention-based evaluation of the importance of each neighboring entity to the current entity within a given neighborhood relationship: in, and Indicates learnable parameters, Representing relations lower entity Neighboring entities; S2115, Head Entity Fact Triad Attention level is defined as: in, This indicates attention at the type level and the relation level. This represents attention at the entity level; S2116. Define the neighborhood information of an entity: in, Indicates learnable parameters; S2117. The entity encoding method in the knowledge graph is obtained as follows: in, Indicates learnable parameters; The encoded entity has rich neighborhood information, relationship type information and entity type information.

3. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 2, characterized in that, Step S212 specifically involves: The TranSparse model is used to encode relation embeddings in knowledge graphs, and the objective loss function for the relation embedding stage is defined as: in, Represents the L2 distance function. This represents the set of entity pairs that are aligned to positive examples. This represents the set of negative entity pairs obtained by negative sampling. It is a boundary hyperparameter; The objective function for the entity phase is defined as: = in, It is a boundary hyperparameter; The objective function for the knowledge graph embedding stage is defined as: = During model training, the objective function is optimized by continuously tuning parameters. This leads to better knowledge graph embedding.

4. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 1, characterized in that, Step S221 specifically involves: For knowledge graph reasoning tasks, the goal is to be question-based. From knowledge graphs The correct reasoning is derived from the middle. ,in, Indicates the entity being inquired about. This indicates a query relationship; the core of the reinforcement learning-based knowledge graph reasoning model is that a reinforcement learning network trains an agent to learn the interaction with the knowledge graph environment; Reinforcement learning is essentially a Markov decision process, defined as a quadruple. That is, state, action, transition, and reward, among which, The state is: in state of time Defined as ,in , and These represent historical trajectory embedding, comprehensive entity embedding, and node-level graph attention embedding, respectively. Using a Long Short-Term Memory (LSTM) network as the memory component, historical trajectories are embedded. Defined as: in, Represents the previous entity and current entity The relationship between them; Integrated Entity Embedding It consists of two parts: = [ in, Indicates the current entity and target entity The distance; Node-level graphs should be embedded. Used to help the agent focus on the current entity. Neighbor information: in, Describe a linear transformation matrix. express The knowledge graph's internal neighborhood entities, For the first The entity and the first The attention weights between entities are calculated using a single-layer self-attention neural network: in, Represents the learnable weight vector shared by all entities; The action is the next step in the relational path chosen by the agent: the agent starts from the source entity. Initially, a high-level policy network based on logical rules is applied to select the most probable path, and then the path is expanded at each step until the target entity is reached. ;state Action space It is the current entity The set of directional edges extended in a knowledge graph: ; The transition is represented by a transition matrix ℵ, which serves to ensure the probability distribution of the next state and is defined as a mapping function. The policy network encodes the current state and then outputs a probability distribution. ,in, The goal of the transition strategy is to Choose the action with the highest probability. The reward It is the feedback to the agent based on whether the behavior is effective and whether a series of behaviors can help the agent achieve the target entity; given a pair ( And knowledge graphs, if the agent reaches the target entity, i.e. If the agent reaches the wrong entity, it receives a positive reward; if the agent reaches the wrong entity, it receives a negative reward; if the agent reaches an entity with no answer, it receives a negative reward. The agent will receive a neutral reward; therefore, the three-element reward structure is as follows: 。 5. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 4, characterized in that, The improved beam search algorithm is specifically as follows: In time The path set obtained at the location Defined as: Select candidate path The principle is that the relation sequence can match the relevant rule from left to right; that is, only the relation sequence in the previous path that can successfully match the rule will be selected for generation. ; The selection of candidate actions is divided into three stages: a) Random action sampling: To eliminate the harmful effects of pseudo-paths, the knowledge graph uses random sampling based on... Random from select Instead of selecting a candidate path, choose one. The candidate path with the highest score; b) Action matching rules: Select actions that match the relevant rules based on the action score. Each action, and ; c) Higher-scoring actions: Select from the remaining paths of non-matching rules based on their scores. As a supplement, when At that time, stage c) does not exist.

6. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 5, characterized in that, The high-level policy network based on logical rules is specifically as follows: Five types of Horn rules are used to mine knowledge graphs: inverse rules, symmetric rules, transitive rules, combination rules, and closed path rules; Knowledge graph reasoning is formalized in a probabilistic manner, with a set of logical rules. Treated as latent variables, target distribution Modeled jointly by a rule generator and an inference predictor: Rule generator The aim is to generate a set of potential logical rules. Used for knowledge graphs To reason in order to answer the questions asked. In form, given a query By considering only the query relationship Without considering the query entity This generates combinational logic rules, which allows the defined rules to be generalized across entities; For abbreviated as Each combination rule is considered a relation sequence. , in To query relations or rule headers, As the subject of the rules, A special relation that indicates the end of a relation sequence; Introducing an LSTM network to parameterize the rule generator: Given a query relation , Generate each relation in the rule body sequentially until the ending relation is reached. During this process, the probability of generating the rule is calculated simultaneously; Then, a set of rules The distribution on is defined as a multinomial distribution: in, Represents a multinomial distribution. Represents a set The size of the hyperparameter, A distribution of combination rules is defined, with the rule head being... ; Inference predictor The purpose is to base a given query on... and a set of rules ,exist Inferring candidate answers For each candidate answer scalar The calculation is as follows: in, , It can be set The set of candidate answers identified by any logical rule. This indicates that the rules are being followed. Under the conditions, from Start to The set of actual paths to the end, and These represent the scalar weights of each rule and path, respectively; each candidate answer... The score is the sum of the scores contributed by each rule. It is obtained by summing up each real path found in the knowledge graph; Query The answer It is a physical entity The probability is defined by applying the softmax function: 。 7. The fault diagnosis method based on hybrid knowledge graph reasoning according to claim 6, characterized in that, Step S3 includes the following steps: S31, Rule Generator First, generate a set of rules. The score for each rule The calculation is as follows: in, express The set of all candidate answers learned from the rules. This indicates that each rule applies to an entity. Contribution rate, This represents the prior probability of the rule calculated by the generator; S32. Update the inference predictor according to the rules. ; S33, By querying Drawing samples Each training instance The objective function is approximated as follows: Regarding the rules A subset, Approximately: in, Indicates an independent The constant term, Represents a set Given size, Indicates each rule in The number of times a rule appears in the text, and the sampling probability for each rule is calculated as follows: S34. For each rule... As an evaluation of rule quality: select the highest... of Rules for each data instance ( Form a set of high-quality logical rules Then the objective function is expressed as: S35. Update the rule generator to match the selected high-quality rules, and apply the updated parameters in the rule generator to the high-quality rules. Each data instance High-quality logical rules Considered part of the training data, by maximizing Log-likelihood is used to update and optimize the rule generator. .

8. A fault diagnosis device based on hybrid knowledge graph reasoning, comprising a memory, a processor, and a program stored in the memory, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1-7.

9. A storage medium having a program stored thereon, characterized in that, When the program is executed, it implements the method as described in any one of claims 1-7.