CN116150337A - Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool - Google Patents

Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool Download PDF

Info

Publication number
CN116150337A
CN116150337A CN202310077227.5A CN202310077227A CN116150337A CN 116150337 A CN116150337 A CN 116150337A CN 202310077227 A CN202310077227 A CN 202310077227A CN 116150337 A CN116150337 A CN 116150337A
Authority
CN
China
Prior art keywords
fault
triplet
numerical control
control machine
entity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310077227.5A
Other languages
Chinese (zh)
Inventor
马亚杰
张昊阳
姜斌
冒泽慧
陆宁云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Aeronautics and Astronautics
Original Assignee
Nanjing University of Aeronautics and Astronautics
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Aeronautics and Astronautics filed Critical Nanjing University of Aeronautics and Astronautics
Priority to CN202310077227.5A priority Critical patent/CN116150337A/en
Publication of CN116150337A publication Critical patent/CN116150337A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/3332Query translation
    • G06F16/3334Selection or weighting of terms from queries, including natural language queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an intelligent question-answering method and system based on a fault knowledge graph of a numerical control machine tool, wherein the method comprises the following steps: processing fault maintenance records of the numerical control machine tool and constructing a fault field knowledge graph; constructing a knowledge reasoning model fusing GAT and RotatE, training, inputting a fault triplet in a fault knowledge base of the numerical control machine tool into a graph attention layer, and inputting an embedded representation vector of an entity and a relation obtained after training into a link prediction layer; constructing an intelligent question-answering system webpage, acquiring a question text of a user, and replacing a tail entity of a question triplet by an entity; and calculating the scores of the replaced triples, sorting the triples according to the scores, filtering the result knowledge, and feeding back to the user in a table form. According to the invention, the knowledge graph and the intelligent question-answering are introduced into the field of fault diagnosis, and knowledge reasoning is carried out on the fault knowledge graph of the numerical control machine tool by fusing the knowledge reasoning model of GAT and RotatE, and an intelligent question-answering system is constructed, so that the accuracy of fault diagnosis and maintenance of the numerical control machine tool is effectively improved.

Description

Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool
Technical Field
The invention belongs to the technical field of knowledge graph questions and answers, and particularly relates to an intelligent question and answer method and system based on a numerical control machine tool fault knowledge graph.
Background
With the rapid development of global manufacturing industry, the more widely the application of numerical control machine tools, the more indispensable in enterprise production and manufacturing. If some equipment of the numerical control machine tool fails, the equipment cannot be found and processed in time, the normal operation of the whole system is affected, and even the system stops operating, so that serious economic loss and casualties are brought to enterprises. However, in the process of using the numerical control machine tool, factors such as an operation environment, irregular operation of a worker and the like inevitably cause the numerical control machine tool to fail, and once the numerical control machine tool fails, massive state data and monitoring variables generated in the operation of equipment of the numerical control machine tool can cause the maintenance difficulty to be far higher than that of a common machine tool.
After the twenty-first century, the internet information, whether of the type or quantity, has been growing in bursts due to the rapid growth of the internet. In order to effectively manage and utilize massive information on the internet, companies such as google, microsoft and the like adopt a keyword search method to optimize a search tool: the user only needs to input some keywords, and the search tool can search out the web pages related to the keywords for the user to select. However, the keyword-based search method does not consider deep semantic relationships between characters, and the search efficiency is relatively low. Based on the background, google corporation proposed the concept of Knowledge Graph (KG) in 2012 at 11 months, and applies the concept to search engines to improve the capability of search tools and enhance the search quality of users.
The intelligent question-answering system based on the knowledge graph has the main ideas that: by analyzing the questions, the questions are converted into a query statement containing entities and relations, the query is carried out in the knowledge graph, and the returned triples are answers to the questions. The intelligent question-answering system based on the knowledge graph is applied to various fields such as movie recommendation and numerical control machine fault, however, the existing intelligent question-answering system based on the numerical control machine fault knowledge graph has some defects: firstly, the existing fault knowledge graph of the numerical control machine tool has the situation that the relation among entities is greatly lacking; secondly, the accuracy of the existing knowledge reasoning model is higher when the knowledge patterns in the general fields such as books, movies and the like are processed, but the speed and the accuracy of the knowledge reasoning model are lower when the knowledge patterns in the special fields are processed because a large number of deep causal relations among entities in the knowledge patterns in the special fields are difficult to mine; thirdly, the existing intelligent question answering system based on the fault knowledge graph of the numerical control machine directly inquires the problems raised by the user in the fault knowledge graph of the numerical control machine, reasoning prediction cannot be carried out, the adaptation degree with the personalized problems of the user is low, and the inquiry result is one-sided.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, provides an intelligent question-answering method and system based on a numerical control machine tool fault knowledge graph, introduces the knowledge graph and the intelligent question-answering into the fault diagnosis field, carries out knowledge reasoning on the numerical control machine tool fault knowledge graph by fusing a GAT and RotatE knowledge reasoning model, constructs an intelligent question-answering system, and provides an effective and quick way for maintenance personnel to find a maintenance method of the numerical control machine tool fault.
In order to solve the technical problems, the invention adopts the following technical scheme.
The invention discloses an intelligent question-answering method based on a fault knowledge graph of a numerical control machine tool, which comprises the following steps:
s1, constructing a fault knowledge graph of the numerical control machine tool: processing the collected maintenance records of the numerical control machine tool equipment, reserving semantic relations between the entities, and generating a fault triplet, wherein the fault triplet comprises a head entity, a relation and a tail entity, storing the fault triplet in a numerical control machine tool fault knowledge base, dividing the fault triplet into a training set, a verification set and a test set according to a proportion, and importing the fault triplet into a Neo4j graph database to form a brand new numerical control machine tool fault knowledge graph;
S2, constructing a knowledge reasoning model fusing GAT and RotatE and training: the knowledge reasoning model fusing GAT and RotatE comprises a diagram attention layer part and a link prediction layer part; inputting the fault triplets in the fault knowledge base of the numerical control machine tool into a graph attention layer, and inputting the embedded representation vectors of the entities and the relations obtained after training into a link prediction layer; obtaining a negative example fault triplet from the positive example fault triplet by adopting a random sampling mode in the link prediction layer, calculating the scores of the positive example fault triplet and the negative example fault triplet through a scoring function, and storing an embedded representation vector of an entity and a relation output by the link prediction layer after the loop iteration optimization is finished;
s3, identifying problems: constructing an intelligent question-answering system webpage, acquiring a question text proposed by a user, extracting keywords of the question text by using a Python library and a custom dictionary, performing semantic similarity calculation on the keywords of the question text and the entities of a numerical control machine tool fault triplet, determining the head entity of the question triplet, determining the relation of the question triplet in a mode of combining characteristic word matching and intention recognition, and taking one entity randomly in the numerical control machine tool fault knowledge base as the tail entity of the question triplet;
S4, answer output: and (3) obtaining a replaced problem triplet by using an entity in a fault knowledge base of the numerical control machine tool to replace a tail entity of the problem triplet, calling an embedded representation vector of the entity and the relation obtained by training a knowledge reasoning model fused with GAT and RotatE, converting the replaced problem triplet into a vector form, calculating the score of the replaced problem triplet by using a scoring function, sorting and knowledge filtering the replaced problem triplet according to the score, and finally outputting ten replaced problem triples with the lowest score to a user in a form of a table.
Further, the constructing a fault knowledge graph of the numerically-controlled machine tool in step S1 includes:
s1.1, performing maintenance record processing on numerical control machine tool equipment: processing the collected maintenance records of the numerical control machine tool equipment, deleting missing lines and nonsensical lines, reserving the semantic relations among three entity categories of equipment names, fault conditions and maintenance results and different entity categories, constructing a fault triplet composed of a head entity, a relation and a tail entity according to the reserved entity categories and the semantic relations, and storing the fault triplet in a numerical control machine tool fault knowledge base;
s1.2, dividing a training set, a verification set and a test set: randomly dividing the fault triples into three parts of a training set, a verification set and a test set according to the ratio of 7:2:1, wherein the training set is used for updating parameters of knowledge reasoning models fusing GAT and RotatE, the verification set is used for adjusting the parameters of the knowledge reasoning models fusing GAT and RotatE, and the test set is used for evaluating generalization capability of the knowledge reasoning models fusing GAT and RotatE;
S1.3, constructing a fault knowledge graph of the numerical control machine tool: creating a fault knowledge graph of the numerical control machine by using Python, inserting a fault triplet in a fault knowledge base of the numerical control machine into the fault knowledge graph of the numerical control machine, respectively representing the entity and the relation of the fault triplet by using nodes and edges of the fault knowledge graph of the numerical control machine, generating a brand-new fault knowledge graph of the numerical control machine by using a Neo4j graph database, and visually displaying the brand-new fault knowledge graph of the numerical control machine.
Further, the construction and training of the knowledge reasoning model fusing GAT and RotatE in step S2 includes:
s2.1, constructing a diagram attention layer: the attention layer of the graph adopts an attention mechanism, modeling is carried out through an aggregation function, the weight relation between the nodes in the fault knowledge graph of the numerical control machine tool and the neighbor nodes is calculated, then nonlinear activation is carried out on the weight relation, the attention coefficient is obtained through a logistic regression function, finally the attention coefficient is weighted and aggregated to obtain an embedded representation vector of the nodes during output, and the node number, the learning rate and the iteration number of each layer of the attention layer of the graph are designated during code implementation;
in order to transform entities and relationships entered by the knowledge-inference model fusing GAT and RotatE into vector space, the data is transformed by an initialized matrix W (we R F′×F ) Define a mapping b R F′ ×R F And R, wherein F and F' respectively represent the dimension of the embedded representation vector of the entity and the relation at the input time and the dimension of the embedded representation vector of the entity and the relation at the output time, and the weight relation of the node i and the node j is obtained by calculation of an attention mechanism:
e ij =b(Wx i ,Wx j ) (1)
wherein e ij Is the weight relation between node i and node j, b is the mapping vector, W is the linear transformation matrix of node i and node j, and x i Is node i, x j Is the neighbor node j of node i;
adding a LeakyReLU nonlinear activation function, and performing regularization processing by using a softmax function to obtain the attention coefficient of the node i:
Figure BDA0004066482330000031
wherein alpha is ij Is the attention coefficient of node i, N i Is the neighbor node of the ith node, exp (x) is the mathematical operation e x And (b) vector concatenation operation T Is the transpose of the mapping vector b, x k Is a neighbor node of the kth node;
the attention coefficients of the nodes i are weighted and summed to obtain the embedded representation vector of the trained node i:
Figure BDA0004066482330000032
wherein σ is a nonlinear conversion operation, x i ' is the embedded representation vector of the trained node i;
s2.2, constructing a link prediction layer: constructing a link prediction layer of a knowledge reasoning model fused with the GAT and the RotatE by utilizing the RotatE model, obtaining a negative case fault triplet from the positive case fault triplet in a random sampling mode, calculating the scores of the positive case fault triplet and the negative case fault triplet through a score function, and designating the dimension, the loss function and the score function of an embedded representation vector of a RotatE model entity and a relation when the code is realized;
The basic idea of the RotatE model derives from the euler formula:
e =cosθ+isinθ (4)
wherein the index iθ is expressed as a rotation angle θ in the complex vector space; thus, the RotatE model maps entities and relationships into complex vector space and defines relationships as the rotation angle from the head entity embedded representation vector to the tail entity embedded representation vector; giving a fault triplet, wherein a rotation vector obtained by rotating a head entity embedded representation vector of the fault triplet through a relation embedded vector of the fault triplet is supposed to be as close as possible to a tail entity embedded representation vector of the fault triplet; the closer the rotation vector of the fault triplet and the tail entity embedding vector of the fault triplet are, the more accurate the embedding representing vector of the entity and the relation of the fault triplet are; the approach degree of the rotation vector of the fault triplet and the tail entity embedded vector of the fault triplet is calculated by using a distance function, and the calculation formula is as follows:
Figure BDA0004066482330000043
wherein d r (h, r, t) represents the scoring result of the failed triplet, h represents the head entity embedding vector of the failed triplet, r represents the relation embedding vector of the failed triplet, t represents the tail entity embedding vector of the failed triplet,
Figure BDA0004066482330000044
the operation of the loop-up is indicated, I.I L1/L2 The specific calculation formula of the L1 norm or the L2 norm is as follows:
Figure BDA0004066482330000041
Figure BDA0004066482330000042
wherein X is a matrix, X i Is the i-th element in the matrix;
s2.3, training a knowledge reasoning model fusing GAT and RotatE: inputting a training set of fault triples in a fault knowledge base of the numerical control machine tool into a graph meaning layer fusing knowledge reasoning models of GAT and RotatE for training to obtain embedded expression vectors of each node in a fault knowledge graph of the numerical control machine tool after training, calculating scores of positive fault triples and negative fault triples, designing a MarginLoss function as a loss function, and calculating a formula of the loss function as follows:
Loss=max[0,γ+d r (h,t)-d r' (h',t')] (8)
wherein Loss represents the Loss function value of the fault triplet, gamma represents the distance between the positive fault triplet and the negative fault triplet, and generally takes 1, d r (h, t) represents the scoring result of the positive case failure triplet, d r' (h ', t') represents the scoring result of the negative case failure triplet;
optimizing and learning by using an Adam optimizer, continuously updating and fusing weight parameters of a knowledge reasoning model of GAT and RotatE, continuously reducing the loss function value of the fault triplet, and storing the entity and the embedded expression vector of the relation of the fault triplet after the circulation is finished;
s2.4, testing the performance of a knowledge reasoning model fusing GAT and RotatE: and (3) converting a test set of the fault triplet in a fault knowledge base of the numerical control machine tool into an embedded representation vector by utilizing an embedded representation vector of the entity and the relation of the fault triplet obtained after training by fusing the knowledge reasoning model of GAT and RotatE, then respectively replacing a head entity and a tail entity of the test set of the fault triplet to obtain replaced fault triples, sorting all the replaced fault triples from low to high according to a scoring result by a scoring function, searching the position of the head entity or the tail entity of the fault triplet before replacement, and evaluating the generalization capability of the knowledge reasoning model fusing GAT and RotatE by utilizing Hit@3, hit@10, MR and MRR evaluation indexes.
Further, the problem identification in step S3 includes:
s3.1, constructing an intelligent question-answering system webpage: through the Django library creation items of Python, the routing address is modified, CSS and JS plugins are selected to write HTML webpage files, so that a background can receive questions raised by a user on a webpage of an intelligent question-answering system, and the results processed by the background are displayed on the webpage of the intelligent question-answering system;
s3.2, entity identification: extracting keywords of a problem proposed by a user by utilizing a jieba library of Python and a custom dictionary, and carrying out semantic similarity calculation on the keywords of the problem and entities in a numerical control machine tool fault knowledge base, wherein the entity of the numerical control machine tool fault knowledge base with the highest semantic similarity calculation result is the head entity of a problem triplet;
s3.3, constructing a problem triplet: and confirming the relation of the problem triplet by adopting a mode of combining characteristic word matching and intention recognition, and then forming the problem triplet by taking the head entity of the problem triplet, the relation of the problem triplet and one entity randomly selected from a numerical control machine tool fault knowledge base as the tail entity of the problem triplet.
Further, the answer output described in step S4 includes:
S4.1, calculating the scores of the negative problem triples and sequencing: the method comprises the steps of replacing tail entities of problem triples by entities in a numerical control machine tool fault knowledge base to obtain negative problem triples, converting the entities and the relations of the negative problem triples into embedded expression vectors by using embedded expression vectors of the entities and the relations obtained after training by a knowledge reasoning model fused with GAT and RotatE, calculating scores of all the negative problem triples through a scoring function, and arranging from low to high according to score results;
s4.2, knowledge screening: carrying out knowledge screening on the sequenced negative case problem triples, and removing non-conforming negative case problem triples according to tail entity tag requirements;
s4.3, returning an answer: and displaying the ten negative case question triples with the lowest scores after knowledge screening as answers to the user in a form of a table on the webpage of the intelligent question-answering system.
Specifically, the semantic similarity calculation includes an edit distance similarity part, a character overlap coefficient similarity part and a cosine similarity part:
the edit distance similarity is based on the character string C i To character string C j The minimum operation times required to be executed are converted, the operations comprise insertion, deletion and replacement, and a calculation formula is as follows:
Figure BDA0004066482330000061
Wherein LD is a character string C i To character string C j Conversion requires the least number of operations to be performed, length (C i ) And length (C) j ) Respectively represent character string C i And character string C j Is of the character length S LD (C i ,C j ) Representing character string C i And character string C j Edit distance similarity of (2);
the similarity of the character overlapping coefficients is based on the character string C i And character string C j Calculating the number of the same characters;
Figure BDA0004066482330000062
wherein N is a character string C i And character string C j The number of the same characters, length (set (C i ,C j ) A) represents character string C i And character string C j Length of non-repeated character set S OC (C i ,C j ) Representing character string C i And character string C j Is a character overlap coefficient similarity of (1);
cosine similarity is obtained by measuring the difference between two characters by cosine values of the included angles of the two vectors in the vector space, and calculating the character string C i And character string C j When cosine similarity of the entity is obtained, an embedded representation vector of the entity is trained by utilizing a knowledge reasoning model fused with GAT and RotatE, a character string is converted into the embedded representation vector, and then the cosine similarity formula is utilized for calculation:
Figure BDA0004066482330000063
wherein V is Ci And V Cj Respectively character string C i And character string C j Is embedded in the representation vector, ||v Ci I and I V Cj The I are character strings C respectively i And character string C j Is embedded to represent the features of the vector S COS (C i ,C j ) Representing character string C i And character string C j Cosine similarity of (c);
string C i And character string C j Semantic similarity S (C) i ,C j ) Defined as edit distance similarity S LD (C i ,C j ) Similarity of character overlapping coefficients S OC (C i ,C j ) And cosine similarity S COS (C i ,C j ) The arithmetic average of the three is calculated as follows:
Figure BDA0004066482330000064
wherein S (C) i ,C j ) Representing character string C i And character string C j Semantic similarity of (c) to each other.
The invention relates to an intelligent question-answering system based on a fault knowledge graph of a numerical control machine, which is used for executing the intelligent question-answering method based on the fault knowledge graph of the numerical control machine when in implementation, and comprises the following steps: the system comprises a numerical control machine fault knowledge graph construction module, a knowledge reasoning model construction and training module integrating GAT and RotatE, a question identification module and an answer output module.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. according to the invention, the fault maintenance record of the numerical control machine tool is processed, a fault triplet is constructed, and the fault triplet is imported into a Neo4j graph database to generate a brand new fault knowledge graph of the numerical control machine tool; the fault knowledge graph of the numerical control machine tool, which is generated by the method, is different from the existing fault knowledge graph of the numerical control machine tool, is a supplement to the existing fault knowledge graph of the numerical control machine tool, and realizes further integration and analysis of the fault field of the numerical control machine tool;
2. The invention provides a new semantic similarity calculation method for different character strings, which comprises the following steps: firstly, respectively calculating edit distance similarity, character overlapping similarity and cosine similarity of different character strings, and then taking an arithmetic average value of three semantic similarity calculation results of the edit distance similarity, the character overlapping similarity and the cosine similarity as a final semantic similarity calculation result of the different character strings; when the new semantic similarity calculation method calculates the semantic similarity of different character strings, three conditions of editing distance, character overlapping and cosine similarity can be considered simultaneously, so that the accuracy of matching of the different character strings through semantic similarity calculation results is improved;
3. the invention provides a knowledge reasoning model fusing GAT and RotatE, which comprises a diagram attention layer part and a link prediction layer part; when the fault knowledge graph of the numerical control machine tool is processed, the knowledge reasoning model fused with GAT and RotatE can deeply mine the abundant semantic information of the entity and the potential causal relationship between the entities, and the accuracy of the link prediction is far higher than that of the existing knowledge reasoning model.
Drawings
Fig. 1 is a flowchart of an intelligent question-answering method based on a fault knowledge graph of a numerical control machine according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a part of a triplet of fault knowledge graph of a numerically-controlled machine tool according to an embodiment of the present invention.
FIG. 3 is a block diagram of a knowledge reasoning model fusing GAT and RotatE to calculate attention coefficients, in accordance with an embodiment of the invention.
Fig. 4 is a schematic illustration of a RotatE model of an embodiment of the present invention.
Fig. 5 is a block diagram of a knowledge reasoning model fusing GAT and RotatE in accordance with an embodiment of the invention.
Fig. 6 is a web page diagram of an intelligent question-answering system based on a fault knowledge graph of a numerical control machine according to an embodiment of the invention.
Detailed Description
The invention discloses an intelligent question-answering method based on a fault knowledge graph of a numerical control machine tool, which comprises the following steps: processing the maintenance record of the numerical control machine tool equipment to generate a fault triplet and a numerical control machine tool fault knowledge graph; constructing a knowledge reasoning model fusing GAT and RotatE, and storing the trained entity and the embedded expression vector of the relation; identifying a head entity and a relation from a problem presented by a user, randomly selecting a tail entity from a fault knowledge base of the numerical control machine tool, and constructing a problem triplet; and replacing the tail entity of the problem triplet by using the entity in the fault knowledge base of the numerical control machine tool to obtain a replaced problem triplet, calculating the score of the replaced problem triplet, sequencing, filtering the sequencing result and outputting the filtered sequencing result in a form of a table. According to the invention, aiming at the problem that the efficiency of inquiring fault maintenance records and turning over a maintenance manual is low by maintenance personnel after the numerical control machine is in fault, the past numerical control machine equipment maintenance records are integrated, and the speed and accuracy of fault diagnosis and maintenance of the numerical control machine can be effectively improved.
The invention is described in further detail below with reference to the accompanying drawings.
The invention discloses an intelligent question-answering method based on a fault knowledge graph of a numerical control machine, which is shown in a flow chart in figure 1 and comprises the following steps:
s1, constructing a fault knowledge graph of the numerical control machine tool: processing the collected maintenance records of the numerical control machine tool equipment, reserving semantic relations between the entities, and generating a fault triplet, wherein the fault triplet comprises a head entity, a relation and a tail entity, storing the fault triplet in a numerical control machine tool fault knowledge base, dividing the fault triplet into a training set, a verification set and a test set according to a proportion, and importing the fault triplet into a Neo4j graph database to form a brand new numerical control machine tool fault knowledge graph;
s2, constructing a knowledge reasoning model fusing GAT and RotatE and training: the knowledge reasoning model fusing GAT and RotatE comprises a diagram attention layer part and a link prediction layer part; inputting the fault triplets in the fault knowledge base of the numerical control machine tool into a graph attention layer, and inputting the embedded representation vectors of the entities and the relations obtained after training into a link prediction layer; obtaining a negative example fault triplet from the positive example fault triplet by adopting a random sampling mode in the link prediction layer, calculating the scores of the positive example fault triplet and the negative example fault triplet through a scoring function, and storing an embedded representation vector of an entity and a relation output by the link prediction layer after the loop iteration optimization is finished;
S3, identifying problems: constructing an intelligent question-answering system webpage, acquiring a question text proposed by a user, extracting keywords of the question text by using a Python library and a custom dictionary, performing semantic similarity calculation on the keywords of the question text and the entities of a numerical control machine tool fault triplet, determining the head entity of the question triplet, determining the relation of the question triplet in a mode of combining characteristic word matching and intention recognition, and taking one entity randomly in the numerical control machine tool fault knowledge base as the tail entity of the question triplet;
s4, answer output: and (3) obtaining a replaced problem triplet by using an entity in a fault knowledge base of the numerical control machine tool to replace a tail entity of the problem triplet, calling an embedded representation vector of the entity and the relation obtained by training a knowledge reasoning model fused with GAT and RotatE, converting the replaced problem triplet into a vector form, calculating the score of the replaced problem triplet by using a scoring function, sorting and knowledge filtering the replaced problem triplet according to the score, and finally outputting ten replaced problem triples with the lowest score to a user in a form of a table.
Specifically, the step S1 of constructing a fault knowledge graph of the numerically-controlled machine tool includes:
S1.1, performing maintenance record processing on numerical control machine tool equipment: processing the collected maintenance records of the numerical control machine tool equipment, deleting missing lines and nonsensical lines, reserving the semantic relations among three entity categories of equipment names, fault conditions and maintenance results and different entity categories, constructing a fault triplet composed of a head entity, a relation and a tail entity according to the reserved entity categories and the semantic relations, and storing the fault triplet in a numerical control machine tool fault knowledge base;
s1.2, dividing a training set, a verification set and a test set: randomly dividing the fault triples into three parts of a training set, a verification set and a test set according to the ratio of 7:2:1, wherein the training set is used for updating parameters of knowledge reasoning models fusing GAT and RotatE, the verification set is used for adjusting the parameters of the knowledge reasoning models fusing GAT and RotatE, and the test set is used for evaluating generalization capability of the knowledge reasoning models fusing GAT and RotatE;
s1.3, constructing a fault knowledge graph of the numerical control machine tool: creating a fault knowledge graph of the numerical control machine by using Python, inserting a fault triplet in a fault knowledge base of the numerical control machine into the fault knowledge graph of the numerical control machine, respectively representing the entity and the relation of the fault triplet by using nodes and edges of the fault knowledge graph of the numerical control machine, generating a brand-new fault knowledge graph of the numerical control machine by using a Neo4j graph database, and visually displaying the brand-new fault knowledge graph of the numerical control machine. The part of triples of the fault knowledge graph of the numerical control machine tool is shown in figure 2, and the triples have three entity categories of equipment name, fault condition and current state and two relation categories of equipment fault and maintenance result; the device name comprises an id, a model specification and a manufacturer, the fault condition comprises an id, an occurrence date and a repair date, and the current state comprises an id and a repair classification.
Specifically, the step S2 of constructing and training a knowledge reasoning model fusing GAT and RotatE includes:
s2.1, constructing a diagram attention layer: the attention layer of the graph adopts an attention mechanism, modeling is carried out through an aggregation function, the weight relation between the nodes in the fault knowledge graph of the numerical control machine tool and the neighbor nodes is calculated, then nonlinear activation is carried out on the weight relation, the attention coefficient is obtained through a logistic regression function, finally the attention coefficient is weighted and aggregated to obtain an embedded representation vector of the nodes during output, and the node number, the learning rate and the iteration number of each layer of the attention layer of the graph are designated during code implementation;
attention coefficient structure of the attention model of the figure as shown in figure 3, in order to transform entities and relations entered by the knowledge inference model fusing GAT and RotatE into vector space, the data is transformed by an initialized matrix W (we R F′×F ) Define a mapping b R F′ ×R F R, wherein F and F' respectively representThe embedding of the entity and the relation at the input represents the dimension of the vector and the embedding of the entity and the relation at the output represents the dimension of the vector, and then the weight relation of the node i and the node j is calculated by an attention mechanism:
e ij =b(Wx i ,Wx j ) (1)
wherein e ij Is the weight relation between node i and node j, b is the mapping vector, W is the linear transformation matrix of node i and node j, and x i Is node i, x j Is the neighbor node j of node i;
adding a LeakyReLU nonlinear activation function, and performing regularization processing by using a softmax function to obtain the attention coefficient of the node i:
Figure BDA0004066482330000091
wherein alpha is ij Is the attention coefficient of node i, N i Is the neighbor node of the ith node, exp (x) is the mathematical operation e x And (b) vector concatenation operation T Is the transpose of the mapping vector b, x k Is a neighbor node of the kth node;
the attention coefficients of the nodes i are weighted and summed to obtain the embedded representation vector of the trained node i:
Figure BDA0004066482330000092
wherein σ is a nonlinear conversion operation, x i ' is the embedded representation vector of the trained node i;
s2.2, constructing a link prediction layer: constructing a link prediction layer of a knowledge reasoning model fused with the GAT and the RotatE by utilizing the RotatE model, obtaining a negative case fault triplet from the positive case fault triplet in a random sampling mode, calculating the scores of the positive case fault triplet and the negative case fault triplet through a score function, and designating the dimension, the loss function and the score function of an embedded representation vector of a RotatE model entity and a relation when the code is realized;
fig. 4 is a schematic illustration of the RotatE model, the basic idea of which derives from the euler formula:
e =cosθ+isinθ (4)
Wherein the index iθ is expressed as a rotation angle θ in the complex vector space; thus, the RotatE model maps entities and relationships into complex vector space and defines relationships as the rotation angle from the head entity embedded representation vector to the tail entity embedded representation vector; giving a fault triplet, wherein a rotation vector obtained by rotating a head entity embedded representation vector of the fault triplet through a relation embedded vector of the fault triplet is supposed to be as close as possible to a tail entity embedded representation vector of the fault triplet; the closer the rotation vector of the fault triplet and the tail entity embedding vector of the fault triplet are, the more accurate the embedding representing vector of the entity and the relation of the fault triplet are; the approach degree of the rotation vector of the fault triplet and the tail entity embedded vector of the fault triplet is calculated by using a distance function, and the calculation formula is as follows:
Figure BDA0004066482330000101
wherein d r (h, r, t) represents the scoring result of the failed triplet, h represents the head entity embedding vector of the failed triplet, r represents the relation embedding vector of the failed triplet, t represents the tail entity embedding vector of the failed triplet,
Figure BDA0004066482330000104
the operation of the loop-up is indicated, I.I L1/L2 The specific calculation formula of the L1 norm or the L2 norm is as follows:
Figure BDA0004066482330000102
Figure BDA0004066482330000103
Wherein X is a matrix, X i Is the i-th element in the matrix.
In the knowledge graph, three relationship modes are included: symmetry/antisymmetry, inversion and combination. For example: the classmate relationship belongs to a symmetrical/antisymmetric relationship mode; the two relations of the teacher and the student belong to a reverse relation mode; the primary is composed of two relations of father and brothers, and then the three relations of primary and father and brothers belong to a combined relation mode. Table 1 lists the capabilities of the existing partial knowledge reasoning model to handle three relationship patterns when the RotatE model is presented.
Table 1 partial knowledge reasoning model processing three relationship model capability summary tables
Symmetry/antisymmetry Reversing Combination of two or more kinds of materials
SE × × ×
TransE ×
DistMult × ×
ComplEx ×
RotatE
It can be seen from table 1 that other knowledge reasoning models cannot handle three relationship patterns simultaneously before the RotatE model is proposed. For example: the transition model cannot handle symmetric relation patterns because the embedded representation vector of the relationship of the transition model in the symmetric relation pattern is identical to zero; the ComplEx model extends the interference by introducing ComplEx embedding to better model symmetric and inverse relationship patterns, but it cannot handle combined relationship patterns.
S2.3, training a knowledge reasoning model fusing GAT and RotatE: the structure diagram of the knowledge reasoning model fused with GAT and RotatE is shown in figure 5, a training set of fault triples in a fault knowledge base of the numerical control machine tool is input into a graph meaning layer fused with the knowledge reasoning model fused with GAT and RotatE for training, embedded expression vectors of each node in the fault knowledge map of the numerical control machine tool after training are obtained, the scores of positive fault triples and negative fault triples are calculated, a MarginLoss function is designed as a loss function, and the calculation formula of the loss function is as follows:
Loss=max[0,γ+d r (h,t)-d r' (h',t')] (8)
Wherein Loss represents the Loss function value of the fault triplet, gamma represents the distance between the positive fault triplet and the negative fault triplet, and generally takes 1, d r (h, t) represents the scoring result of the positive case failure triplet, d r' (h',t')A scoring result representing a negative case failure triplet;
optimizing and learning by using an Adam optimizer, continuously updating and fusing weight parameters of a knowledge reasoning model of GAT and RotatE, continuously reducing the loss function value of the fault triplet, and storing the entity and the embedded expression vector of the relation of the fault triplet after the circulation is finished;
s2.4, testing the performance of a knowledge reasoning model fusing GAT and RotatE: and (3) converting a test set of the fault triplet in a fault knowledge base of the numerical control machine tool into an embedded representation vector by utilizing an embedded representation vector of the entity and the relation of the fault triplet obtained after training by fusing the knowledge reasoning model of GAT and RotatE, then respectively replacing a head entity and a tail entity of the test set of the fault triplet to obtain replaced fault triples, sorting all the replaced fault triples from low to high according to a scoring result by a scoring function, searching the position of the head entity or the tail entity of the fault triplet before replacement, and evaluating the generalization capability of the knowledge reasoning model fusing GAT and RotatE by utilizing Hit@3, hit@10, MR and MRR evaluation indexes.
Specifically, the step S3 of identifying the problem includes:
s3.1, constructing an intelligent question-answering system webpage: through the Django library creation project of Python, the routing address is modified, CSS and JS plugins are selected to write an HTML webpage file, an intelligent question-answering system webpage based on a numerical control machine tool fault knowledge graph after the HTML file is operated is shown in FIG. 6, a background can receive a problem in a text box of a user on the intelligent question-answering system webpage, and a result processed by the background is displayed on the intelligent question-answering system webpage;
s3.2, entity identification: extracting keywords of a problem proposed by a user by utilizing a jieba library of Python and a custom dictionary, and carrying out semantic similarity calculation on the keywords and entities in a numerical control machine tool fault knowledge base, wherein the entity of the numerical control machine tool fault knowledge base with the highest semantic similarity calculation result is the head entity of the problem triplet;
the semantic similarity calculation mode adopted by the invention mainly relates to three similarity calculation methods of editing distance similarity (Levenshtein Distance, LD), character overlapping coefficient similarity (Overlap Coefficient, OC) and Cosine similarity (Cosine). Firstly, respectively calculating edit distance similarity, character overlapping similarity and cosine similarity of different character strings, and then taking an arithmetic average value of three semantic similarity results of the edit distance similarity, the character overlapping similarity and the cosine similarity as a final semantic similarity calculation result; according to the semantic similarity calculation method, when the semantic similarity of different character strings is calculated, three conditions of editing distance, character overlapping and cosine similarity can be considered at the same time, so that the accuracy of matching of the different character strings through semantic similarity calculation results is improved.
The edit distance similarity is based on the character string C i To character string C j The minimum operation times required to be executed are converted, the operations comprise insertion, deletion and replacement, and a calculation formula is as follows:
Figure BDA0004066482330000121
wherein LD is a character string C i To character string C j Conversion requires the least number of operations to be performed, length (C i ) And length (C) j ) Respectively represent character string C i And character string C j Is of the character length S LD (C i ,C j ) Representing character string C i And character string C j Edit distance similarity of (c).
The similarity of the character overlapping coefficients is based on the character string C i And character string C j Calculating the number of the same characters; the specific calculation formula is as follows:
Figure BDA0004066482330000122
wherein N is a character string C i And character string C j The number of the same characters, length (set (C i ,C j ) A) represents character string C i And character string C j Length of non-repeated character set S OC (C i ,C j ) Representing character string C i And character string C j Is a character overlap coefficient similarity of (c).
Cosine similarity is obtained by measuring the difference between two characters by cosine values of the included angles of the two vectors in the vector space, and calculating the character string C i And character string C j When cosine similarity of the entity is obtained, an embedded representation vector of the entity is trained by utilizing a knowledge reasoning model fused with GAT and RotatE, a character string is converted into the embedded representation vector, and then the cosine similarity formula is utilized for calculation:
Figure BDA0004066482330000123
Wherein V is Ci And V Cj Respectively character string C i And character string C j Is embedded in the representation vector, ||v Ci I and I V Cj The I are character strings C respectively i And character string C j Is embedded to represent the features of the vector S COS (C i ,C j ) Representing character string C i And character string C j Cosine similarity of (c).
The invention uses the character string C i And C j Semantic similarity S (C) i ,C j ) Defined as edit distance similarity S LD (C i ,C j ) Similarity of character overlapping coefficients S OC (C i ,C j ) And cosine similarity S COS (C i ,C j ) The arithmetic mean of the three components is calculated as follows:
Figure BDA0004066482330000124
wherein S (C) i ,C j ) Representing character string C i And character string C j Semantic similarity of (c) to each other.
The new semantic similarity calculation mode provided by the invention can simultaneously consider three conditions of editing distance, character overlapping and cosine similarity of different character strings when calculating the semantic similarity of different character strings, thereby improving the accuracy when the different character strings are matched through the semantic similarity calculation result.
S3.3, constructing a problem triplet: and confirming the relation of the problem triplet by adopting a mode of combining characteristic word matching and intention recognition, and then forming the problem triplet by taking the head entity of the problem triplet, the relation of the problem triplet and one entity randomly selected from a numerical control machine tool fault knowledge base as the tail entity of the problem triplet.
Specifically, the step S4 of outputting the answer includes:
s4.1, calculating the scores of the negative problem triples and sequencing: the method comprises the steps of replacing tail entities of problem triples by entities in a numerical control machine tool fault knowledge base to obtain negative problem triples, converting the entities and the relations of the negative problem triples into embedded expression vectors by using embedded expression vectors of the entities and the relations obtained after training by a knowledge reasoning model fused with GAT and RotatE, calculating scores of all the negative problem triples through a scoring function, and arranging from low to high according to score results;
s4.2, knowledge screening: carrying out knowledge screening on the sequenced negative case problem triples, and removing non-conforming negative case problem triples according to tail entity tag requirements;
s4.3, returning an answer: and displaying the ten negative case question triples with the lowest scores after knowledge screening as answers to the user in a form of a table on the webpage of the intelligent question-answering system.
The invention relates to an intelligent question-answering system based on a fault knowledge graph of a numerical control machine, which is used for executing the intelligent question-answering method based on the fault knowledge graph of the numerical control machine when in implementation, and comprises the following steps: the system comprises a numerical control machine fault knowledge graph construction module, a knowledge reasoning model construction and training module integrating GAT and RotatE, a problem identification module and an answer output module.
The knowledge reasoning model fused with GAT and RotatE provided by the invention is verified on a numerical control machine tool fault knowledge base, and the link prediction experimental result is shown in Table 2.
Table 2 knowledge reasoning model linking prediction experiment results table fusing GAT and RotatE
Figure BDA0004066482330000131
As can be seen from table 2, the knowledge reasoning model fused with GAT and RotatE provided by the invention can well predict the tail entity of the fault triplet in the fault knowledge base of the numerical control machine tool when processing the fault knowledge map of the numerical control machine tool, better understand the past fault condition and maintenance method of the numerical control machine tool, assist in determining the fault maintenance scheme of the numerical control machine tool, and improve the speed and accuracy of fault diagnosis and maintenance of the numerical control machine tool.

Claims (7)

1. An intelligent question-answering method based on a fault knowledge graph of a numerical control machine tool is characterized by comprising the following steps:
s1, constructing a fault knowledge graph of the numerical control machine tool: processing the collected maintenance records of the numerical control machine tool equipment, reserving semantic relations between the entities, and generating a fault triplet, wherein the fault triplet comprises a head entity, a relation and a tail entity, storing the fault triplet in a numerical control machine tool fault knowledge base, dividing the fault triplet into a training set, a verification set and a test set according to a proportion, and importing the fault triplet into a Neo4j graph database to form a brand new numerical control machine tool fault knowledge graph;
S2, constructing a knowledge reasoning model fusing GAT and RotatE and training: the knowledge reasoning model fusing GAT and RotatE comprises a diagram attention layer part and a link prediction layer part; inputting the fault triplets in the fault knowledge base of the numerical control machine tool into a graph attention layer, and inputting the embedded representation vectors of the entities and the relations obtained after training into a link prediction layer; obtaining a negative example fault triplet from the positive example fault triplet by adopting a random sampling mode in the link prediction layer, calculating the scores of the positive example fault triplet and the negative example fault triplet through a scoring function, and storing an embedded representation vector of an entity and a relation output by the link prediction layer after the loop iteration optimization is finished;
s3, identifying problems: constructing an intelligent question-answering system webpage, acquiring a question text proposed by a user, extracting keywords of the question text by using a Python library and a custom dictionary, performing semantic similarity calculation on the keywords of the question text and the entities of a numerical control machine tool fault triplet, determining the head entity of the question triplet, determining the relation of the question triplet in a mode of combining characteristic word matching and intention recognition, and taking one entity randomly in the numerical control machine tool fault knowledge base as the tail entity of the question triplet;
S4, answer output: and (3) obtaining a replaced problem triplet by using an entity in a fault knowledge base of the numerical control machine tool to replace a tail entity of the problem triplet, calling an embedded representation vector of the entity and the relation obtained by training a knowledge reasoning model fused with GAT and RotatE, converting the replaced problem triplet into a vector form, calculating the score of the replaced problem triplet by using a scoring function, sorting and knowledge filtering the replaced problem triplet according to the score, and finally outputting ten replaced problem triples with the lowest score to a user in a form of a table.
2. The intelligent question-answering method based on the fault knowledge graph of the numerically-controlled machine tool according to claim 1, wherein the constructing the fault knowledge graph of the numerically-controlled machine tool in step S1 comprises:
s1.1, performing maintenance record processing on numerical control machine tool equipment: processing the collected maintenance records of the numerical control machine tool equipment, deleting missing lines and nonsensical lines, reserving the semantic relations among three entity categories of equipment names, fault conditions and maintenance results and different entity categories, constructing a fault triplet composed of a head entity, a relation and a tail entity according to the reserved entity categories and the semantic relations, and storing the fault triplet in a numerical control machine tool fault knowledge base;
S1.2, dividing a training set, a verification set and a test set: randomly dividing the fault triples into three parts of a training set, a verification set and a test set according to the ratio of 7:2:1, wherein the training set is used for updating parameters of knowledge reasoning models fusing GAT and RotatE, the verification set is used for adjusting the parameters of the knowledge reasoning models fusing GAT and RotatE, and the test set is used for evaluating generalization capability of the knowledge reasoning models fusing GAT and RotatE;
s1.3, constructing a fault knowledge graph of the numerical control machine tool: creating a fault knowledge graph of the numerical control machine by using Python, inserting a fault triplet in a fault knowledge base of the numerical control machine into the fault knowledge graph of the numerical control machine, respectively representing the entity and the relation of the fault triplet by using nodes and edges of the fault knowledge graph of the numerical control machine, generating a brand-new fault knowledge graph of the numerical control machine by using a Neo4j graph database, and visually displaying the brand-new fault knowledge graph of the numerical control machine.
3. The intelligent question-answering method based on the fault knowledge graph of the numerical control machine according to claim 1, wherein in the step S2, the knowledge reasoning model integrating GAT and RotatE is constructed and trained, and the method comprises the following steps:
s2.1, constructing a diagram attention layer: the attention layer of the graph adopts an attention mechanism, modeling is carried out through an aggregation function, the weight relation between the nodes in the fault knowledge graph of the numerical control machine tool and the neighbor nodes is calculated, then nonlinear activation is carried out on the weight relation, the attention coefficient is obtained through a logistic regression function, finally the attention coefficient is weighted and aggregated to obtain an embedded representation vector of the nodes during output, and the node number, the learning rate and the iteration number of each layer of the attention layer of the graph are designated during code implementation;
In order to transform entities and relationships entered by the knowledge-inference model fusing GAT and RotatE into vector space, the data is transformed by an initialized matrix W (we R F′×F ) Define a mapping b R F′ ×R F And R, wherein F and F' respectively represent the dimension of the embedded representation vector of the entity and the relation at the input time and the dimension of the embedded representation vector of the entity and the relation at the output time, and the weight relation of the node i and the node j is obtained by calculation of an attention mechanism:
e ij =b(Wx i ,Wx j ) (1)
wherein e ij Is the weight relation between node i and node j, b is the mapping vector, W is the linear transformation matrix of node i and node j, and x i Is node i, x j Is the neighbor node j of node i;
adding a LeakyReLU nonlinear activation function, and performing regularization processing by using a softmax function to obtain the attention coefficient of the node i:
Figure FDA0004066482320000021
wherein alpha is ij Is the attention coefficient of node i, N i Is the neighbor node of the ith node, exp (x) is the mathematical operation e x And (b) vector concatenation operation T Is the transpose of the mapping vector b, x k Is a neighbor node of the kth node;
the attention coefficients of the nodes i are weighted and summed to obtain the embedded representation vector of the trained node i:
Figure FDA0004066482320000022
wherein σ is a nonlinear conversion operation, x i ' is the embedded representation vector of the trained node i;
S2.2, constructing a link prediction layer: constructing a link prediction layer of a knowledge reasoning model fused with the GAT and the RotatE by utilizing the RotatE model, obtaining a negative case fault triplet from the positive case fault triplet in a random sampling mode, calculating the scores of the positive case fault triplet and the negative case fault triplet through a score function, and designating the dimension, the loss function and the score function of an embedded representation vector of a RotatE model entity and a relation when the code is realized;
the basic idea of the RotatE model derives from the euler formula:
e =cosθ+isinθ (4)
wherein the index iθ is expressed as a rotation angle θ in the complex vector space; thus, the RotatE model maps entities and relationships into complex vector space and defines relationships as the rotation angle from the head entity embedded representation vector to the tail entity embedded representation vector; giving a fault triplet, wherein a rotation vector obtained by rotating a head entity embedded representation vector of the fault triplet through a relation embedded vector of the fault triplet is supposed to be as close as possible to a tail entity embedded representation vector of the fault triplet; the closer the rotation vector of the fault triplet and the tail entity embedding vector of the fault triplet are, the more accurate the embedding representing vector of the entity and the relation of the fault triplet are; the approach degree of the rotation vector of the fault triplet and the tail entity embedded vector of the fault triplet is calculated by using a distance function, and the calculation formula is as follows:
Figure FDA0004066482320000033
Wherein d r (h, r, t) represents the scoring result of the failed triplet, h represents the head entity embedding vector of the failed triplet, r represents the relation embedding vector of the failed triplet, t represents the tail entity embedding vector of the failed triplet,
Figure FDA0004066482320000034
the operation of the loop-up is indicated, I.I L1/L2 The specific calculation formula of the L1 norm or the L2 norm is as follows:
Figure FDA0004066482320000031
Figure FDA0004066482320000032
wherein X is a matrix, X i Is the i-th element in the matrix;
s2.3, training a knowledge reasoning model fusing GAT and RotatE: inputting a training set of fault triples in a fault knowledge base of the numerical control machine tool into a graph meaning layer fusing knowledge reasoning models of GAT and RotatE for training to obtain embedded expression vectors of each node in a fault knowledge graph of the numerical control machine tool after training, calculating scores of positive fault triples and negative fault triples, designing a MarginLoss function as a loss function, and calculating a formula of the loss function as follows:
Loss=max[0,γ+d r (h,t)-d r' (h',t')] (8)
wherein Loss represents the Loss function value of the fault triplet, gamma represents the distance between the positive fault triplet and the negative fault triplet, and generally takes 1, d r (h, t) represents the scoring result of the positive case failure triplet, d r' (h ', t') represents the scoring result of the negative case failure triplet;
optimizing and learning by using an Adam optimizer, continuously updating and fusing weight parameters of a knowledge reasoning model of GAT and RotatE, continuously reducing the loss function value of the fault triplet, and storing the entity and the embedded expression vector of the relation of the fault triplet after the circulation is finished;
S2.4, testing the performance of a knowledge reasoning model fusing GAT and RotatE: and (3) converting a test set of the fault triplet in a fault knowledge base of the numerical control machine tool into an embedded representation vector by utilizing an embedded representation vector of the entity and the relation of the fault triplet obtained after training by fusing the knowledge reasoning model of GAT and RotatE, then respectively replacing a head entity and a tail entity of the test set of the fault triplet to obtain replaced fault triples, sorting all the replaced fault triples from low to high according to a scoring result by a scoring function, searching the position of the head entity or the tail entity of the fault triplet before replacement, and evaluating the generalization capability of the knowledge reasoning model fusing GAT and RotatE by utilizing Hit@3, hit@10, MR and MRR evaluation indexes.
4. The intelligent question answering method based on the fault knowledge graph of the numerical control machine according to claim 1, wherein the problem identification in step S3 includes:
s3.1, constructing an intelligent question-answering system webpage: through the Django library creation items of Python, the routing address is modified, CSS and JS plugins are selected to write HTML webpage files, so that a background can receive questions raised by a user on a webpage of an intelligent question-answering system, and the results processed by the background are displayed on the webpage of the intelligent question-answering system;
S3.2, entity identification: extracting keywords of a problem proposed by a user by utilizing a jieba library of Python and a custom dictionary, and carrying out semantic similarity calculation on the keywords of the problem and entities in a numerical control machine tool fault knowledge base, wherein the entity of the numerical control machine tool fault knowledge base with the highest semantic similarity calculation result is the head entity of a problem triplet;
s3.3, constructing a problem triplet: and confirming the relation of the problem triplet by adopting a mode of combining characteristic word matching and intention recognition, and then forming the problem triplet by taking the head entity of the problem triplet, the relation of the problem triplet and one entity randomly selected from a numerical control machine tool fault knowledge base as the tail entity of the problem triplet.
5. The intelligent question-answering method based on the fault knowledge graph of the numerical control machine according to claim 1, wherein the answer output in step S4 comprises:
s4.1, calculating the scores of the negative problem triples and sequencing: the method comprises the steps of replacing tail entities of problem triples by entities in a numerical control machine tool fault knowledge base to obtain negative problem triples, converting the entities and the relations of the negative problem triples into embedded expression vectors by using embedded expression vectors of the entities and the relations obtained after training by a knowledge reasoning model fused with GAT and RotatE, calculating scores of all the negative problem triples through a scoring function, and arranging from low to high according to score results;
S4.2, knowledge screening: carrying out knowledge screening on the sequenced negative case problem triples, and removing non-conforming negative case problem triples according to tail entity tag requirements;
s4.3, returning an answer: and displaying the ten negative case question triples with the lowest scores after knowledge screening as answers to the user in a form of a table on the webpage of the intelligent question-answering system.
6. The intelligent question-answering method based on the fault knowledge graph of the numerical control machine tool according to claim 4, wherein the semantic similarity calculation comprises an edit distance similarity part, a character overlapping coefficient similarity part and a cosine similarity part:
the edit distance similarity is based on the character string C i To character string C j The minimum operation times required to be executed are converted, the operations comprise insertion, deletion and replacement, and a calculation formula is as follows:
Figure FDA0004066482320000041
wherein LD is a character string C i To character string C j Conversion requires the least number of operations to be performed, length (C i ) And length (C) j ) Respectively represent character string C i And character string C j Is of the character length S LD (C i ,C j ) Representing character string C i And character string C j Edit distance similarity of (2);
the similarity of the character overlapping coefficients is based on the character string C i And character string C j Calculating the number of the same characters;
Figure FDA0004066482320000051
Wherein N is a character string C i And character string C j The number of the same characters, length (set (C i ,C j ) A) represents character string C i And character string C j Length of non-repeated character set S OC (C i ,C j ) Representing character string C i And character string C j Is a character overlap coefficient similarity of (1);
cosine similarity is the conversion of a string into an embedded representation vector, which is then calculated using the formula:
Figure FDA0004066482320000052
wherein V is Ci And V Cj Respectively character string C i And character string C j Is embedded in the representation vector, V Ci And V Cj Respectively character string C i And character string C j Is embedded to represent the features of the vector S COS (C i ,C j ) Representing character string C i And character string C j Cosine similarity of (c);
string C i And character string C j Semantic similarity S (C) i ,C j ) Defined as edit distance similarity S LD (C i ,C j ) Similarity of character overlapping coefficients S OC (C i ,C j ) And cosine similarity S COS (C i ,C j ) The arithmetic average of the three is calculated as follows:
Figure FDA0004066482320000053
wherein S (C) i ,C j ) Representing character string C i And character string C j Semantic similarity of (c) to each other.
7. An intelligent question-answering system based on a fault knowledge graph of a numerical control machine, which is characterized in that the intelligent question-answering system is used for executing the intelligent question-answering method based on the fault knowledge graph of the numerical control machine according to any one of claims 1-6 when being implemented, and comprises the following steps: the system comprises a numerical control machine fault knowledge graph construction module, a knowledge reasoning model construction and training module integrating GAT and RotatE, a question identification module and an answer output module.
CN202310077227.5A 2023-01-30 2023-01-30 Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool Pending CN116150337A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310077227.5A CN116150337A (en) 2023-01-30 2023-01-30 Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310077227.5A CN116150337A (en) 2023-01-30 2023-01-30 Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool

Publications (1)

Publication Number Publication Date
CN116150337A true CN116150337A (en) 2023-05-23

Family

ID=86373066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310077227.5A Pending CN116150337A (en) 2023-01-30 2023-01-30 Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool

Country Status (1)

Country Link
CN (1) CN116150337A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116933528A (en) * 2023-07-21 2023-10-24 南京航空航天大学 Case knowledge graph-based auxiliary design method and system for air inlet pipeline
CN117150002A (en) * 2023-11-01 2023-12-01 浙江大学 Abstract generation method, system and device based on dynamic knowledge guidance
CN117744787A (en) * 2024-02-20 2024-03-22 中国电子科技集团公司第十研究所 Intelligent measurement method for first-order research rule knowledge rationality

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116933528A (en) * 2023-07-21 2023-10-24 南京航空航天大学 Case knowledge graph-based auxiliary design method and system for air inlet pipeline
CN117150002A (en) * 2023-11-01 2023-12-01 浙江大学 Abstract generation method, system and device based on dynamic knowledge guidance
CN117150002B (en) * 2023-11-01 2024-02-02 浙江大学 Abstract generation method, system and device based on dynamic knowledge guidance
CN117744787A (en) * 2024-02-20 2024-03-22 中国电子科技集团公司第十研究所 Intelligent measurement method for first-order research rule knowledge rationality
CN117744787B (en) * 2024-02-20 2024-05-07 中国电子科技集团公司第十研究所 Intelligent measurement method for first-order research rule knowledge rationality

Similar Documents

Publication Publication Date Title
CN116150337A (en) Intelligent question-answering method and system based on fault knowledge graph of numerical control machine tool
CN112380325B (en) Knowledge graph question-answering system based on joint knowledge embedded model and fact memory network
CN111597347B (en) Knowledge embedding defect report reconstruction method and device
WO2020010834A1 (en) Faq question and answer library generalization method, apparatus, and device
WO2020256854A1 (en) Data sampling for model exploration
CN111949855A (en) Knowledge map-based engineering technology knowledge retrieval platform and method thereof
CN110866089B (en) Robot knowledge base construction system and method based on synonymous multi-context analysis
CN111274327B (en) Entity and relation extraction method for unstructured table document
CN116703328B (en) Project review method and system
CN118195260A (en) Course learning evaluation method and system based on knowledge graph visualization
CN113326361B (en) Knowledge question-answering method and system based on automobile industry map and electronic equipment
CN117909754A (en) Auxiliary power plant equipment defect elimination method and system based on twin neural network
Visalli et al. ESG Data Collection with Adaptive AI.
CN116805010A (en) Multi-data chain integration and fusion knowledge graph construction method oriented to equipment manufacturing
CN111814457B (en) Power grid engineering contract text generation method
CN117708280B (en) Intelligent power transmission work ticket retrieval method based on knowledge graph
CN118333439A (en) Intelligent evaluation method, system and equipment for government affair, work and supervision examination
Liu Application of Computer Data Mining Technology in Archives Information Management System
CN116050411A (en) Address classification and complement address standardization method based on big data
Tanevitch et al. Attribute-Value Extraction: the case of a Real Estate Observatory
Verdinelli et al. Boosting Warranty Data Analysis with Natural Language AI Algorithms
Barry de Ville Ubiquitous Scoring of 1000+ Warranty Categories Using Predictive Rules Derived from Text
CN117556045A (en) Recruitment text expertise point classification method and device based on competence
CN118747216A (en) Loan use text classification method and system based on convolutional neural network
CN114547330A (en) Semi-automatic construction method and system of music knowledge graph

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination