Equipment defect grade classification method and system based on knowledge graph

Through the equipment defect level classification method based on knowledge graph, combined with few-shot learning and graph structure proximity text encoding, the problems of unsystematic knowledge representation and low information extraction efficiency in equipment defect level classification are solved, and efficient defect classification and intelligent operation and maintenance support are achieved.

CN120611049APending Publication Date: 2025-09-09BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510737406.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

The existing technology in equipment defect level classification has problems such as unsystematic knowledge representation, low information extraction efficiency, incomplete knowledge graph and low defect classification efficiency. It is difficult to meet the needs of intelligent operation and maintenance, especially when faced with multi-source heterogeneous data and complex descriptions.

Method used

A knowledge graph-based equipment defect level classification method is adopted. By integrating few-shot learning, machine reading comprehension and comparative learning, combined with a graph structure proximity text encoding knowledge completion algorithm, a two-stage defect classification framework is designed to integrate multi-source heterogeneous data and improve knowledge utilization efficiency.

Benefits of technology

It significantly improves the accuracy and efficiency of equipment defect classification, meets the needs of intelligent operation and maintenance, and optimizes the knowledge acquisition and utilization process of operation and maintenance personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120611049A_ABST
    Figure CN120611049A_ABST
Patent Text Reader

Abstract

The invention discloses an equipment defect grade classification method and system based on a knowledge graph, and belongs to the field of equipment defect classification. Structured information is extracted through a two-stage pipeline extraction algorithm; a few-sample named entity recognition task is realized by a prompt-based machine reading understanding named entity recognition method; judging the relationship between the paired entities based on a prompted relationship extraction method; according to the template-based structured data triple extraction method, original structured data is analyzed into a knowledge triple; deep structure information in the knowledge graph is learned by expanding first-order to second-order proximity; realizing candidate entity generation and candidate path extraction based on a dual-channel recall strategy; and performing fine-grained semantic matching and sorting on the input defect text and the candidate path based on a single-tower structure to position the most similar defect type. According to the method, the knowledge graph construction technology is utilized to solve the problems of integration, processing and efficient utilization of multi-source heterogeneous data, and the efficiency and accuracy of defect classification are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of equipment defect classification, and specifically relates to a method and system for equipment defect grade classification based on knowledge graph. Background Art

[0002] With the development of the data age, deep learning models are evolving towards larger scale. In recent years, a series of new large-scale models (such as BERT, GPT, etc.) have emerged, and these models have demonstrated excellent performance through pre-training methods. Pre-trained language models have been widely used in NLP tasks and have shown remarkable results. A popular practice for performing downstream classification tasks is to replace the output layer of the pre-trained model with a classifier head and fine-tune it using a task-specific objective function. However, as the scale of model parameters increases, fine-tuning all parameters requires a lot of computing resources and relies on a large amount of labeled data. In addition, traditional fine-tuning methods require readjusting the model structure when faced with new data, which limits their ability to utilize pre-trained knowledge.

[0003] Existing rule-based and traditional machine learning-based equipment defect classification methods use manually designed rules and statistically based machine learning models to classify equipment defects. Traditional machine learning methods perform well on small datasets and have low computational costs. Equipment defect classification methods based on text matching models use deep learning models to semantically encode equipment defect text and implement defect classification through text matching technology. This method directly matches the input equipment defect text with predefined defect types and outputs the most likely equipment defect type. This method relies on large-scale annotated data for model training to improve text matching accuracy.

[0004] Existing technologies attempt to solve the problem of equipment defect classification, but they have obvious deficiencies in knowledge representation, information extraction, and classification efficiency. The details are as follows:

[0005] (1) Existing technologies lack systematic organization and integration of domain equipment defect knowledge, making it difficult for operation and maintenance personnel to efficiently acquire and utilize semi-structured or unstructured knowledge scattered in literature, standards, and reports, affecting the efficiency of defect classification. For example, the equipment defect level classification method based on text matching models requires full matching of all predefined defect types, which has a high computational overhead. Especially when the number of defect types is large, the defect classification efficiency is significantly reduced.

[0006] (2) When traditional information extraction methods used in existing technologies process multi-source heterogeneous data (such as literature, reports, and standards) in the field of equipment operation and maintenance, there are problems such as scarcity of labeled data, low extraction efficiency, and insufficient accuracy. This makes it difficult to build a comprehensive knowledge base and meet actual needs, thus limiting the automated extraction and application of knowledge.

[0007] (3) The knowledge graph construction technology used in existing technologies relies on manual annotation or semi-automatic extraction. The data sources are limited and the quality is uneven, resulting in widespread data sparsity and incompleteness in knowledge graphs. In addition, existing knowledge completion methods have deficiencies in structural modeling and semantic representation, which affects the reasoning ability of knowledge graphs.

[0008] (4) Existing technologies have difficulty effectively addressing the diverse types of equipment defects, ambiguous descriptions, and unstructured expressions, resulting in low defect classification efficiency and an inability to meet the needs of intelligent operation and maintenance. For example, the equipment defect level classification method based on the text matching model performs poorly when processing professional terms and complex descriptions in the field of equipment defects, and it is difficult to accurately capture domain-specific semantic information. In addition, due to the lack of a pre-screening mechanism for candidate defect types, the model needs to match all possible defect types, resulting in low defect classification efficiency. Summary of the Invention

[0009] To address the technical challenges of existing equipment defect classification methods during equipment operation, maintenance, and repair, the present invention provides a knowledge graph-based equipment defect classification method and system. By integrating advanced technologies such as few-shot learning, machine reading comprehension, and comparative learning, the present invention aims to address core issues faced during equipment operation, maintenance, and repair, including low information extraction accuracy, insufficient knowledge utilization, and inefficient defect classification. By leveraging knowledge graph construction technology, the present invention effectively addresses the challenges of integrating, processing, and efficiently utilizing multi-source heterogeneous data, significantly improving the efficiency and accuracy of defect classification.

[0010] The technical solutions adopted by the present invention to solve the technical problems are as follows:

[0011] The equipment defect level classification method based on knowledge graph provided by the present invention includes the following steps:

[0012] Step S1: Information extraction method based on prompt learning;

[0013] S1.1: Extract valuable structured information from unstructured text data through a two-stage pipeline extraction algorithm;

[0014] S1.2: Implementing few-shot named entity recognition tasks through a hint-based learning-based named entity recognition method for machine reading comprehension;

[0015] S1.3: Determine the relationship between pairs of entities using a hint-based learning-based relation extraction method using text classification and a parameter transfer strategy;

[0016] S1.4: Parse the original structured data into knowledge triples through a template-based structured data triple extraction method;

[0017] Step S2: Text encoding knowledge completion algorithm based on graph structure proximity;

[0018] S2.1: Learn deep structural information in knowledge graphs by extending first-order proximity to second-order proximity;

[0019] S2.2: Text encoding knowledge graph completion algorithm based on graph structure proximity;

[0020] S2.2.1: Divide the triple into two asymmetric parts. Use the first text encoder to concatenate the head entity and relation text. Use the second text encoder to encode the tail entity and its description.

[0021] S2.2.2: Combine the negative samples within the batch and the negative samples of the previous batch, and generate multiple negative triplets from the positive triplets through negative sampling within the batch and negative sampling of the previous batch;

[0022] S2.2.3: Use the generated multiple negative triplets for model training and prediction;

[0023] Step S3: Two-stage defect classification method based on knowledge graph;

[0024] S3.1: Candidate entity generation and candidate path extraction are achieved through a path generation method based on a dual-channel recall strategy;

[0025] S3.2: A single-tower-based path matching method is used to perform fine-grained semantic matching and sorting of the input device defect text and the extracted candidate paths to accurately locate the most similar defect type.

[0026] Furthermore, in step S1.1, the two-stage pipeline extraction algorithm includes a named entity recognition stage and a relationship extraction stage; in the named entity recognition stage, the original unstructured text is preprocessed, and then the various entities therein are identified by the named entity recognition model and an entity set is output; in the relationship extraction stage, the identified entities are arranged in pairs to generate a set of all possible entity pairs, and then the relationship between each entity pair is analyzed by the relationship extraction model. If a relationship exists, the corresponding relationship type is returned, otherwise it is classified into other categories.

[0027] Furthermore, the specific implementation process of step S1.2 is as follows:

[0028] By marking the start and end positions of each entity with special strings [B-ENT] and [E-ENT], and adding these two special strings to the vocabulary of the pre-trained language model, a manual label vocabulary is constructed to map each entity category to a semantically related label vocabulary, thereby constructing a prompt template for the adaptation domain equipment defect dataset; this prompt template is inserted into each input sentence to generate an expanded input sequence, which is input into the encoder to generate a contextualized representation, and the output of the last hidden layer is used as the representation of each string; the dot product is used as a metric to calculate the distance between the special tokens in the prompt template and each string to determine the start and end positions of the entity; the dot product-based metric is used to find the rightmost end position closest to the start position, and finally the entity span is assigned to the corresponding entity label in the entity type set.

[0029] Furthermore, in step S1.3, the entity is concatenated with the original unstructured text by combining special tags to construct a prompt template for the entity. The prompt template is input into the relationship extraction model to obtain the output embedding vector of the [CLS] tag, which is input into the classifier. By calculating the probability score of each relationship type, the relationship type with the highest probability is finally selected as the relationship between the two entities.

[0030] Furthermore, in step S2.2.2, the mathematical expressions of the negative sampling process within the batch and the negative sampling process of the previous batch are as follows:

[0031]

[0032] Among them, h represents the head entity, r represents the relationship, t′ represents the negative triplet, G represents the training graph, IBNS represents the within-batch negative sampling operation, and PBNS represents the previous batch negative sampling operation.

[0033] Furthermore, in step S2.2.3, InfoNCE loss is used in the model training phase:

[0034]

[0035] in, represents the score function of the candidate triple, h represents the head entity, r represents the relationship, and t represents the tail entity; the temperature τ is a learnable parameter used to control the relative impact of negative samples on the loss;

[0036] In the model prediction stage, the entity relationship embedding is calculated for each triple and the dot product is used to obtain the similarity score between entities, and the entity with the largest score is predicted.

[0037] Furthermore, in step S3.1, the candidate entity generation process is as follows:

[0038] Using the existing synonym dictionary in the field, the entities in the equipment defect text are standardized and mapped to generate a preliminary set of candidate entities. The entities in the equipment defect text are converted into high-dimensional semantic vectors using the pre-trained M3E model through a semantic vector-based recall method. At the same time, the entity nodes in the knowledge graph are vectorized and stored in the vector retrieval database FAISS. By calculating the similarity between the text entity vector and the knowledge graph entity vector, candidate entities with high semantic relevance are screened out.

[0039] Furthermore, in step S3.1, the candidate path extraction process is as follows:

[0040] The Neo4j database is used to store the knowledge graph, and its dedicated Cypher query language is used for path extraction. That is, starting from the candidate device entity, according to the predefined relationship type, the relevant nodes in the knowledge graph are gradually traversed to extract the complete path from the device to the defect description.

[0041] Furthermore, the specific implementation process of step S3.2 is as follows:

[0042] The entities and relationships in the candidate paths are combined according to natural language rules and converted into readable text form. A text matching model based on a pre-trained language model is used to calculate the semantic similarity between the input defect text and the candidate path text. All candidate paths are sorted according to semantic similarity, and the path with the highest score is selected as the most similar equipment defect type.

[0043] The equipment defect level classification system based on knowledge graph provided by the present invention includes:

[0044] Persistence layer, used to implement data storage and access;

[0045] The service layer includes a named entity recognition service module, a knowledge embedding service module, a text matching service module, a knowledge graph query service module, and a defect classification service module. The knowledge graph query service module constructs a Cypher query statement based on the input entities and relationships, and then searches the knowledge graph. The defect classification service module calls the other four functional service modules to obtain defect type sorting and screening results.

[0046] The display layer is used to guide users to select functions and visualize the classification results of defect text and the query results of the knowledge graph.

[0047] The beneficial effects of the present invention are:

[0048] (1) This invention significantly improves the efficiency of operation and maintenance personnel in acquiring and utilizing knowledge by constructing a systematic knowledge graph and integrating the domain equipment defect knowledge scattered in literature, standards and reports, thereby optimizing the defect diagnosis and management process.

[0049] (2) This paper combines technologies such as few-sample learning and machine reading comprehension to design an information extraction method based on prompt learning and transfer learning, which solves the problem of scarce labeled data, enhances the generalization ability of the model in few-sample scenarios, and improves the accuracy and efficiency of knowledge extraction.

[0050] (3) The text encoding knowledge completion algorithm of the present invention is based on graph structure proximity. By considering the high-order proximity relationship between nodes, it enhances the structural modeling and semantic representation capabilities of the knowledge graph, and improves the integrity and reasoning ability of the knowledge graph.

[0051] (4) The present invention designs a two-stage defect classification framework, which combines structured query of knowledge graph and deep learning semantic matching, significantly improving the accuracy and reasoning efficiency of defect classification and meeting the needs of intelligent operation and maintenance in the field.

[0052] (5) The domain equipment defect knowledge graph system constructed by the present invention provides functions such as defect classification and defect knowledge query, providing intelligent decision-making support for equipment operation and maintenance personnel. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a flowchart of a method for classifying equipment defect levels based on a knowledge graph provided by the present invention.

[0054] Figure 2 This is a schematic diagram of the two-stage pipeline extraction algorithm.

[0055] Figure 3 Schematic diagram of the prompt-based relationship extraction method.

[0056] Figure 4 This is a schematic diagram of the text encoding knowledge completion algorithm based on graph structure proximity.

[0057] Figure 5 Schematic diagram of the two-stage defect classification method based on knowledge graph.

[0058] Figure 6 Schematic diagram of the text matching model for defect text paths.

[0059] Figure 7 Generate results for the path.

[0060] Figure 8 Path matching result.

[0061] Figure 9 This is an architecture diagram of the equipment defect level classification system based on knowledge graph provided by the present invention.

[0062] Figure 10 Deployment for Docker container-based systems.

[0063] Figure 11 Query results for nodes on the knowledge graph.

[0064] Figure 12 Defect query results on the knowledge graph.

[0065] Figure 13 Returns the result interface for defect classification. DETAILED DESCRIPTION

[0066] The present invention is further described in detail below with reference to the accompanying drawings.

[0067] The present invention combines few-shot learning and machine reading comprehension technology to solve the problem of scarcity of labeled data by designing an efficient information extraction method and form a structured knowledge representation. At the same time, the present invention proposes a text encoding knowledge completion algorithm based on graph structure proximity to enhance the structural modeling and semantic representation capabilities of the knowledge graph, and improve the integrity and reasoning capabilities of the knowledge graph. The present invention improves the efficiency and accuracy of defect classification by designing a two-stage defect classification method based on the knowledge graph, combining structured query of the knowledge graph with deep learning semantic matching, and meets the needs of intelligent operation and maintenance in the field.

[0068] In a first aspect, the present invention provides a method for classifying equipment defect levels based on a knowledge graph.

[0069] See also Figure 1 As shown, the present invention provides a method for classifying equipment defect levels based on a knowledge graph, which specifically includes the following steps:

[0070] Step S1: Information extraction method based on prompt learning;

[0071] To address the scarcity of annotated data in field equipment operation and maintenance, this paper proposes a prompt-based machine reading comprehension model as a named entity recognition model for few-shot named entity recognition. This model also improves the efficiency and accuracy of relation extraction through a parameter transfer strategy. Compared to existing technologies, this combined prompt learning and transfer learning approach makes the model more efficient and accurate in handling complex extraction tasks.

[0072] S1.1: Two-stage pipeline extraction algorithm;

[0073] First, the field equipment defect data set is collected, and the technical means adopted mainly include crawler technology, OCRA recognition technology, etc. Among them, unstructured text data such as defect reports are input into the system of the present invention to realize equipment defect level classification.

[0074] Knowledge extraction is an important task to extract valuable structured information from unstructured text data, aiming to better understand and utilize the knowledge in the text. In this process, named entity recognition and relationship extraction are two important steps. This paper designs a two-stage pipeline extraction algorithm based on prompts, i.e., a two-stage pipeline extraction algorithm, to extract valuable structured information from unstructured text data and improve the accuracy and efficiency of knowledge extraction. The specific implementation process is as follows: Figure 2 shown.

[0075] During the named entity recognition phase, the raw unstructured text input (oil leakage from bushings on the high-voltage side of the main transformer) is first cleaned and standardized to remove noise and ensure data quality. This preprocessed unstructured text is then fed into the named entity recognition model to identify entities within the text, including "equipment," "component," "location," and "defect type." Ultimately, the named entity recognition model outputs an entity set containing each entity and its specific instances, for example: {"equipment": "main transformer," "component": "bushing," "defect type": "oil leakage"}.

[0076] Entering the relationship extraction stage, the identified entities are arranged pairwise to generate a set of all possible entity pairs. For example, from the above entity set, the following combinations can be obtained: {("main transformer", "bushing"), ("main transformer", "oil leakage"), ("bushing", "oil leakage")}. These entity pairs are then combined with the original unstructured text, and Y = (x, p), x∈X, p∈Paris (where X represents the original text, x represents a character or word in the original text, p represents an entity pair (such as (main transformer, bushing)), Y represents the model input constructed based on x and entity pair p, and Paris represents the set of candidate entity pairs) is passed as input data to the relationship extraction model (specifically, a PLM-based classification model such as BERT or RoBERT can be used). In the relationship extraction model, entity pairs are used as input, and the model analyzes possible relationships between entity pairs. The relationship extraction model analyzes possible relationships between entity pairs and returns the corresponding relationship type if a relationship exists. Otherwise, it is classified as "other." In addition, generating all possible entity pairs will generate a large number of negative samples, which may lead to overfitting. Therefore, when constructing the dataset for relationship extraction, the present invention uses negative sampling technology to balance the negative samples, ensuring a reasonable ratio of positive and negative samples and alleviating overfitting.

[0077] S1.2: Machine Reading Comprehension (MRC) Named Entity Recognition Method Based on Hint Learning;

[0078] Considering the scarcity of annotated data in field equipment operation and maintenance, this paper proposes a prompt-based machine reading comprehension model for the task of few-shot named entity recognition. This model improves its ability to recognize and perceive entity spans by leveraging semantic or contextual information in prompt templates.

[0079] During the training phase, a specific hint template is designed, and special markers are used to mark the start and end positions of entities. These special markers serve as anchor points for entity boundaries in the hint template, helping the model learn entity location and context.

[0080] During the inference phase, the model uses a dot-product-based metric to perform label matching on the special tags in the hint template. Specifically, it calculates the similarity between the special tags in the hint template and the candidate tags to assign an appropriate label to the entity. This method fully utilizes the contextual information provided by the hint template, effectively improving the model's recognition accuracy in low-sample environments.

[0081] The present invention enhances the model's ability to perceive the locations of entities and relationships in small-sample scenarios by constructing a special prompt template; adopts a parameter-sharing relationship extraction method to reduce computational overhead, fully utilize the semantic associations between entities and relationships, and improve the accuracy and efficiency of knowledge extraction.

[0082] The specific implementation process is as follows:

[0083] S1.2.1: Template construction;

[0084] First, the present invention introduces special strings [B-ENT] and [E-ENT] to mark the start and end positions of each entity, and adds these two special strings to the vocabulary of the pre-trained language model (specifically, a PLM-based classification model, such as BERT, RoBERT, etc. can be selected). Then a label vocabulary is manually constructed to map each entity category to a semantically related word to provide clearer semantic guidance for entity labels. For example, in common named entity recognition datasets, "ORG" is usually used as the label of the person name entity, and the semantically related word "organization" is assigned to it as the mapping word. The present invention designs an adaptive prompt template for the domain equipment defect dataset. In these prompt templates, different entity categories are identified and separated by using special strings [B-ENT] and [E-ENT], thereby improving the model's ability to recognize entities under few sample conditions: P = {p1, p2,…, pm}middle, Among them, P represents the constructed prompt template, p(l i ) is represented as the i-th entity category l i Structural hint, C(l i ) represents the i-th entity category l i The semantic interpretation words in the corresponding label vocabulary, L represents the set of entity categories.

[0085] S1.2.2: Coding section;

[0086] Insert the constructed prompt template into each input sentence to generate an expanded input sequence X'={x1,x2,…,x t ,p1,…,p m+1}, where t is the length of the original input sentence, m is the number of entity classes, and the length of the prompt template depends on the number of entity classes. In addition, an additional label vocabulary is added to represent non-entity categories, such as "other". This expanded input not only covers the actual text, but also provides the model with clear entity category information and non-entity category identification through the prompt template. Subsequently, the input sequence X' is input to the encoder to generate a contextualized representation. The model uses the output of the last hidden layer as the representation of each string: H = Encoder([x1,…,x t ,p1,…,p m+1 ]), Encoder represents the encoder. Subsequently, in order to further improve the model's ability to perceive entity boundaries, the present invention introduces a multi-layer perceptron layer:

[0087] H start =w start ·H (1)

[0088] H end =w end ·H (2)

[0089] Among them, H start and H end They represent the intermediate representations of the subsequent judgment of the start and end positions of the entity; w start represents a transformation matrix used to map the features output by the encoder to a new representation space to capture the characteristics of the “entity start position”; w end Represents a transformation matrix used to map the features output by the encoder to a new representation space to capture the characteristics of the “entity end position”.

[0090] S1.2.3: decoding part;

[0091] In the decoding part, the dot product is used as a metric to calculate the distance between the special tokens in the hint template and each string to determine the start and end positions of the entity. By searching in the PLM representation space, the model is able to find the strings closest to these special tokens and predict the boundaries of the entity based on their relative positions:

[0092]

[0093] Among them, P start represents the probability distribution of each character position in the input text as the starting position of the entity, P end represents the probability distribution of each character position in the input text as the end position of the entity, S represents the probability distribution of each character position in the input text as the end position of the entity, and E represents the embedding vector of the special token ([E-ENT]) indicating the end boundary in the prompt template.

[0094] S1.2.4: Reasoning stage;

[0095] The inference phase employs a common inference method used in machine reading comprehension tasks. Specifically, given an entity's starting position, the model uses a dot-product-based metric to find the closest, rightmost ending position to that starting position. The entity span is then assigned to the corresponding entity label from a set of entity types.

[0096] This paper designs a prompt template based on entity labels, guiding the model to focus more on entity-related information during reading comprehension. Under data scarcity conditions, this refined prompt template enables accurate identification of key entities in the equipment defect field, demonstrating greater domain adaptability.

[0097] S1.3: Relation extraction method based on prompt learning;

[0098] Based on entity recognition, the present invention proposes a hint-based relationship extraction method, which uses the results of entity extraction from the named entity recognition model trained in the first stage and uses text classification to determine the relationship between pairs of entities. Unlike traditional training methods, the present invention adopts a parameter migration strategy, which directly uses the parameters of the named entity recognition model in the first stage for the relationship extraction task without the need to retrain from the initial parameters of the pre-trained language model. This method helps to reduce training time and improve the effect of relationship extraction by using previously learned entity recognition knowledge. Figure 3As shown, the model input combines entities with raw unstructured text using special tags to construct a prompt template for each entity, enhancing the model's perception of the entity. The entity spans extracted from the first stage are directly used in the relationship extraction phase. After inputting the prompt template into the relationship extraction model, an output embedding vector of the [CLS] tag is obtained. This is then input into the classifier, which calculates the probability score for each relationship type and ultimately selects the relationship type with the highest probability as the relationship between the two entities. Furthermore, a binary cross-entropy loss function is used during training to optimize the model parameters.

[0099] S1.4: Template-based triple extraction method for structured data;

[0100] Aiming at the structured data related to equipment defects, the present invention proposes a rule-based knowledge triple extraction method. By designing a series of specific rules, the original structured data is parsed into knowledge triples that are easy to understand and operate. Each triple consists of three parts: subject, predicate and object. For example, the relationship between the equipment and the components is extracted from the terminology specification of the equipment, so that a triple such as "equipment-component" can be obtained. For example, "main transformer-bushing" can represent the relationship between the equipment "main transformer" and its component "bushing". Similarly, in the maintenance record, the "component-defect description" relationship is extracted, that is, the mapping from the equipment component to the defect description. For example, "bushing-oil leakage" can indicate that the component "bushing" has the defect of "oil leakage".

[0101] To adapt to the complex structured data processing requirements of equipment operation and maintenance scenarios, this paper designs a rule-based triple extraction method based on typical data structures such as those found in the "Classification Standard for Primary Power Transmission and Transformation Equipment" table. The data in Table 2 typically includes information such as equipment, equipment type, component, component type, location, and defect description. By combining this information and setting rules, it is possible to extract the relationship between equipment and its characteristics.

[0102] Table 2 Example data of the classification standard for primary power transmission and transformation equipment

[0103]

[0104] The present invention also lists in detail the specific rules for extracting triples from structured data of primary power transmission and transformation equipment, as follows: Triples are extracted by parsing the standard table for classifying primary power transmission and transformation equipment line by line. For each record, first, a device node is generated based on the equipment type and equipment category, and at the same time, a defect node is created based on the defect description, defect classification and basis. When the component field is empty or marked as "entity", if there is location information, a location node is created, and the inclusion and defect relationship chain of "equipment→location→defect" is established in sequence; if there is no location information, the equipment and defect are directly associated. For component fields that are not empty and not "entity", a component node will be created and an inclusion relationship will be established with the equipment, and then the relationship path of "component→location→defect" or "component→defect" will be selected based on whether there is location information. The entire process realizes multi-level association modeling of equipment structure and its defects, in which the ontology label and null value cases are specially handled to ensure data integrity.

[0105] Step S2: Text encoding knowledge completion algorithm based on graph structure proximity;

[0106] To address the incompleteness of domain equipment defect knowledge graphs, this paper proposes a text encoding knowledge completion algorithm based on graph structural proximity. This algorithm leverages a pretrained language model to extract precise entity representations and effectively reduces the computational overhead of text encoding through a dual-text encoder architecture and contrastive learning. Compared to existing techniques, this paper further enhances the ability to model the global structure of the knowledge graph by introducing high-order proximity information.

[0107] S2.1: Modeling method based on graph structure proximity;

[0108] Traditional knowledge graph completion methods primarily focus on inferring knowledge by capturing direct relationships between entities in the graph, typically focusing solely on first-order proximity. However, as graph complexity increases, relying solely on first-order proximity often fails to fully capture the deep structural information implicit in the knowledge graph. Therefore, this invention aims to more comprehensively learn and infer the deep structural information in the knowledge graph by extending first-order proximity to second-order proximity. First-order proximity in a graph refers to the similarity or relationship between two directly connected nodes in a network. In other words, if two nodes share a direct edge, they exhibit first-order proximity. This concept is widely used in graph analysis, social network analysis, and network embedding techniques to capture local structural information. In contrast, second-order proximity refers to the similarity between entities that are connected through shared neighborhoods or common connections, even if they are not directly connected. In a graph, two nodes are considered to have second-order proximity if their neighbors are similar. In a knowledge graph, first-order proximity represents the direct connection between two entities under a given relationship. Traditional knowledge graph completion methods mainly focus on capturing such local relationships by optimizing the vector representations between entities to maximize the likelihood of observing triples, without considering other parts of the knowledge graph.

[0109] Specifically, assuming there are entities e3, e6 and relation r, the model will maximize The similarity between entity e6 and entity e6 is used to learn the direct relationship between entities, where represents the entity relation-aware embedding of entity e3 and relation r. The second-order proximity between two entities in the knowledge graph refers to the similarity between their neighboring entities. If two entities e1 and e3 are indirectly connected through entity e2 (i.e., their shared neighbor entity), then there is second-order proximity between entity e1 and entity e3. In order to capture the second-order proximity in the knowledge graph, we can let and close, because they share a common neighbor entity e2, where Represents the entity relation-aware embedding of entity e1 and relation r1, where r1 represents the relationship between entity e1 and its neighbor entity e2.

[0110] In order to improve the effect of knowledge graph completion, the present invention combines first-order and second-order proximity, so that the model can understand the relationship between entities more comprehensively and enhance the model's ability to learn the underlying structure of the knowledge graph.

[0111] S2.2: Text encoding knowledge graph completion algorithm based on graph structure proximity;

[0112] Aiming at the incompleteness of the initially constructed domain equipment defect knowledge graph, this paper proposes a text encoding knowledge graph completion algorithm based on graph structure proximity, such as Figure 4As shown in the figure, this algorithm leverages a pre-trained language model to extract richer and more accurate entity representations, improving the model's expressive power. Furthermore, by leveraging a dual-text encoder architecture and reusing triple embeddings as negative samples for comparative learning, it effectively alleviates the high computational overhead of existing techniques. By introducing high-order proximity information, the model further enhances its ability to model the global structure of the knowledge graph. The specific implementation process is as follows:

[0113] S2.2.1: Text encoder;

[0114] Entity description contains rich semantic and contextual information. In the embedding stage, the goal of this invention is to Figure 3 Tuples are encoded as vector representations in a latent semantic space, and subsequent triple reuse is taken into account. Translation-based graph embedding methods apply a translation function to the embedding of heads and relations, and perform structural learning by exploring the spatial relationship between the function output and the tail embedding. Similarly, the present invention divides the triple into two asymmetric parts, and uses a text encoder as the translation function to achieve text concatenation of the head entity and the relationship. On the other hand, the present invention also encodes the tail entity and its description through a text encoder. The present invention uses a dual text encoder to separate the query and the candidate, which makes it possible to pre-calculate the representation of all candidates and achieve reusable embedding.

[0115] Specifically, given a triple (h, r, t), the first text encoder is used to calculate the contextual representation of the head entity relationship. First, the text description of the head entity h and the relationship r is concatenated with the special symbol [SEP] in the middle to obtain the last hidden state of the text encoder. At the same time, mean pooling is used to obtain the relationship-aware embedding e of the head entity h and the relationship r. (hr) :

[0116] x (hr) =[x [CLS] ,x (head) ,x [SEP] ,x (relation) ,x [SEP] ] (5)

[0117] e (hr) =Pool(Encoder1(x (hr) )) (6)

[0118] Among them, x [CLS] represents the classification mark, x (head) Indicates the header entity description text, x (relation) Represents the relationship description text, x [SEP] Represents a separation token, Pool represents a pooling operation, and Encoder represents a pre-trained text encoder (BERT).

[0119] Similarly, the second text encoder is used to compute the embedding e of the tail entity t (t) , input a text description containing only the tail entity t:

[0120] x (t) =[x [CLS] ,x (tail) ,x [SEP] ] (7)

[0121] e (t) =Pool(Encoder2(x (t) )) (8)

[0122] Among them, x (tail) Represents the tail entity description text.

[0123] Traditional knowledge graph completion (KGC) methods aim to maximize the likelihood of each triple independently, essentially modeling first-order proximity, making it challenging to learn the global graph structure. Second-order proximity, on the other hand, involves the similarity between two nodes based on shared neighborhoods or connections, capturing the structural equivalence between nodes even if they are not directly connected. If (e1, r1, e2) and (e3, r2, e2) ∈ G, where (e1, r1, e2) represent two triples in the knowledge graph, (e3, r2, e2) represent two triples in the knowledge graph, and G represents the training graph. In order to capture the second-order proximity in the knowledge graph, the present invention allows near represents the entity relation-aware embedding of e1 and r1, represents the entity relation-aware embedding of e3 and r2, since they share a common neighbor entity e2. Therefore, the present invention enhances their initial embedding by the tail entity neighborhood:

[0124]

[0125] Where N represents the number of neighbors of entity v, represents the enhanced embedding of entity v, e (ur) Represent the entity relation-aware embeddings of u and r.

[0126] Finally, the score function is calculated by cosine similarity, which is defined as follows:

[0127]

[0128] Among them, e (hr) represents the relation-aware embedding of the head entity h and relation r, e (t) represents the embedding e of the tail entity t (t) , represents the enhanced embedding of the tail entity t.

[0129] S2.2.2: Negative sampling module;

[0130] In the task of knowledge graph completion, the training data only contains positive triples. Given a positive triple (h, r, t), the goal of the present invention is to generate multiple negative triples t′ through negative sampling to train the model. Many existing methods usually create negative samples by randomly modifying the head entity h or the tail entity t, thereby filtering out false negatives in the training graph G. However, simple negative sampling methods have the problems of low computational efficiency and high memory consumption. The present invention combines two types of negative samples, negative samples within the batch and negative samples from the previous batch, which effectively improves the training efficiency while reducing computational overhead and memory consumption.

[0131] In-Batch Negative Sampling (IBNS): Within each training batch, all samples except the positive counterpart of the target sample are considered negative. By fully utilizing the samples within the mini-batch, this ensures the diversity of negative samples and improves training efficiency. In-Batch Negative Sampling also avoids the need to generate additional negative samples, reduces repeated computation, and effectively reduces memory usage.

[0132] Previous Batch Negative Sampling (PBNS): Although intra-batch negative sampling can provide diverse negative samples, it has high requirements on batch size. Too large a batch size will place a heavy burden on the GPU and limit the number of negative samples of the model. To solve this problem, the present invention introduces a previous batch negative sampling strategy. By utilizing the entity embeddings cached in the previous batch, the diversity of negative samples in the current batch can be enhanced. The negative samples of the previous batch provide more negative example information for the current training, helping the model to better identify true negative samples during training and improve its discrimination ability.

[0133] Among them, the mathematical expressions of the within-batch negative sampling (IBNS) and previous batch negative sampling (PBNS) processes are as follows:

[0134]

[0135] Here, t′ represents a negative triplet.

[0136] In this paper, a negative sample generation method based on a sampling strategy can be used instead of comparative learning of intra-batch negative samples and cross-batch negative samples, such as hard negative mining. By selectively selecting negative samples similar to the current positive samples, the training efficiency and accuracy of the model can be enhanced, and the consumption of computing resources can be reduced.

[0137] S2.2.3: Training and prediction;

[0138] Use InfoNCE loss during model training:

[0139]

[0140] in, represents the score function of the candidate triples; the temperature τ is a learnable parameter used to control the relative influence of negative samples on the loss. A smaller temperature τ will make the loss function pay more attention to negative samples, but at the same time may lead to overfitting of label noise.

[0141] Since the main computational overhead of the model comes from the calculation process inside the text encoder, the present invention focuses on analyzing the computational complexity of the text encoder when generating context embeddings. In actual situations, the sequence lengths of the two asymmetric parts in a triple are usually similar. In particular, when the entity text contains detailed descriptions, the length of the entity is often significantly longer than the text of the relationship. Therefore, compared with the cross-text encoder, the model proposed in the present invention has a computational speed increased by about 2 times during the training process, showing higher training efficiency.

[0142] For the tail entity prediction (h, r, ?) (the question mark ? indicates the tail entity to be predicted), the present invention calculates the relation-aware embedding e (hr) The cosine similarity between all entities in the knowledge graph entity set ε and predict the entity with the largest score:

[0143]

[0144] Among them, t * represents the entity with the largest score, represents the initial embedding of entity ti, represents the enhanced embedding of entity ti, t i represents the i-th entity in the knowledge graph entity set, and ε represents the knowledge graph entity set.

[0145] During the prediction process, the forward pass calculation of entity relationship embedding is a key factor in measuring the computational efficiency of the model. Assume there are |E| entities and |N| test triples. The prediction task requires computing the entity relationship embedding for each triple and using the dot product to obtain the similarity score between entities. For each triple (h, r, ?) and (t, r -1 ,? ), the model requires |E|+2×|N| forward passes, while the cross-text encoder requires |E|×2×|N| forward passes. The method proposed in this invention can significantly reduce the computational overhead in the prediction process.

[0146] This paper proposes a knowledge completion algorithm that considers high-order proximity relationships between nodes. It captures the global structural features of the knowledge graph through a more comprehensive text encoding method. It also introduces an efficient contrastive learning mechanism to improve the model's feature representation capabilities, reduce computational costs, and enhance the integrity and reasoning capabilities of the knowledge graph.

[0147] Step S3: Two-stage defect classification method based on knowledge graph;

[0148] Aiming at the limitations of traditional defect analysis methods in field equipment operation and maintenance, such as diverse defect types, fuzzy descriptions, and unstructured expressions, this paper proposes a two-stage defect classification method based on knowledge graphs. Figure 5 As shown, compared with the existing technology, the present invention can effectively narrow the classification space and improve the classification accuracy when processing complex defect descriptions and diverse defect types by integrating the structured query capability of the knowledge graph with the semantic matching capability of the pre-trained language model.

[0149] S3.1: Path generation method based on dual-channel recall strategy;

[0150] S3.1.1: Candidate entity generation;

[0151] To address the diversity and ambiguity of entity expressions in equipment defect text, this paper proposes a dual-channel candidate entity generation strategy that integrates domain knowledge and semantic representation. This strategy combines exact matching based on a domain synonym dictionary with fuzzy matching based on semantic vectors, aiming to improve the accuracy and recall of candidate entity screening.

[0152] First, we use a synonym dictionary from the existing domain to perform a standardized mapping of entities within the equipment defect text. By matching entities such as equipment, components, or defect descriptions within the text with standard entities in the synonym dictionary, we generate a preliminary set of candidate entities. This approach effectively addresses the issue of varying representations of the same entity across different texts, but its coverage is limited by the completeness of the synonym dictionary.

[0153] In order to make up for the lack of semantic diversity in synonym dictionary recall, the present invention further introduces a recall method based on semantic vectors. Specifically, the entities in the equipment defect text are converted into high-dimensional semantic vectors through the pre-trained M3E model (the knowledge graph embedding model can also be used instead of the M3E vectorization model to recall candidate entities and capture the structure and semantic information in the knowledge graph). At the same time, the entity nodes in the knowledge graph are also vectorized and stored in the efficient vector retrieval database FAISS. By calculating the similarity between the text entity vector and the knowledge graph entity vector, candidate entities with higher semantic relevance are screened out. This recall mechanism based on semantic vectors can capture the deep semantic association between text and knowledge graph, and significantly improve the comprehensiveness and accuracy of candidate entity screening.

[0154] S3.1.2: Candidate path extraction;

[0155] After candidate entities are generated, the present invention further extracts semantic paths related to standard defect types from the knowledge graph. Standard defect types involve key elements such as equipment, components, locations, and defect descriptions. The goal of path extraction is to track the semantic relationships between entities in the knowledge graph through depth-first search, forming a complete defect classification chain.

[0156] The present invention uses Neo4j database to store knowledge graphs and uses its dedicated Cypher query language to extract paths. Cypher query language, with its powerful graph traversal capabilities, can efficiently extract semantic paths between entities. In specific operations, starting from the candidate device entity, the relevant nodes in the knowledge graph are traversed step by step according to predefined relationship types (such as "includes", "exists defects", etc.). For example, through a query statement such as "MATCH (device: device) - [: contains] -> (component: component {part: 'specific part'}) - [: occurs] -> (defect: defect description) RETURN *", the complete path from the device to the defect description can be accurately extracted.

[0157] S3.2: Path matching method based on single tower structure;

[0158] After extracting paths from the knowledge graph, this paper proposes a single-tower path matching method. This method aims to perform fine-grained semantic matching and ranking between the input device defect text and the candidate paths extracted in the first stage, thereby accurately locating the most similar defect types. The core goal of this method is to improve the accuracy and reliability of defect classification by combining deep semantic understanding with structured path information.

[0159] First, the entities and relationships in the candidate path are combined according to natural language rules and converted into readable text form so as to semantically match the input defect text. The present invention uses a text matching model based on a pre-trained language model to calculate the semantic similarity between the input defect text and the candidate path text, such as Figure 6 Specifically, given the input defect text T input and candidate path text T path , connected by special symbols [SEP] and input into the text encoder for encoding to obtain context-aware semantic representation:

[0160] h=Encoder(T input ,[SEP],T path ) (14)

[0161] Among them, Encoder represents the encoder, T input Indicates defect text, T path Represents candidate path text.

[0162] The vector h encoded by the text encoder is input into a feedforward neural network FFN to further calculate the matching score s = FFN(h). The matching score is converted into a probability value using the Sigmoid activation function, representing the semantic similarity p = Sigmoid(s) between the input defect text and the candidate path text. Finally, all candidate paths are sorted according to the semantic similarity, and the path with the highest score is selected as the most similar equipment defect type.

[0163] By fine-tuning the pre-trained language model on a labeled dataset in the field of device defects, it can better adapt to domain-specific semantic expressions. The binary cross-entropy loss function is used for model training. The goal is to minimize the semantic distance between the input defect text and the correct path text, while maximizing the distance between the input defect text and the incorrect path text:

[0164]

[0165] in, represents the binary cross entropy loss function, y i represents the sample label (1 for match, 0 for mismatch), p i Represents the matching probability predicted by the model. During the model training process, a contrastive learning strategy is introduced to further optimize the model's ability to discriminate semantic similarity by constructing positive and negative sample pairs.

[0166] By jointly inputting the defect text and candidate paths and sharing semantic representations, the contextual relationship and semantic association between the two can be better captured, helping operation and maintenance personnel quickly locate the type of equipment defects and reduce errors in manual judgment.

[0167] To verify the practical effectiveness of the two-stage defect classification method based on knowledge graph proposed in this invention, the following takes the typical defect text "abnormal noise in the main transformer cooler" as an example to illustrate the entire process from path screening to semantic matching, intuitively demonstrating the efficiency and accuracy of this method in defect classification.

[0168] In the first stage, multiple candidate paths related to the input defect text were extracted from the knowledge graph through the structured query capability of the knowledge graph. First, the named entity recognition model was used to extract key entities from the input defect text, including "main transformer", "cooler" and "abnormal noise". Subsequently, these entities were mapped to standardized nodes in the knowledge graph, such as "main transformer", "cooler system", "cooler", "fault", etc., in combination with the domain synonym dictionary and the semantic embedding model (pre-trained M3E model). Based on the mapped entity nodes, all paths containing equipment nodes and defect nodes were further screened out. This process makes full use of the structured characteristics of the knowledge graph, quickly narrows the scope of candidate paths, and provides a high-quality candidate set for subsequent semantic matching. The results of path screening are shown in the figure below. Figure 7 As shown in the figure, a set of candidate paths semantically related to the input defect text is successfully generated, which demonstrates the efficiency and accuracy of this method in the path screening stage.

[0169] In the second phase, a text matching technique based on a pre-trained language model is used to perform fine-grained semantic matching and sorting of the input defect text and candidate path text. Specifically, the input defect text "Abnormal noise in the main transformer cooler" is jointly encoded with the candidate path text to generate a context-aware semantic representation, and the semantic similarity between the two is calculated. Based on the similarity score, all candidate paths are sorted, and the path with the highest score is finally selected as the most matching equipment defect type. The path matching results are shown in Figure 1. Figure 8 As shown in Figure 3, the proposed method successfully identified paths that were highly consistent with the query intent. This result demonstrates that the proposed method can effectively capture the semantic association between the input defect text and the candidate paths, significantly improving the accuracy of defect classification.

[0170] This paper constructs a two-stage reasoning framework that combines structured querying of knowledge graphs with deep learning semantic matching. By using structured knowledge in the knowledge graph to narrow down the candidate defect types, and then using deep learning models for semantic matching, it achieves precise defect classification and significantly improves reasoning accuracy and efficiency.

[0171] In a second aspect, the present invention provides a knowledge graph-based equipment defect level classification system to implement a knowledge graph-based equipment defect level classification method provided in the first aspect of the present invention.

[0172] This invention builds a knowledge graph system that supports defect classification. It aims to deeply analyze the existing massive knowledge in the field of equipment defects through efficient knowledge graph organization and management, helping maintenance personnel to quickly make reasonable judgments and achieve equipment defect level classification. It adopts a high cohesion and low coupling modular architecture and realizes complex business decoupling through layered design. Figure 9 As shown in the figure, the system is divided into three logical layers: persistence layer, service layer and presentation layer.

[0173] The persistence layer is responsible for data storage and access. It stores knowledge graphs based on the Neo4j database, leveraging its native graph structure to efficiently handle complex relationships between entities. It also provides a unified data access interface, isolating differences between upper-layer business and underlying storage.

[0174] In the service layer, Flask was chosen as the backend framework for the entire system, building a lightweight RESTful API service to implement request routing and response processing. A modular design divides the service layer into five core functional service modules: named entity recognition service module, knowledge embedding service module, text matching service module, knowledge graph query service module, and defect classification service module. These modules exchange data through interfaces, ensuring that service updates do not impact each other, facilitating optimization and maintenance of the service layer. The knowledge graph query service module constructs Cypher queries based on input entities and relationships, then performs queries within the knowledge graph. The defect classification service module calls the other four functional service modules to rank and filter defect types. For example, when a user enters a defect text through the presentation layer's UI, the defect classification service module first calls the named entity recognition service module to extract entities from the defect text. It then calls the knowledge embedding service module to obtain defect text entities and knowledge graph entity embeddings. After vector search, candidate entities are obtained. The knowledge graph query service module is then called to obtain candidate paths, and the text matching service module is called to rank and filter candidate paths. Among them, the model replacement of the named entity recognition service module will not affect the normal use of the knowledge graph query service module.

[0175] The presentation layer guides users in selecting functions and visually displays the results. It utilizes the Vue framework, based on standard HTML, CSS, and JavaScript, and supports a declarative component development model, enabling developers to efficiently build user interfaces (UIs) using existing template components. Users select the desired function through the UI, and the presentation layer then calls the corresponding API to retrieve the returned data, process it, and render it, ultimately presenting the user with the defect text classification results and knowledge graph query results.

[0176] The present invention constructs a knowledge graph system that supports defect classification, which uses Docker as the core deployment technology and takes advantage of its lightweight, portable and self-sufficient containerization characteristics to solve problems such as inconsistent environments and dependency conflicts in traditional deployment methods. Docker containers have cross-platform compatibility and can run in various environments that support Docker, effectively improving the maintainability and deployment efficiency of the system. The containerization components include encapsulating the Neo4j database as an independent Docker container for storing and managing graph data; encapsulating the MySQL database as an independent Docker container for storing structured data; encapsulating the Vue front end as an independent Docker container, which is responsible for the display of the user interface and preliminary data processing; and encapsulating the Python back end as an independent Docker container to provide core business logic and data processing services. Figure 10 As shown in the figure, users enter data through the Vue frontend, which performs preliminary data processing and generates request parameters. The Vue frontend then calls the service interface of the Python backend. The backend constructs Cypher statements and SQL statements based on the request, retrieving the required data from the Neo4j and MySQL databases, respectively. The Python backend returns the processed results to the Vue frontend, which then displays the final results on the browser page.

[0177] The present invention constructs a knowledge graph system that supports defect classification, which is mainly used to realize two major functions: knowledge graph entity relationship query function and equipment defect classification function. Specifically, it can perform entity extraction, generate vector representation, and calculate text similarity through model reasoning.

[0178] Taking power grid equipment as an example, the knowledge graph node query function is shown as follows: Figure 11 As shown. User from Figure 11 The equipment to which the casing belongs, the parts it contains, and information on possible defects can be obtained.

[0179] Taking power grid equipment as an example, the knowledge graph defect query function is shown as follows: Figure 12 As shown. User from Figure 12 It can be seen from the data that under the main transformer equipment, oil leakage defects may occur in the pressure relay and pressure relief valve of non-electrical protection components, and oil leakage defects may occur in the cooler system components and their oil storage cabinets and heat sinks.

[0180] Taking power grid equipment as an example, the equipment defect classification function is shown as follows: Figure 13 As shown in the figure. Enter the defect text in the text input box and click the "Defect Classification" button. The system uses the knowledge graph path screening module and path matching module to find the defect type most relevant to the input defect text and return it to the user. Test results show that the system can complete defect classification and accurately return results within 2 seconds.

[0181] This paper builds a knowledge graph system that supports defect classification, enabling efficient storage and query of equipment defect data. The system provides functions such as defect classification and defect knowledge query, providing intelligent decision support for operation and maintenance personnel and promoting the intelligent development of equipment operation and maintenance.

[0182] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. The equipment defect level classification method based on knowledge graph is characterized by: The following steps are involved: Step S1: Information extraction method based on prompt learning; S1.1: Extract valuable structured information from unstructured text data through a two-stage pipeline extraction algorithm; S1.2: Implementing few-shot named entity recognition tasks through a hint-based learning-based named entity recognition method for machine reading comprehension; S1.3: Determine the relationship between pairs of entities using a hint-based learning-based relation extraction method using text classification and a parameter transfer strategy; S1.4: Parse the original structured data into knowledge triples through a template-based structured data triple extraction method; Step S2: Text encoding knowledge completion algorithm based on graph structure proximity; S2.1: Learn deep structural information in knowledge graphs by extending first-order proximity to second-order proximity; S2.2: Text encoding knowledge graph completion algorithm based on graph structure proximity; S2.2.1: Divide the triple into two asymmetric parts. Use the first text encoder to concatenate the head entity and relation text. Use the second text encoder to encode the tail entity and its description. S2.2.2: Combine the negative samples within the batch and the negative samples of the previous batch, and generate multiple negative triplets from the positive triplets through negative sampling within the batch and negative sampling of the previous batch; S2.2.3: Use the generated multiple negative triplets for model training and prediction; Step S3: Two-stage defect classification method based on knowledge graph; S3.1: Candidate entity generation and candidate path extraction are achieved through a path generation method based on a dual-channel recall strategy; S3.2: A single-tower-based path matching method is used to perform fine-grained semantic matching and sorting of the input device defect text and the extracted candidate paths to accurately locate the most similar defect type.

2. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: In step S1.1, the two-stage pipeline extraction algorithm includes a named entity recognition stage and a relationship extraction stage; in the named entity recognition stage, the original unstructured text is preprocessed, and then the various entities therein are identified by the named entity recognition model and the entity set is output; in the relationship extraction stage, the identified entities are arranged in pairs to generate a set of all possible entity pairs, and then the relationship between each entity pair is analyzed by the relationship extraction model. If a relationship exists, the corresponding relationship type is returned, otherwise it is classified into other categories.

3. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: The specific implementation process of step S1.2 is as follows: By marking the start and end positions of each entity with special strings [B-ENT] and [E-ENT], and adding these two special strings to the vocabulary of the pre-trained language model, and by building a manual label vocabulary, each entity category is mapped to a semantically related label vocabulary, thus constructing a prompt template adapted to the equipment defect dataset; This hint template is inserted into each input sentence to generate an expanded input sequence, which is fed into the encoder to generate contextualized representations, and the output of the last hidden layer is used as the representation of each string; The dot product is used as a metric to calculate the distance between the special token in the hint template and each string to determine the start and end positions of the entity; the dot product-based metric is used to find the rightmost end position closest to the start position, and finally the entity span is assigned to the corresponding entity label in the entity type set.

4. The equipment defect level classification method based on knowledge graph according to claim 3 is characterized in that: In step S1.3, the entity is concatenated with the original unstructured text by combining special tags to construct a prompt template for the entity. The prompt template is input into the relationship extraction model to obtain the output embedding vector of the [CLS] tag, which is input into the classifier. By calculating the probability score of each relationship type, the relationship type with the highest probability is finally selected as the relationship between the two entities.

5. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: In step S2.2.2, the mathematical expressions of the negative sampling process within the batch and the negative sampling process of the previous batch are as follows: Among them, h represents the head entity, r represents the relationship, t′ represents the negative triplet, G represents the training graph, IBNS represents the within-batch negative sampling operation, and PBNS represents the previous batch negative sampling operation.

6. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: In step S2.2.3, InfoNCE loss is used in the model training phase: in, represents the score function of the candidate triple, h represents the head entity, r represents the relationship, and t represents the tail entity; the temperature τ is a learnable parameter used to control the relative impact of negative samples on the loss; In the model prediction stage, the entity relationship embedding is calculated for each triple and the dot product is used to obtain the similarity score between entities, and the entity with the largest score is predicted.

7. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: In step S3.1, the candidate entity generation process is as follows: Using the existing synonym dictionary in the field, the entities in the equipment defect text are standardized and mapped to generate a preliminary set of candidate entities. The entities in the equipment defect text are converted into high-dimensional semantic vectors using the pre-trained M3E model through a semantic vector-based recall method. At the same time, the entity nodes in the knowledge graph are vectorized and stored in the vector retrieval database FAISS. By calculating the similarity between the text entity vector and the knowledge graph entity vector, candidate entities with high semantic relevance are screened out.

8. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: In step S3.1, the candidate path extraction process is as follows: The Neo4j database is used to store the knowledge graph, and its dedicated Cypher query language is used for path extraction. That is, starting from the candidate device entity, according to the predefined relationship type, the relevant nodes in the knowledge graph are gradually traversed to extract the complete path from the device to the defect description.

9. The equipment defect level classification method based on knowledge graph according to claim 1 is characterized in that: The specific implementation process of step S3.2 is as follows: The entities and relationships in the candidate paths are combined according to natural language rules and converted into readable text form. A text matching model based on a pre-trained language model is used to calculate the semantic similarity between the input defect text and the candidate path text. All candidate paths are sorted according to semantic similarity, and the path with the highest score is selected as the most similar equipment defect type.

10. The equipment defect level classification system based on knowledge graph is characterized by: include: Persistence layer, used to implement data storage and access; The service layer includes a named entity recognition service module, a knowledge embedding service module, a text matching service module, a knowledge graph query service module, and a defect classification service module. The knowledge graph query service module constructs a Cypher query statement based on the input entities and relationships, and then performs a query in the knowledge graph. The defect classification service module calls the other four functional service modules to obtain the defect type sorting and screening results; the display layer is used to guide users to select functions and visualize the classification results of the defect text and the query results of the knowledge graph.

Citation Information

Cited By

  • Hydroelectric generating set maintenance resource optimal configuration method based on mapping knowledge domain

    CN121093909A

  • Product defect tracing method based on knowledge graph reasoning

    CN121212916A