Electronic component knowledge reasoning and knowledge graph construction method, system and medium
By constructing the ontology library and training relationship extraction model and entity recognition model, the problem of low data quality of electronic components is solved, and effective inference of substitution relationships and missing values of electronic components and the construction of knowledge graphs is realized.
Patent Information
- Application Number
- CN202210535661.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-17
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-05-17
AI Technical Summary
In the prior art, the data quality of electronic components is not high and the detailed data is lacking, which affects the accuracy of entity modeling and relationship construction.
A method of building a knowledge inference and knowledge graph for electronic components is adopted, and knowledge graphs is constructed by building an ontology library, acquiring and preprocessing data, training a relationship extraction model and entity recognition model, performing relationship extraction and entity recognition, and constructing a knowledge graph.
It realizes effective inference on the substitution relationship and missing values of electronic components, builds a high-quality knowledge graph, and creates the development of electronic component databases.
Smart Images

Figure CN115080759B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic components, and in particular to a method, system and medium for electronic component knowledge reasoning and knowledge graph construction. Background Art
[0002] In the current research on electronic component substitution relationships, the following problems mainly exist: the data quality of electronic components from some manufacturers is not very high, and some detailed data is more or less missing, that is, there are missing values in all attributes related to the component type, which affects the accuracy of electronic component entity modeling and relationship construction. Summary of the invention
[0003] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the purpose of the present invention is to provide a method, system and medium for electronic component knowledge reasoning and knowledge graph construction.
[0004] The technical solution adopted by the present invention is:
[0005] A method for electronic component knowledge reasoning and knowledge graph construction includes the following steps:
[0006] Build ontology library;
[0007] Acquire electronic component data, pre-process the electronic component data according to the ontology library, and acquire triplet data of the electronic component;
[0008] Constructing a relationship extraction model and an entity recognition model, and using the obtained electronic component triple data to train the relationship extraction model and the entity recognition model;
[0009] Obtain the data to be processed, use the trained relation extraction model to extract relations from the data to be processed, and obtain a relation data list List3; use the trained entity recognition model to perform entity recognition on the data to be processed, and obtain an entity data list List2;
[0010] Get the triple list Triplets according to the relationship data list List3 and the entity data list List2;
[0011] Align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and build the knowledge graph.
[0012] The entity recognition model performs entity recognition based on the features of components, and the relationship extraction model performs relationship extraction based on the features of components.
[0013] Furthermore, the entity recognition model and the relationship extraction model are both Complex Embedding models;
[0014] The entity recognition model and the relationship extraction model are trained in the following way:
[0015] Convert the entity recognition problem and the relationship extraction problem into a 3D binary tensor completion problem and give the model two input sequences X E1 ={x e1_1 , x e1_2 , ..., x e1_n}, X E2 ={x e21 , x e22 , ..., x e2n}, the corresponding output sequence is Y E ={y e_1 ,y e_2 , ..., y e_n}, where n represents the length of the solid feature, x ei_j represents the jth feature of the entity with subscript i, y e_i Represents the output features, and the final result is mapped to the corresponding entity, with E_ and e_ representing the model prediction task prefix;
[0016] The input sequence is first mapped to the entity feature vector space through the embedding layer, and then input into the defined model. The score of the triple is calculated through the two input sequences and the score function of different corresponding relationships, and the relationship of the triple is judged according to the score; the parameters of the score function of different relationships are different;
[0017] The final output feature vector Y obtained by the model E Mapping is performed to obtain the corresponding entity or relationship.
[0018] Furthermore, the scoring function calculated by the entity recognition model and the relationship extraction model for the triple (s, r, o) is:
[0019]
[0020] Among them, w r , e sk , They are the relationship vector, the head entity, and the tail entity embedding vector respectively; Re(x) means taking the real part of x, Im(x) means taking the imaginary part of x, s represents the first entity of the triple, r represents the relationship of the triple, and o represents the second entity or attribute of the triple; Θ is the parameter of the model.
[0021] Furthermore, in the process of training the entity recognition model and the relationship extraction model, a negative log-likelihood function is used as a loss function, and the loss function is defined as follows:
[0022]
[0023] in, is a regularization term added to prevent overfitting; Y rso represents the predicted value of the (s, r, o) triple being true when the parameter is Θ, Y rso ∈(1,-1).
[0024] Furthermore, the constructing of the ontology library comprises:
[0025] Confirm that the main body field is the electronic component body;
[0026] Confirm the ontology terms;
[0027] Define conceptual attributes, where the attributes include numerical attributes and entity attributes. The numerical attributes include operating voltage, tolerance, size code, lead-free, resistance value, rated power, rated temperature, risk level, temperature coefficient, minimum operating temperature, maximum operating temperature, package length, package width, and package height.
[0028] Define attribute constraints;
[0029] The electronic component data is obtained, and the electronic component knowledge instance is constructed according to the defined concept class attributes and the defined attribute constraints to obtain the ontology library.
[0030] Another technical solution adopted by the present invention is:
[0031] An electronic component knowledge reasoning and knowledge graph construction system, comprising:
[0032] Ontology library construction module, used to build the ontology library;
[0033] A data extraction module is used to obtain electronic component data, pre-process the electronic component data according to the ontology library, and obtain triplet data of the electronic component;
[0034] A model training module, used to construct a relationship extraction model and an entity recognition model, and to train the relationship extraction model and the entity recognition model using the obtained electronic component triple data;
[0035] The data processing module is used to obtain the data to be processed, use the trained relationship extraction model to perform relationship extraction on the data to be processed, and obtain the relationship data list List3; use the trained entity recognition model to perform entity recognition on the data to be processed, and obtain the entity data list List2;
[0036] The triple acquisition module is used to obtain the triple list Triplets according to the relationship data list List3 and the entity data list List2;
[0037] The graph construction module is used to align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and realize the construction of the knowledge graph;
[0038] The entity recognition model performs entity recognition based on the features of components, and the relationship extraction model performs relationship extraction based on the features of components.
[0039] Another technical solution adopted by the present invention is:
[0040] An electronic component knowledge reasoning and knowledge graph construction system, comprising:
[0041] at least one processor;
[0042] at least one memory for storing at least one program;
[0043] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0044] Another technical solution adopted by the present invention is:
[0045] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to execute the method described above when executed by the processor.
[0046] The beneficial effect of the present invention is that the present invention obtains the electronic component knowledge graph and its substitution system by reasoning about the substitution relationship of electronic components and the missing values of components, thereby pioneering the development of the electronic component database. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 It is a flowchart of the steps of a method for electronic component knowledge reasoning and knowledge graph construction in an embodiment of the present invention;
[0049] Figure 2It is a framework flow chart of the entity recognition model and the relationship extraction model in the embodiment of the present invention;
[0050] Figure 3 It is a flowchart of ontology library creation in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0052] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0053] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0054] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0055] Terminology explanation:
[0056] Complex Embedding Model: The Complex Embedding model introduces a complex space, where each entity and relationship is embedded and represented by a complex vector.
[0057] Based on the above-mentioned problems arising in electronic components, this embodiment will use the relevant technology of knowledge graph to learn the numerical data and alternative knowledge of components, so as to infer the substitution relationship of electronic components and the missing values of components, and obtain the knowledge graph of electronic components and its substitution system.
[0058] like Figure 1 As shown, this embodiment provides a method for electronic component knowledge reasoning and knowledge graph construction, including the following steps:
[0059] S1, build ontology library;
[0060] S2, obtaining electronic component data, preprocessing the electronic component data according to the ontology library, and obtaining electronic component triplet data;
[0061] S3, constructing a relationship extraction model and an entity recognition model, and using the obtained electronic component triple data to train the relationship extraction model and the entity recognition model;
[0062] S4, obtaining the data to be processed, using the trained relation extraction model to perform relation extraction on the data to be processed, and obtaining a relation data list List3; using the trained entity recognition model to perform entity recognition on the data to be processed, and obtaining an entity data list List2;
[0063] S5, obtain the triple list Triplets according to the relationship data list List3 and the entity data list List2;
[0064] S6. Align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and build the knowledge graph.
[0065] The entity recognition model performs entity recognition based on the features of components, and the relationship extraction model performs relationship extraction based on the features of components.
[0066] As an optional implementation, the entity recognition model and the relationship extraction model are the same model, both of which are Complex Embedding models. This embodiment transforms the entity recognition problem and the relationship extraction problem into a 3D binary tensor completion problem. The model is given two input sequences X E1 ={x e1_1 , x e1_2 , ..., x e1_n}, X E2 ={x e21 , x e22 , ..., x e2n}, the output sequence should be Y E ={y e_1,y e_2 , ..., y e_n}, where n represents the length of the solid feature, x ei_j represents the jth feature of the entity with subscript i, y e_i Represents the output features, and the final result is mapped to the corresponding entity, with E_ and e_ representing the model prediction task prefix;
[0067] The input sequence is first mapped to the entity feature vector space through the embedding layer. What is special is that the entity is represented by a complex vector. Since the current method decomposes part of the observed matrix / tensor into the product of embedding matrices with smaller rank, a fixed-size vector representation is generated for each entity and relationship in the database. For a given fact r(s, o), the score function is defined as the multilinear product of the embedding vectors of s, r, and o, where s, r, and o are the first entity, relationship, and second entity of the triple, respectively. However, because the dot product calculation between real vectors is commutative, it is not easy to handle asymmetric relationships using dot products. Using complex vectors to represent entities and relationships can solve the problem of asymmetric relationships to a certain extent. Complex vector space can describe asymmetric relationships while retaining the efficiency advantage of dot products, that is, both space and time complexity are linear. Then it is input into the model defined by Complex Embedding, and their scores are calculated by the score functions of two input sequences and different corresponding relationships. It should be noted that some parameters of the score functions of different relationships are different, which is related to the relationship. Finally, their relationship is judged according to the score, or the value of the data. The output feature vector Y finally obtained by the model is E Mapping is performed to obtain the corresponding entity or relationship.
[0068] As an optional implementation, the calculation formula of the triple score is as follows:
[0069]
[0070] Among them, w r , e sk , are the embedding vectors of the relation vector, the head entity, and the tail entity respectively; Re(x) means taking the real part of x, Im(x) means taking the imaginary part of x, s represents the first entity of the triple, r represents the relation of the triple, and o represents the second entity or attribute of the triple; Θ is the parameter of the model. The score calculation process of the triple (s, r, o) is the product of the conjugate vector of the representation vector of the relation r, the representation vector of the subject s, and the representation vector of the object o, and the real part of the final result is retained.
[0071] Afterwards, the score is used to calculate the probability that the triple is true, that is, to predict the result, the formula is as follows:
[0072] p(Y rso =1)=σ(Φ(r,s,o;Θ))
[0073] Here, Θ is the parameter of the model.
[0074] During the training process, given a set of training samples The negative log-likelihood function is used as the loss function to train the entire model. The function is defined as follows:
[0075]
[0076] Among them, Θ is the parameter of the model, It is a regularization term added to prevent overfitting.
[0077] The above method is explained in detail below in conjunction with specific embodiments.
[0078] The embodiment of the present invention studies two main tasks in the field of electronic components: the construction of an electronic component knowledge graph and the substitution relationship and attribute value reasoning of electronic components. An electronic component reasoning model is constructed using the data of electronic components, the attribute values of electronic components are predicted, the reasoning model is trained and the problem is solved. This embodiment collects a large amount of electronic component data, uses the neo4j graph database to construct an electronic component knowledge graph, and combines knowledge graph embedding and knowledge reasoning techniques to embed electronic components and predict the attribute values and substitution relationships of electronic components to construct a substitution model of the electronic component knowledge graph. In the present invention, the attribute values and substitution relationships are predicted on the electronic component knowledge graph by using the knowledge reasoning algorithm, and the experiment has achieved relatively good results. This method has achieved relatively good results in predicting the relationships between the acquired electronic components and their values.
[0079] This embodiment takes electronic components as the main research object, and proposes an electronic component knowledge graph based on complex vector representation and an automatic construction framework for electronic component substitution relationships. Electronic component entity and relationship information is obtained from foreign electronic component websites and the official websites of some domestic manufacturers, and the electronic component ontology library is constructed and the electronic component data is preprocessed. Then, using the model training data proposed in the present invention, the trained model performs entity recognition and relationship extraction on the relationship between electronic components and the attribute values of electronic components. Finally, the corrected triples are obtained and imported into Neo4j for knowledge fusion to construct a visual knowledge graph, realizing a high-quality, systematic electronic component knowledge graph and substitution relationship automatic construction process.
[0080] The main steps of model construction are as follows:
[0081] Step 1: Data collection and preprocessing. Domestic electronic component data has not formed a large database, and foreign electronic component data has not been directly obtained as structured data. Therefore, before training the model, the problem that the present invention needs to solve is how to obtain data. This embodiment uses a python crawler to obtain data and uses the relevant technology of knowledge graphs to preprocess the data.
[0082] 1) Data Collection
[0083] The data of electronic components are basically stored on web pages. The difference is that the domestic data is relatively scattered and distributed on each manufacturer's website, while foreign electronic components have special databases with relatively concentrated data, which can also be accessed and viewed through web pages. In this embodiment, web crawler technology will be used to crawl the data of electronic components. Because the data in the web page is only considered semi-structured data, it is not convenient to directly convert it into knowledge, so after data crawling, it will be organized into structured data to facilitate the next step of work. In this data collection process, python crawler technology will be used to collect data. First, the URL of the home page display page of the array resistor is obtained, and then the data display page of each electronic component is collected through the table, and then the display page of the substitute material set is obtained through the display page of the electronic component. The data display page of the substitute material is also collected through the table. After crawling a component and its substitute material data, crawl the next component and use set to confirm whether the component data has been recorded. In the electronic component data display webpage, data is basically displayed through a table. Through the table and the name of each div in the table, the attributes and attribute values of the components, as well as the substitution relationship between the components, can be obtained, and finally saved in the table to obtain structured data. After obtaining the component name, various attributes and corresponding attribute values, and the substitution relationship table, it is possible to easily extract triples through the structured table, that is, extract knowledge. In the present invention, extracting knowledge is not only to prepare for the subsequent knowledge graph construction, but also to process the data and hand it over to the model for the next step of training.
[0084] Step 2: Training the Complex Embedding model. In the present invention, training the Complex Embedding model is the most important step, which determines the accuracy of the electronic component substitution relationship and attribute value prediction, and determines the reliability of the constructed electronic component knowledge graph.
[0085] Knowledge bases represent data as directed graphs with labeled edges (relationships) between nodes (entities). There will be some data redundancy in the recorded relationships, which allows us to supplement entries through links. However, many relationships in reality are uncertain. Therefore, it may be necessary to handle other facts involving these relationships or entities in a probabilistic way.
[0086] See also Figure 2 In the study of electronic components, we transform the link prediction problem into a 3D binary tensor completion problem. With many recommendation system competitions, low-rank factorization-based or embedding-based completion has been widely promoted. Partially observed matrices / tensors are decomposed into the product of embedding matrices with smaller rank, thereby generating a fixed-size vector representation for each entity and relationship in the database. For a given fact r(s, o), the score function is defined as the multilinear product of the embedding vectors of s, r, and o. However, because the dot product calculation between real vectors is commutative, it is difficult to handle asymmetric relationships using dot products.
[0087] For knowledge graphs, there are many relationships, which are expressed as a combination of multiple hierarchical structures. A good relational model should have the following properties: (a) It can learn all combinations of attributes, i.e., reflexivity / irreflexivity, symmetry / antisymmetry, and transitivity. (b) It is linear in both algorithm time and memory, so that it can be expanded to keep up with the growth rate of the knowledge graph.
[0088] Due to the large number of types of electronic components, in order to prevent the exponential growth of parameters due to the processing of asymmetric relationships, in order to achieve a balance between these two points, the use of complex vector space can describe asymmetric relationships while retaining the efficiency advantage of the dot product, that is, both the space and time complexities are linear.
[0089] Consider a simple link prediction with only a single relationship type. Let ε represent the entity set, |ε| = n, and the relationship between entities is only considered to be two types (binary relationship) -1 and +1, that is, Y rso ∈{-1, 1}. Its probability is given by the following scoring function:
[0090] p(Y rso =1)=σ(Φ(r,s,o;Θ))
[0091] Where X∈R n*n is the score space, and Y is the partially observed symbol matrix.
[0092] For this formula, there are three points to summarize:
[0093] All possible binary relations can be included through factorization;
[0094] By construction, it can accurately describe symmetric and antisymmetric relations;
[0095] The learnable relationship can be approximated by a simple low-rank decomposition and the vectors are mapped into the complex space.
[0096] Afterwards, the model is extended to multi-type relations: each relation r is embedded to obtain the embedding vector W r ∈C k , the embedding vector of the entity is shared for each relation r (e s , e o ).
[0097] For a given entity s and o, the log probability of fact r(s, o) being true is:
[0098] p(Y rso =1)=σ(Φ(r,s,o;Θ))
[0099] Here, Θ is the parameter of the model.
[0100] Although X is unknown in general, for the observed facts, the corresponding rso =1, false, corresponding to Y rso =-1, we have:
[0101] {Y rso} r(s,o)∈Ω ∈{-1, 1} |Ω|
[0102] Different scoring functions correspond to different models. The scoring function used by the model of this embodiment for the triple (s, r, o) is:
[0103]
[0104] Among them, w r , e sk , are the embedding vectors of the relation vector, the head entity, and the tail entity respectively; Re(x) means taking the real part of x, Im(x) means taking the imaginary part of x, s represents the first entity of the triple, r represents the relation of the triple, and o represents the second entity or attribute of the triple; Θ is the parameter of the model. The score calculation process of the triple (s, r, o) is the product of the conjugate vector of the representation vector of the relation r, the representation vector of the subject s, and the representation vector of the object o, and the real part of the final result is retained.
[0105] There are two points to note about this model:
[0106] Because conjugate vectors are used, antisymmetric embeddings can be represented;
[0107] The scores involve only real vectors corresponding to the real and imaginary parts of the embeddings and relations.
[0108] When there is only the imaginary part, it indicates an antisymmetric relationship; when there is only the real part, it indicates a symmetric relationship. Then, for W r =Re(W r +iIm(W r ), we can transform the relationship score matrix X r Decomposed into the sum of symmetric and antisymmetric relationships.
[0109] So, from an algebraic point of view, the relation embedding vector is to project the relation into the symmetric and antisymmetric directions, and then use the dot product to calculate the score function.
[0110] Graphically, the relation embedding vector can be viewed as anisotropically scaling the entity embedding vector E and then projecting it onto the real subspace.
[0111] During the training process, given a set of training samples The negative log-likelihood function is used as the loss function to train the entire model. This function is the classic logistic regression loss function, and the function is defined as follows:
[0112]
[0113] Among them, Θ is the parameter of the model, It is a regularization term added to prevent overfitting.
[0114] Based on the model constructed for electronic component substitution relations and attribute value prediction, we collected electronic component data, designed entities and relations in the knowledge graph, and conducted electronic component substitution relations and attribute value prediction, and established an automated process for constructing knowledge graphs.
[0115] The main steps for automatically building the knowledge graph of electronic components are as follows:
[0116] Step 1: Knowledge Modeling
[0117] Knowledge modeling is the determination of ontology and knowledge representation. The establishment of an ontology library is an important guarantee for building a knowledge graph. Determining the ontology domain in advance plays an important role in the subsequent identification of entities and relationships, preventing the misidentification of entities, which leads to slow model training or errors. There are two modes for establishing an ontology library: top-down and bottom-up. Top-down is from abstract to concrete, while bottom-up is from concrete to abstract. Figure 3,The steps to build the ontology library are as follows:
[0118] A1. Confirm the ontology domain.
[0119] The present invention intends to construct a knowledge graph of electronic components and make predictions with the help of the knowledge graph. Therefore, it is necessary to abstract the instances into models and construct an electronic component ontology library.
[0120] A2. Confirm the ontology terms.
[0121] In the electronic component ontology library, the only ontology to be confirmed is the electronic component.
[0122] A3. Define concept class attributes.
[0123] By observing the data, the attributes that are temporarily needed now include numerical attributes such as operating voltage, tolerance, size code, lead-free or not, resistance value, rated power, rated temperature, risk level, temperature coefficient, minimum operating temperature, maximum operating temperature, package length, package width, package height, as well as physical attribute substitutes.
[0124] A4. Define attribute constraints.
[0125] Numerical attributes should have only one value in each electronic component, and entity attribute substitute materials can have 0, 1 or multiple values, and the substitution relationship between substitute materials and the entity should be reversible.
[0126] A5. Clarify the data source.
[0127] The electronic component data of the embodiment of the present invention will be acquired by using crawler knowledge from electronic component websites at home and abroad.
[0128] A6. Build an example.
[0129] The electronic component data obtained from the electronic components will be used to construct electronic component knowledge instances according to the definitions in steps A3 and A4, and used to construct a knowledge graph.
[0130] This embodiment takes electronic components as the research object, and refers to relevant papers on the substitution relationship of domestic electronic components and authoritative foreign electronic component data websites to construct the electronic component ontology. This process includes predefining the entities and relationships involved in electronic components, and processing the data according to the predefined entities and relationships. Finally, a total of 19 entity types and 18 relationship types are predefined, as shown in Table 1 and Table 2, respectively.
[0131] Table 1 Predefined entity types
[0132]
[0133] Table 2 Predefined relationship types
[0134]
[0135]
[0136] The data of the present invention will be stored in neo4j, and after data collection, the data has become structured data, so knowledge extraction will be performed simultaneously by directly storing the data in neo4j, and since the structure of neo4j is similar to the structure of the knowledge graph, the modeling of data in neo4j is equivalent to the knowledge modeling of the knowledge graph. The specific classification of entities, relationships, and attributes of the electronic component knowledge graph and the corresponding triple relationships have been specifically displayed in the above table. Since structured data is obtained, the method of importing external data using neo4j is used for knowledge extraction. Neo4j provides a method for importing tabular data. The nodes of the electronic component category can be defined through the Cypher query language, and then the attribute values such as the names of the electronic components are imported through the structured table, and then the substitution relationship between the electronic component entities is constructed through the data of the substitution relationship, and finally the complete electronic component knowledge graph is obtained. The imported data represents the knowledge of the electronic components required by this embodiment in the form of nodes, edges, and nodes. Each group of nodes, edges, and nodes can be regarded as a (entity, relationship, entity) or (entity, attribute, attribute value) knowledge. Therefore, in the process of importing structured data into the neo4j database, the process of knowledge extraction has been completed. After importing the data into neo4j, use neo4j to store knowledge. Using neo4j to store knowledge not only allows for faster queries, but also allows for easy access and viewing of the content of the knowledge graph. After data organization, there are 518 entities and 16 relationships imported into neo4i, forming a total of 11,719 triples, i.e., 518 nodes and 6,879 edges. In the experiment of the model training task of electronic component substitution relations and attribute value prediction, according to the 8:1:1 ratio of the data set, 9,427 triples are training data, and the remaining 2,292 triples are used as test data to evaluate model performance.
[0137] Step 2: Automated architecture construction.
[0138] Based on the above electronic component substitution relationships and attribute value prediction technologies, in this section we will introduce the process of automatically building a knowledge graph using electronic component data. The detailed steps are as follows: Steps B1-B4:
[0139] B1. Data preprocessing. Given the semi-structured data crawled from the website, preprocess it to obtain the entity data lists List1 and List2 and organize them to obtain the entity table Entities, and store each entity in the format of <entity name, entity type>.
[0140] B2. Relationship extraction. According to the entity type pairs in the predefined relationships, the entities contained in each piece of data in List1 and List2 are combined to form entity pairs, and a relationship data list List3 is constructed, in which each piece of data contains an entity pair and its relationship, and a list of electronic component triplets Triplets is obtained. Each triplet is stored in the format of <entity, relationship, entity>.
[0141] B3. Entity alignment. In electronic components, the crawled component data may not be standardized. For this reason, we standardize the electronic component models and align Triplets and Entities according to the electronic component models.
[0142] B4. Knowledge storage: Write Triplets and Entities into the Neo4j graph database for storage and visualization.
[0143] For each batch of new electronic component data crawled, after the above process, an electronic component knowledge graph with substitution relationships can be automatically generated. The attribute value and substitution relationship prediction of more than 90% MRR value ensures the feasibility and high quality of the construction process. According to this process, we built a small-scale electronic component knowledge graph containing 11,000 triples.
[0144] In summary, compared with the prior art, the method of this embodiment has the following beneficial effects:
[0145] This invention is dedicated to the research and implementation of the automatic construction of electronic component knowledge graphs and substitution relationships, and focuses on the two important tasks involved in the knowledge graph construction process: electronic component attribute value prediction and substitution relationship prediction. We collected some foreign electronic component data, used neo4j modeling, built an electronic component knowledge graph, and used the Complex Embedding knowledge reasoning algorithm to perform knowledge reasoning on the electronic component knowledge graph, and obtained good results in reasoning performance, and obtained a relatively good attribute value and substitution relationship prediction model. Based on this, we have implemented a high-quality electronic component knowledge reasoning and knowledge graph automatic construction process, and built a small-scale electronic component knowledge graph, which has played an important role in creating knowledge graphs, creating databases, and studying substitution relationships in this field.
[0146] Result analysis:
[0147] 1) Performance evaluation indicators
[0148] For knowledge graph reasoning, due to the complexity of knowledge graphs and algorithmic issues, the algorithm performance is still not very good, so we only hope that the correct answer can appear in the first few items of the answer set, and we do not need to get the only correct answer. Therefore, when evaluating the performance of the algorithm, the selected indicators will focus on the position of the correct answer in the answer set, rather than whether the first answer is the correct answer.
[0149] MRR (Mean Reciprocal Rank)
[0150] Before introducing MRR, let's first introduce MR (Mean Rank). Since the prediction process of a triple does not only generate one answer entity, but sorts the answer entity set according to the confidence, the definition of MR is the average order in which the correct answer entity of a triple appears. The formula is defined as follows:
[0151]
[0152] Among them, |Q| represents the number of query sets, and ranki represents the position of the first correct answer in the i-th query. According to the formula, the smaller the value of MR, the better the prediction result. MRR is just the opposite. MRR is also scored based on the position of the correct answer entity in the triple, but the inverse is taken. The formula is defined as follows:
[0153]
[0154] MRR is more intuitive than MR. The larger the MRR value, the earlier the first correct answer entity appears on average. The MRR value falls between 0 and 1, and the performance can be well compared even for different data sets. In reality, when searching, it is more hoped that the correct search results can fall on the first few answer entities, so that the search results calculated by the algorithm are meaningful, rather than letting the correct results fall on the ignored answer entities behind, because for the answer entities behind, it is not so important whether the correct result falls on the 100th or 101st place. Using the method of taking the inverse of the ranking can better reflect this idea, that is, we pay more attention to the front search results, the first few answer entities are more important, the difference should be larger, and the difference of the answer entities behind is smaller.
[0155] HITS@n
[0156] HITS@n is defined as the probability of the correct answer entity appearing in the top n. The formula is defined as follows:
[0157]
[0158] Among them, n represents the number of answer entities to be counted, and ranki represents the position of the first correct answer in the i-th query. In this experiment, three commonly used indicators, HITS@1, HITS@3, and HITS@10, will be used, which are the probabilities of the correct answer appearing in the first 1, first 3, and first 10 answer entities, respectively.
[0159] 2) Model hyperparameter setting and environment configuration
[0160] The present invention uses the Complex Embedding model. For the reliability of the experiment, three models are added for comparison, namely BetaE, GQE and ConvE models. BetaE and GQE are multi-hop question-answering models, and the ConvE model uses convolution for prediction and is a link prediction model.
[0161] The hyperparameters of BetaE include the batch size batch_size of gradient descent, the learning rate lr of gradient descent learning, the negative sampling batch size negative_sample_size, the entity embedding vector dimension embedding dimension, the maximum number of iterations max_steps, the relationship embedding vector dimension and the number of layers beta_mode. According to the hyperparameters used in the BetaE paper to train the model using the FB15k-237 dataset, the hyperparameters set for the BetaE model are shown in Table 3. The hyperparameters of GQE lack beta_mode compared to BetaE, and the other settings are the same.
[0162] Table 3 BetaE model hyperparameter settings
[0163]
[0164] The hyperparameters of the Complex Embedding model include the batch size batch_size of gradient descent, the learning rate lr of gradient descent learning, the number of iterations epochs, and the entity embedding vector dimension embedding dimension, as shown in Table 4.
[0165] Table 4 Complex Embedding model hyperparameter settings
[0166]
[0167] The hyperparameters of the ConvE model include the batch size batch_size of gradient descent, the learning rate lr of gradient descent learning, the number of iterations epochs, the dimension of the entity embedding vector embedding dimension, and the dimension of the transformed matrix embeddingshape, as shown in Table 5.
[0168] Table 5 ConvE model hyperparameter settings
[0169]
[0170] The settings of hyperparameters are obtained by referring to the settings and tuning of the original paper.
[0171] This experiment was conducted on a personal laptop, and the software and hardware configurations are shown in Table 6 and Table 7 respectively.
[0172] Table 6 Experimental software configuration
[0173]
[0174] Table 7 Experimental hardware configuration
[0175]
[0176] 3) Prediction results and analysis of electronic component attribute values and substitution relationships
[0177] This experiment uses Complex Embedding, BetaE, GQE, and ConvE algorithms to experiment on electronic component data sets. The results are shown in Tables 8 and 9. The results in the tables have reached convergence.
[0178] Table 8 Prediction performance of attribute values
[0179]
[0180] Table 9 Prediction of substitution relationship performance
[0181]
[0182] According to the data in Tables 8 and 9, when predicting attribute values, ComplEx, ConvE, BetaE, and GQE all have relatively good performance, and the ComplEx algorithm has achieved better results in MRR, HITS@1, HIT@3, and HIT@10 performance indicators. Compared with the general MRR and HIT@n values of current knowledge reasoning algorithms, the indicator values in Tables 8 and 9 may be higher due to the difference in data sets, that is, current knowledge reasoning algorithms generally use multi-domain knowledge graphs such as fb15k and NELL that are more difficult to reason, but ComplEx has such high MRR and HIT@n values, indicating that the answer entity can basically be found in front of the answer set, indicating that the prediction result is relatively good and usable.
[0183] Comparing the ComplEx algorithm and the ConvE algorithm with the BetaE and GQE multi-hop question-answering algorithms, it can be seen that the ComplEx and ConvE algorithms have better prediction performance on the electronic component knowledge graph, with a performance difference of nearly 0.2 in MRR, HIT@1, and HIT@3. This embodiment provides two explanations. The first explanation is that the current electronic component knowledge graph has relatively few entities and relationships, the scale of the knowledge graph is relatively small, and the reasoning performed in this embodiment is single-step reasoning. The multi-hop question-answering reasoning model should be good at converting complex queries into simple vector representations, so that the query speed does not slow down with the graph and can discover hidden relationships. However, the scale of the knowledge graph constructed in this embodiment is relatively small, and the advantages of the multi-hop question-answering reasoning model are not brought into play. The second explanation is that the multi-hop question-answering reasoning model is not very good at link prediction. In the multi-hop question-answering reasoning model, the model only trains the logical operators of the query based on the relationship, rather than directly modeling the relationship. It can only discover simple hidden relationships in a part of the sparse knowledge graph, but cannot discover too complex relationships. The prediction ability is relatively low, and the more prominent one is the ability to quickly traverse the knowledge graph to find a suitable answer set. The ComplEx and ConvE algorithms are pure link prediction algorithms. They focus on the accuracy of triple prediction in model optimization. At the same time, the graph scale of this experiment is relatively small, and the parameters are easy to learn, which makes it perform better in this data set. As for the better performance of the ComplEx algorithm than the ConvE algorithm, it may be that the importance of semantic similarity is not that high, so the simpler ComplEx can perform better.
[0184] According to the comparison between Table 8 and Table 9, it can be seen that the prediction of substitution relationship by the algorithm is a little more difficult than the prediction of attribute value. This may be because the number of attributes of attribute value is relatively small, that is, there are fewer nodes and it is easier to classify. In addition, the embedding vector of components is more difficult to learn than the embedding vector of attribute value. Therefore, the prediction of substitution relationship may be worse than the prediction of attribute value.
[0185] In general, using Complex Embedding to predict the attribute values and substitution relationships of electronic components can achieve good results, which is acceptable for the subsequent knowledge graph construction.
[0186] This embodiment also provides an electronic component knowledge reasoning and knowledge graph construction system, including:
[0187] Ontology library construction module, used to build the ontology library;
[0188] A data extraction module is used to obtain electronic component data, pre-process the electronic component data according to the ontology library, and obtain triplet data of the electronic component;
[0189] A model training module, used to construct a relationship extraction model and an entity recognition model, and to train the relationship extraction model and the entity recognition model using the obtained electronic component triple data;
[0190] The data processing module is used to obtain the data to be processed, use the trained relationship extraction model to perform relationship extraction on the data to be processed, and obtain the relationship data list List3; use the trained entity recognition model to perform entity recognition on the data to be processed, and obtain the entity data list List2;
[0191] The triple acquisition module is used to obtain the triple list Triplets according to the relationship data list List3 and the entity data list List2;
[0192] The graph construction module is used to align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and realize the construction of the knowledge graph;
[0193] The entity recognition model performs entity recognition based on the features of components, and the relationship extraction model performs relationship extraction based on the features of components.
[0194] An electronic component knowledge reasoning and knowledge graph construction system of this embodiment can execute an electronic component knowledge reasoning and knowledge graph construction method provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0195] This embodiment also provides an electronic component knowledge reasoning and knowledge graph construction system, including:
[0196] at least one processor;
[0197] at least one memory for storing at least one program;
[0198] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 1 The method shown.
[0199] An electronic component knowledge reasoning and knowledge graph construction system of this embodiment can execute an electronic component knowledge reasoning and knowledge graph construction method provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0200] The present application also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 1 The method shown.
[0201] This embodiment also provides a storage medium storing instructions or programs that can execute a method for electronic component knowledge reasoning and knowledge graph construction provided by an embodiment of the method of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be obtained.
[0202] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0203] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0204] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0205] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0206] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0207] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0208] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0209] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0210] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for electronic component knowledge reasoning and knowledge graph construction, characterized in that: The following steps are involved: Build ontology library; Acquire electronic component data, pre-process the electronic component data according to the ontology library, and acquire triplet data of the electronic component; Constructing a relationship extraction model and an entity recognition model, and using the obtained electronic component triple data to train the relationship extraction model and the entity recognition model; Obtain the data to be processed, use the trained relation extraction model to extract relations from the data to be processed, and obtain a relation data list List3; use the trained entity recognition model to perform entity recognition on the data to be processed, and obtain an entity data list List2; Get the triple list Triplets according to the relationship data list List3 and the entity data list List2; Align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and build the knowledge graph. The entity recognition model and the relationship extraction model are both Complex Embedding models; The entity recognition model and the relationship extraction model are trained in the following way: Convert the entity recognition problem and the relationship extraction problem into a 3D binary tensor completion problem and give the model two input sequences X E1 ={x e1_1 , x e1_2 , …, x e1_n }, X E2 ={x e2_1 , x e2_2 , …, x e2_n }, the corresponding output sequence is Y E ={y e_1 ,y e_2 , …, y e_n }, where n represents the length of the solid feature, x ei_j represents the jth feature of the entity with subscript i, y e_i Represents the output features, and the final result is mapped to the corresponding entity, with E_ and e_ representing the model prediction task prefix; The input sequence is first mapped to the entity feature vector space through the embedding layer, and then input into the defined model. The score of the triple is calculated through the two input sequences and the score function of different corresponding relationships, and the relationship of the triple is judged according to the score; the parameters of the score function of different relationships are different; The final output feature vector Y obtained by the model E Mapping is performed to obtain the corresponding entity or relationship.
2. The method for electronic component knowledge reasoning and knowledge graph construction according to claim 1, characterized in that: In the process of training the entity recognition model and the relationship extraction model, a negative log-likelihood function is used as a loss function, and the loss function is defined as follows: in, is a regularization term added to prevent overfitting; Y rso represents the predicted value of the (s, r, o) triple being true when the parameter is Θ, Y rso ∈(1,-1).
3. The method for electronic component knowledge reasoning and knowledge graph construction according to claim 1, characterized in that: The construction of the ontology library comprises: Confirm that the main body field is the electronic component body; Confirm the ontology terms; Define conceptual attributes, where the attributes include numerical attributes and entity attributes. The numerical attributes include operating voltage, tolerance, size code, lead-free, resistance value, rated power, rated temperature, risk level, temperature coefficient, minimum operating temperature, maximum operating temperature, package length, package width, and package height. Define attribute constraints; The electronic component data is obtained, and the electronic component knowledge instance is constructed according to the defined concept class attributes and the defined attribute constraints to obtain the ontology library.
4. An electronic component knowledge reasoning and knowledge graph construction system, characterized in that: include: Ontology library construction module, used to build the ontology library; A data extraction module is used to obtain electronic component data, pre-process the electronic component data according to the ontology library, and obtain triplet data of the electronic component; A model training module, used to construct a relationship extraction model and an entity recognition model, and to train the relationship extraction model and the entity recognition model using the obtained electronic component triple data; The data processing module is used to obtain the data to be processed, use the trained relationship extraction model to perform relationship extraction on the data to be processed, and obtain the relationship data list List3; use the trained entity recognition model to perform entity recognition on the data to be processed, and obtain the entity data list List2; The triple acquisition module is used to obtain the triple list Triplets according to the relationship data list List3 and the entity data list List2; The graph construction module is used to align the entity table Entities and the triple list Triplets, store the aligned data in the graph database, and realize the construction of the knowledge graph; The entity recognition model and the relationship extraction model are both Complex Embedding models; The entity recognition model and the relationship extraction model are trained in the following way: Convert the entity recognition problem and the relationship extraction problem into a 3D binary tensor completion problem and give the model two input sequences X E1 ={x e1_1 , x e1_2 , …, x e1_n }, X E2 ={x e2_1 , x e2_2 , …, x e2_n }, the corresponding output sequence is Y E ={y e_1 ,y e_2 , …, y e_n }, where n represents the length of the entity feature, x ei_j represents the jth feature of the entity with subscript i, y e_i Represents the output features, and the final result is mapped to the corresponding entity, with E_ and e_ representing the model prediction task prefix; The input sequence is first mapped to the entity feature vector space through the embedding layer, and then input into the defined model. The score of the triple is calculated through the two input sequences and the score function of different corresponding relationships, and the relationship of the triple is judged according to the score; the parameters of the score function of different relationships are different; The final output feature vector Y obtained by the model E Mapping is performed to obtain the corresponding entity or relationship.
5. An electronic component knowledge reasoning and knowledge graph construction system, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 3.
6. A storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 3 when executed by the processor.
Citation Information
Patent Citations
Method for discovering spatial relationship between attributes and categories of electronic components
CN111881934A
Knowledge graph retrieval method and system based on knowledge base representation
CN114218372A