Knowledge graph construction model training method, electronic equipment and storage medium

By using the bat algorithm to update the prediction loss function in the training method of the knowledge graph construction model, the problem of poor training effect of neural network models in the prediction of knowledge graph relationships is solved, and the accuracy of knowledge graph relationship prediction and feedback information are significantly improved.

CN119537610APending Publication Date: 2025-02-28PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411697761.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, neural network models have poor training effects in knowledge graph relationship prediction, resulting in low accuracy of knowledge graph relationship prediction, affecting the accuracy of feedback information.

Method used

A training method for building a knowledge graph model is proposed. By obtaining the training data set, inputting the original model for iterative training, and updating the prediction loss function using the bat algorithm to improve the accuracy of the prediction of knowledge graph relationships.

Benefits of technology

Through this method, the accuracy of knowledge graph relationship prediction is significantly improved, and the accuracy of feedback information is thus improved, especially in areas such as intelligent customer service and financial transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537610A_ABST
    Figure CN119537610A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, intelligent customer service and financial transaction, in particular to a training method of a knowledge graph construction model, electronic equipment and a storage medium. In business scenes of intelligent customer service, financial transaction and the like, a conversation robot and an intelligent customer service assistant are often utilized to provide corresponding services for each object, and the provision of the services often depends on a constructed knowledge graph. According to the training method of the knowledge graph construction model, the training data set needs to be acquired firstly. Inputting the training data set into a preset original model, and performing iterative training on the original model based on the training entity data and the triple tag; and in each round of iterative training, a prediction loss function of the original model is updated through a bat algorithm. When the original model meets the first preset condition in iterative training, the knowledge graph construction model is obtained, the accuracy of knowledge graph relation prediction can be improved, and then the accuracy of information fed back to the object is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence, intelligent customer service, and financial transaction technology, and in particular to a training method, electronic device, and storage medium for a knowledge graph construction model. Background Art

[0002] A knowledge graph (KG) is a structured knowledge base. Its essence is a directed graph with labels. Each node in the graph represents an entity, and each edge represents a relationship, represented by a standard triple (s, r, o), where s and o are the head and tail entities respectively, and r is the relationship between s and o. Knowledge graphs are widely used in many scenarios, such as semantic search, intelligent question and answer, and decision support. However, although the creation and maintenance of knowledge graphs are very costly, even the largest knowledge graphs face problems such as data sparsity and missing data. Therefore, in order to make the knowledge graph more complete and accurate, it must be continuously expanded and improved so that the knowledge graph model can be continuously constructed.

[0003] In business scenarios such as intelligent customer service and financial transactions, conversational robots and intelligent customer service assistants are often used to provide corresponding services to various parties. During the specific service process, conversational robots and customer service assistants often use the relationships between entities in the knowledge graph to implement intelligent question-and-answer or information retrieval to improve the accuracy of the information fed back to the party. Based on this, some related technologies attempt to use neural network models to continuously build knowledge graphs for business scenarios such as intelligent customer service and financial transactions. However, the loss function used in the neural network model training process is relatively fixed, making it difficult to achieve optimal training results. This leads to low accuracy in predicting knowledge graph relationships, affecting the accuracy of the information fed back to the party. Summary of the Invention

[0004] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes a training method, electronic device, and storage medium for a knowledge graph construction model that can improve the accuracy of knowledge graph relationship predictions and, thereby, improve the accuracy of information fed back to the subject.

[0005] The training method for a knowledge graph construction model according to the first embodiment of the present application includes:

[0006] Obtaining a training data set, wherein the training data set includes training entity data and triple labels, wherein the training entity data comes from a preset question-answering database or an information retrieval database;

[0007] Inputting the training data set into a preset original model, and iteratively training the original model based on the training entity data and the triplet label; in each round of iterative training, updating the prediction loss function of the original model through the bat algorithm;

[0008] When the original model meets the first preset condition in iterative training, the knowledge graph construction model is obtained, wherein the knowledge graph construction model is used to perform relationship prediction on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on the entities and the entity relationships, and the knowledge graph is used for dialogue generation or information retrieval.

[0009] According to some embodiments of the present application, inputting the training data set into a preset original model, and iteratively training the original model based on the training entity data and the triplet label includes:

[0010] In each round of iterative training, the triplet prediction result and the triplet label are substituted into a prediction loss function with a loss weight to calculate a first loss value; wherein the triplet prediction result is obtained by the original model performing relationship prediction on the training entity data;

[0011] Updating the loss weight by a preset bat algorithm;

[0012] The prediction loss function is updated based on the updated loss weight.

[0013] According to some embodiments of the present application, the bat algorithm is used to simulate the solution of the loss weight based on the bat position of the virtual bat, and updating the loss weight by the bat algorithm includes:

[0014] Obtain bat simulation parameters for the current iteration round, the bat simulation parameters including the loss weight, bat speed, bat sound wave frequency, bat sound wave emission rate, and bat sound wave loudness;

[0015] Perform speed update calculation based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed, and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed in the next iteration round;

[0016] Comparing the bat sound wave emission rate with a pre-acquired first random number to obtain a first comparison result;

[0017] The loss weight is updated and calculated based on the loudness of the bat sound wave, the bat speed in the next iteration round, and the first comparison result to obtain the loss weight in the next iteration round.

[0018] According to some embodiments of the present application, performing a weight update calculation on the loss weight based on the loudness of the bat sound wave, the bat speed of the next iteration round, and the first comparison result to obtain the loss weight of the next iteration round includes:

[0019] Performing candidate update calculation on the loss weight based on the first comparison result to obtain a candidate update weight;

[0020] Substituting the triplet prediction result and the triplet label into the prediction loss function with the candidate update weight for calculation to obtain a second loss value;

[0021] Based on the bat sound wave loudness, the first loss value, and the second loss value, determining whether the candidate update weight meets a preset update condition;

[0022] When the candidate update weight satisfies the update condition, the candidate update weight is determined as the loss weight for the next iteration round.

[0023] According to some embodiments of the present application, performing candidate update calculation on the loss weight based on the first comparison result to obtain the candidate update weight includes:

[0024] When the first comparison result is that the bat sound wave emission rate is greater than the first random number, the loss weight of the current iteration round is updated based on the bat speed of the next iteration round to obtain the candidate update weight.

[0025] According to some embodiments of the present application, performing candidate update calculation on the loss weight based on the first comparison result to obtain the candidate update weight includes:

[0026] When the first comparison result is that the bat sound wave emission rate is less than or equal to the first random number, a weight update increment is obtained based on the product operation of the average sound wave loudness and the pre-acquired second random number; wherein the average sound wave loudness is the average of the multiple bat sound wave loudnesses;

[0027] Perform a candidate update on the loss weight of the current iteration round based on the weight update increment to obtain the candidate update weight.

[0028] According to some embodiments of the present application, judging whether the candidate update weight meets a preset update condition based on the bat sound wave loudness, the first loss value, and the second loss value includes:

[0029] When the bat sound wave loudness is greater than a pre-acquired third random number, and the first loss value is greater than the second loss value, determining that the candidate update weight meets the preset update condition;

[0030] When the bat sound wave loudness is less than or equal to the third random number, it is determined that the candidate update weight does not meet the preset update condition; or when the first loss value is less than or equal to the second loss value, it is determined that the candidate update weight does not meet the preset update condition.

[0031] According to some embodiments of the present application, performing speed update calculation based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed, and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed in the next iteration round includes:

[0032] Subtracting the loss weight from the optimal weight in the current iteration round to obtain a weight comparison difference;

[0033] Performing a product operation based on the weighted comparison difference and the bat sound wave frequency to obtain a speed update increment;

[0034] The bat speed of the next iteration round is obtained by performing a sum operation based on the bat speed of the current iteration round and the speed update increment.

[0035] In the second aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the training method for the knowledge graph construction model as described in any one of the embodiments of the first aspect of the present application.

[0036] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement a training method for a knowledge graph construction model as described in any one of the embodiments of the first aspect of the present application.

[0037] The training method, electronic device, and storage medium of the knowledge graph construction model according to the embodiments of the present application have at least the following beneficial effects:

[0038] The training method of the knowledge graph construction model of the present application requires first obtaining a training data set, which includes training entity data and triple labels, and the training entity data comes from a preset question-and-answer database or an information retrieval database. The training data set is then input into the preset original model, and the original model is iteratively trained based on the training entity data and triple labels; in each round of iterative training, the prediction loss function of the original model is updated by the bat algorithm. When the original model meets the first preset condition in the iterative training, a knowledge graph construction model is obtained, wherein the knowledge graph construction model is used to perform relationship prediction on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on entities and entity relationships, and the knowledge graph is used for dialogue generation or information retrieval. Through the training method of the knowledge graph construction model of the present invention, the accuracy of the knowledge graph relationship prediction can be improved, thereby improving the accuracy of the information fed back to the object. In business scenarios such as intelligent customer service and financial transactions, applying the above-mentioned knowledge graph construction model training method to train the knowledge graph construction model can specifically improve the accuracy of the knowledge graph construction model in predicting knowledge graph relationships in the fields of intelligent customer service and financial transactions, so that in the specific service process, conversational robots and customer service assistants can better utilize the relationships between entities in the knowledge graph to realize intelligent question and answer or information retrieval, so as to improve the accuracy of the information fed back to the object.

[0039] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0041] Figure 1 A flowchart of a knowledge graph construction model training method provided in an embodiment of the present application;

[0042] Figure 2 for Figure 1 Flow diagram of step S102;

[0043] Figure 3 for Figure 2 Flow diagram of step S202;

[0044] Figure 4 for Figure 3 Flow diagram of step S302;

[0045] Figure 5 for Figure 3 Flow diagram of step S304;

[0046] Figure 6 for Figure 5 Flow chart of step S501;

[0047] Figure 7 for Figure 5 Flow diagram of step S503;

[0048] Figure 8 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following describes embodiments of the present application in detail. 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 application and are not to be construed as limiting the present application.

[0050] In the description of this application, it should be understood that descriptions involving orientations, such as up, down, left, right, front, and back, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing this application 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. Therefore, they cannot be understood as limitations on this application.

[0051] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples" 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 application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0052] In the description of this application, it should be noted that, unless otherwise explicitly defined, terms such as "set," "install," and "connect" should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution. In addition, the identification of specific steps below does not represent a limitation on the order of steps and execution logic. The execution order and execution logic between each step should be understood and inferred with reference to the content described in the embodiments.

[0053] A knowledge graph (KG) is a structured knowledge base. Its essence is a directed graph with labels. Each node in the graph represents an entity, and each edge represents a relationship, represented by a standard triple (s, r, o), where s and o are the head and tail entities respectively, and r is the relationship between s and o. Knowledge graphs are widely used in many scenarios, such as semantic search, intelligent question and answer, and decision support. However, although the creation and maintenance of knowledge graphs are very costly, even the largest knowledge graphs face problems such as data sparsity and missing data. Therefore, in order to make the knowledge graph more complete and accurate, it must be continuously expanded and improved so that the knowledge graph model can be continuously constructed.

[0054] Relation Prediction (RP) is a key issue faced in the continuous construction of knowledge graphs. Its goal is to predict the type of relationship that may exist between a given head entity and a tail entity. It should be noted that relationship prediction can include completing missing relationships between entities and constructing unknown relationships between entities. The main task of the continuous construction of knowledge graphs is link prediction, that is, using the existing information in the knowledge graph to predict whether there are hidden relationships between unrelated entities.

[0055] In business scenarios such as intelligent customer service and financial transactions, conversational robots and intelligent customer service assistants are often used to provide corresponding services to various parties. During the specific service process, conversational robots and customer service assistants often use the relationships between entities in the knowledge graph to implement intelligent question-and-answer or information retrieval to improve the accuracy of the information fed back to the party. Based on this, some related technologies attempt to use neural network models to continuously build knowledge graphs for business scenarios such as intelligent customer service and financial transactions. However, the loss function used in the neural network model training process is relatively fixed, making it difficult to achieve optimal training results. This leads to low accuracy in predicting knowledge graph relationships, affecting the accuracy of the information fed back to the party.

[0056] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes a training method, electronic device, and storage medium for a knowledge graph construction model that can improve the accuracy of knowledge graph relationship predictions and, thereby, improve the accuracy of information fed back to the subject.

[0057] Further description will be given below with reference to the accompanying drawings.

[0058] Reference Figure 1 The training method for constructing a knowledge graph model provided in this application may include, but is not limited to, the following steps S101 to S103.

[0059] Step S101: obtaining a training data set, the training data set including training entity data and triple labels, the training entity data coming from a preset question-answering database or an information retrieval database;

[0060] Step S102: Input the training data set into the preset original model, and iteratively train the original model based on the training entity data and triplet labels; in each round of iterative training, the prediction loss function of the original model is updated using the bat algorithm;

[0061] Step S103: When the original model meets the first preset condition in iterative training, a knowledge graph construction model is obtained, wherein the knowledge graph construction model is used to perform relationship predictions on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on the entities and entity relationships. The knowledge graph is used for dialogue generation or information retrieval.

[0062] The training method of the knowledge graph construction model of the present application shown in steps S101 to S103 requires first obtaining a training data set, which includes training entity data and triple labels, and the training entity data comes from a preset question-and-answer database or an information retrieval database. The training data set is then input into the preset original model, and the original model is iteratively trained based on the training entity data and triple labels; in each round of iterative training, the prediction loss function of the original model is updated by the bat algorithm. When the original model meets the first preset condition in the iterative training, a knowledge graph construction model is obtained, wherein the knowledge graph construction model is used to perform relationship prediction on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on the entities and entity relationships, and the knowledge graph is used for dialogue generation or information retrieval. In business scenarios such as intelligent customer service and financial transactions, applying the above-mentioned knowledge graph construction model training method to train the knowledge graph construction model can specifically improve the accuracy of the knowledge graph construction model in predicting knowledge graph relationships in the fields of intelligent customer service and financial transactions, so that in the specific service process, conversational robots and customer service assistants can better utilize the relationships between entities in the knowledge graph to realize intelligent question and answer or information retrieval, so as to improve the accuracy of the information fed back to the object.

[0063] In business scenarios such as intelligent customer service and financial transactions, conversational robots and intelligent customer service assistants are often used to provide corresponding services to various entities. During the specific service process, conversational robots and customer service assistants often use the relationships between entities in the knowledge graph to implement intelligent question-and-answer or information retrieval to improve the accuracy of the information fed back to the entity. It should be noted that in business scenarios such as intelligent customer service and financial transactions, there are some specialized terms that are only used in certain fields. Because the relationships between these specialized terms are often only reflected in specific fields, the accuracy of traditional neural network models in predicting entity relationships for these specialized terms will be relatively low. In business scenarios such as intelligent customer service and financial transactions, applying the above-mentioned knowledge graph construction model training method to train the knowledge graph construction model can specifically improve the accuracy of the knowledge graph construction model in predicting knowledge graph relationships in fields such as intelligent customer service and financial transactions.

[0064] Steps S101 to S103 are explained in detail below.

[0065] In step S101, a training data set is obtained. The training data set includes training entity data and triple labels. The training entity data comes from a preset question-and-answer database or an information retrieval database. It should be emphasized that the training data set includes training entity data and triple labels. The training entity data can come from a preset question-and-answer database or an information retrieval database. Among them, the training entity data can be an entity extracted from a preset question-and-answer database or an information retrieval database. It should be noted that an entity refers to a specific thing in the objective world, such as a person, a city, a plant, a commodity, etc. Everything in the world is composed of specific things, which refers to entities. Entities are the most basic elements in the knowledge graph. Different entities have different relationships. In some embodiments of the present application, the relationship between entities is referred to as an entity relationship. In some embodiments, the triple label includes the entity relationship between two entities in the training entity data, and is represented by a standard triple (s, r, o), where s and o are the head entity and the tail entity, respectively, and r is the entity relationship between s and o. It should be understood that the triple labels in the training dataset can describe the entity relationship between any two entities in the training entity data based on the differences between their head entity, tail entity, and entity relationship. It should be made clear that the training dataset is the data foundation for training the knowledge graph construction model, and the purpose of training the knowledge graph construction model is to improve the entity relationship prediction ability of the knowledge graph construction model. Therefore, using each entity as a training sample, the triple label as the training label, and inputting the training entity data into the original model for iterative training will help improve the knowledge graph construction model's ability to accurately extract and construct entity relationships from each entity.

[0066] In some specific implementations, in business scenarios such as intelligent customer service and financial transactions, conversational robots and intelligent customer service assistants are often used to provide corresponding services to various entities. During the specific service process, conversational robots and customer service assistants often use the relationships between entities in the knowledge graph to implement intelligent question-and-answer or information retrieval, thereby improving the accuracy of the information fed back to the subject. Therefore, the training dataset can extract some specific things from business scenarios such as intelligent customer service and financial transactions, and incorporate them as entities into the training entity data. The entity relationships between each entity are then annotated manually or by machine, thereby combining the entities to form triple labels.

[0067] In some more specific embodiments, the financial data required to construct triple labels in the financial knowledge graph generally includes tabular basic securities information, price and volume information, and fundamental quantitative indicators. A clear data structure not only greatly facilitates triple label construction, but also makes the resulting triple labels more accurate than unstructured data. High-quality triple labels can significantly improve accuracy and efficiency. In addition to directly acquired financial data itself, derived data calculated from this data is also an important source of "entities" or "relationships" in the triple label construction process. For example, correlation coefficients and cointegration coefficients between tradable securities. Preserving the time-varying nature of this information enables a more objective description of financial markets. In the financial field, the most core entities are companies, tradable securities, and macroeconomic indicators; the most valuable relationships are often related to information that influences company performance or tradable securities prices. However, relying solely on prior knowledge in the financial field and connecting entities using traditional association methods cannot maximize the effectiveness of knowledge graphs. Associating "entities" and "relationships" useful in other fields can effectively expand the boundaries of knowledge graphs and reveal hidden information. Taking industrial chain construction as an example, if we directly mine company financial statements and public announcements, we can only identify financial or equity connections between companies. However, if we can identify a company's core products and leverage the upstream and downstream relationships between other industry products, we can connect companies at different upstream and downstream levels of the industry, thereby creating a better industrial chain structure.

[0068] It should be understood that there are various ways to obtain the training data set, which may include, but not be limited to, the specific embodiments listed above.

[0069] In step S102, the training dataset is input into a preset original model, and the original model is iteratively trained based on the training entity data and triple labels. During each round of iterative training, the prediction loss function of the original model is updated using the Bat Algorithm. It should be noted that the preset original model refers to a pre-set neural network model used for graph structure modeling. It should be emphasized that knowledge graphs can include a large number of triples (head entity, entity relationship, tail entity) and are widely used in many fields, such as intelligent customer service and financial transactions. Graph Convolutional Neural Networks (GCN) are similar to Convolutional Neural Networks (CNN), except that while Convolutional Neural Networks are used to process two-dimensional data structures, Graph Convolutional Neural Networks are used to process graph data structures. The role of Graph Convolutional Neural Networks can actually be understood in a similar way to that of Convolutional Neural Networks, as a feature extractor, except that its object is graph data. Graph Convolutional Neural Networks design a method for extracting features from graph data, which can be used to perform node classification, graph classification, edge prediction, and even obtain an embedded representation of the graph. Entities are considered nodes in the knowledge graph, and entity relationships are considered edges. Nodes are connected by edges, and two nodes on the same edge are considered adjacent nodes. Therefore, using a graph convolutional neural network as the original model is an optional embodiment of this application, which has the advantage of improving the efficiency of knowledge graph construction.

[0070] The pre-trained Relational Graph Convolutional Network (R-GCN) is a graph convolutional neural network developed specifically for processing the highly multi-relational data characteristics of real-world knowledge bases. It is more suitable for graph modeling of knowledge graphs. Therefore, determining the relational graph convolutional neural network as the original model is also an optional embodiment of this application. The advantage of this embodiment is that it can further improve the efficiency of knowledge graph construction.

[0071] In some more specific embodiments of the present application, the basic idea of ​​the graph convolutional neural network is: in the process of constructing the knowledge graph, in order to calculate the graph embedding representation data (embedding) of the next node, it is necessary to take out the graph embedding representation data of the previous node and the graph embedding representation data of other adjacent nodes, and multiply these graph embedding representation data with the change weight matrix to be learned by the graph convolutional neural network, and then multiply them by the unit matrix and the normalization matrix. The graph embedding representation data of each layer uses the same change weight matrix, which is analogous to convolution. The basic idea of ​​the relational graph convolutional neural network is: the various edges of the heterogeneous graph are divided into different types, and one entity relationship corresponds to one graph, so that the edges on each graph are of the same type. Then, according to the idea of ​​the aforementioned graph convolutional neural network, the graph embedding representation data of the next node is obtained by changing the weight matrix, and finally the graph embedding representation data corresponding to all the next nodes are fused, configured with the corresponding weights, and then activated by the ReLU function.

[0072] It should be understood that there are various optional types of original models, which may include, but not be limited to, the specific embodiments listed above.

[0073] It should be noted that the purpose of iterative training of the original model based on the training entity data and triple labels is to improve the entity relationship prediction ability of the knowledge graph construction model. During iterative training, a loss function is needed to evaluate the training effect of the current iteration round on the knowledge graph construction model. In some embodiments, when the loss value corresponding to the loss function reaches a preset condition, the model of the current iteration round can be output. However, if the loss function used in the training of the knowledge graph construction model is relatively fixed, it is difficult to achieve a better training effect, which will lead to low accuracy in the prediction of the knowledge graph relationship and affect the accuracy of the information fed back to the object. Therefore, in some embodiments provided in the present application, each round of iterative training needs to update the prediction loss function of the original model, and then further use the updated prediction loss function to evaluate the training effect of the current iteration round on the knowledge graph construction model.

[0074] The Bat Algorithm (BA) is a heuristic search algorithm based on swarm intelligence and an effective method for searching for the global optimal solution. This algorithm is an iterative optimization technique that initializes with a set of random solutions and then iteratively searches for the optimal solution. Random flight around the optimal solution generates new local solutions, enhancing local search. Specifically, the Bat Algorithm simulates the sonar used by bats in nature to detect prey and avoid obstacles. This simulates the basic ultrasonic detection and location capabilities of bats and links them to the optimization objective. The Bat Algorithm's biomimetic principle maps individual bats into several feasible solutions in a multidimensional problem space. The optimization and search process is modeled as the movement of individual bats in a swarm, searching for prey. The fitness function of the problem is used to measure the quality of the bats' positions. The survival of the fittest among individuals is analogous to the iterative process of replacing inferior feasible solutions with better ones during the optimization and search process. Applying the Bat Algorithm to iterative training of the original model, the Bat Algorithm updates the original model's prediction loss function, allowing for rapid identification of the optimal loss weight. The optimal model parameters are trained for different knowledge graph entity and relationship data sets, thereby further improving the accuracy of the knowledge graph construction model and the efficiency of entity relationship prediction. Especially when applied to large knowledge graph sets (such as Yago, DBPedia, etc.), the missing relationships between entities can be completed and unknown relationships can be predicted with higher efficiency and accuracy, ultimately achieving the best knowledge graph completion effect.

[0075] Reference Figure 2 According to some embodiments of the present application, step S102 may include but is not limited to the following steps S201 to S203.

[0076] Step S201: In each round of iterative training, the triplet prediction result and the triplet label are substituted into a prediction loss function with a loss weight to calculate a first loss value; wherein the triplet prediction result is obtained by performing relationship prediction on the training entity data by the original model;

[0077] Step S202, updating the loss weight using a preset bat algorithm;

[0078] Step S203: Update the prediction loss function based on the updated loss weight.

[0079] Steps S201 to S203 are further explained below.

[0080] In step S201, in each round of iterative training, the triple prediction result and the triple label are substituted into the prediction loss function with loss weight for calculation to obtain a first loss value; wherein, the triple prediction result is obtained by the original model performing relationship prediction on the training entity data. It should be noted that the original model performs relationship prediction on the training entity data, which specifically refers to extracting a pair of entities from the training entity data for relationship prediction, obtaining a predicted entity relationship, and forming a predicted triple based on the pair of entities and the predicted entity relationship, wherein the predicted triple can be used as the triple prediction result. It should be pointed out that the prediction loss function is used to evaluate the training effect of the current iteration round on the knowledge graph construction model, wherein the prediction loss function has a loss weight.

[0081] It's important to note that the loss weight of a loss function is a key concept in machine learning, used to measure the fit between different models. When training a model, the loss function affects the parameters, thereby affecting the accuracy of the model's predictions. Therefore, the loss weight of the loss function is crucial to model accuracy. First, the loss weight of the loss function is a parameter of the trained model, determining how well the model fits multiple inputs. For example, for a multivariate model, the loss weight parameter of its loss function is the model's parameter. The size and precision of the parameter directly impact the model's accuracy. If the parameter value is set too low, the model will not accurately fit the given input; conversely, if the parameter is set too high, the model is likely to overfit, incorporating unnecessary noise into the model as data. Therefore, during training, the loss function parameters must be appropriately set to ensure model accuracy. Secondly, the loss weight of the loss function is also crucial to model robustness. Robustness refers to the degree to which a model responds to changes in the input data, specifically, how much the model deviates when encountering new data (i.e., data not in the training set). If the loss function parameters are set too low, the model will be susceptible to noise in the training data and will exhibit significant deviations when faced with new data. Therefore, setting appropriate loss function parameters can make the model more robust and more adaptable to new data. Finally, when adjusting the loss function parameters, computational complexity must also be considered. Because the loss function parameters control the model's fitting ability, if the parameters are set too low, the model will require a significant amount of time to find appropriate parameter values ​​during training, which is known as "optimization." Therefore, when training a model, in addition to considering accuracy and robustness, it is also important to pay special attention to whether parameter adjustments increase computational complexity. Clearly, the loss function's loss weight determines the model's accuracy, robustness, and computational complexity. Therefore, when training a model, it is important to precisely set the loss function's loss weight to ensure good model performance.

[0082] In step S202 to step S203, the loss weight is updated by the preset bat algorithm, and then the prediction loss function is updated based on the updated loss weight. It should be clarified that the preset bat algorithm refers to the bat algorithm with pre-set algorithm logic. It should be emphasized that there are some solutions in the related art that use neural network models to continuously construct knowledge graphs. However, the loss function used in training neural network models is relatively fixed, and it is difficult to achieve better training results, which will lead to low accuracy in predicting knowledge graph relationships and affect the accuracy of information fed back to the object. Therefore, some embodiments of the present application apply the bat algorithm to update the loss weight. Each round of iterative training requires updating the prediction loss function of the original model through the bat algorithm. Specifically, the loss weight of the prediction loss function is updated by the bat algorithm, and the updated prediction loss function is further used to evaluate the training effect of the current iteration round on the knowledge graph construction model.

[0083] The embodiment of the present application shown in steps S201 to S203 should be pointed out that, because the loss weight of the prediction loss function determines the accuracy, robustness and computational complexity of the model, applying the bat algorithm to update the loss weight can efficiently optimize the original model in several rounds of iterative training, thereby ultimately obtaining a knowledge graph construction model with high accuracy and high prediction efficiency.

[0084] Reference Figure 3 According to some embodiments of the present application, the bat algorithm is used to simulate the solution of the loss weight based on the bat position of the virtual bat. Step S202 of updating the loss weight through the bat algorithm may specifically include, but is not limited to, the following steps S301 to S304.

[0085] Step S301, obtaining bat simulation parameters of the current iteration round, the bat simulation parameters including loss weight, bat speed, bat sound wave frequency, bat sound wave emission rate and bat sound wave loudness;

[0086] Step S302, performing speed update calculation based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed, and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed for the next iteration round;

[0087] Step S303, comparing the bat sound wave emission rate with a pre-acquired first random number to obtain a first comparison result;

[0088] Step S304 , performing weight update calculation on the loss weight based on the loudness of the bat sound waves, the bat speed of the next iteration round, and the first comparison result to obtain the loss weight of the next iteration round.

[0089] The following is an explanation of the principle of the bat algorithm:

[0090] In order to more conveniently simulate how bats detect prey and avoid obstacles during their random search, we need to assume the following three approximate or idealized rules:

[0091] First, all bats use echolocation to sense distance;

[0092] Second, the bat flies randomly at position Xi and speed Vi with a fixed frequency f, and automatically adjusts the wavelength and pulse loudness according to the distance between itself and the prey;

[0093] Third, assume that the pulse loudness changes from a maximum value A0 to a fixed minimum value Amin, and the change range is adjusted according to the problem.

[0094] It's important to note that each virtual bat flies at a random speed Vi to a position Xi (the solution to the problem), and has a different wavelength, loudness Ai, and pulse emission rate r. As the bat hunts and finds prey, it varies the frequency, loudness, and pulse emission rate, selecting the optimal solution until the target stops or a condition is met. This essentially uses tuning techniques to control the dynamic behavior of the bat colony, balancing and adjusting algorithm-related parameters to achieve the optimal bat algorithm. Testing on multiple standard test functions demonstrates its promising application to continuous optimization problems.

[0095] The above is an explanation of the principle of the bat algorithm.

[0096] Steps S301 to S304 are further described below.

[0097] In some more specific embodiments, if the total number of bats is n, the i-th bat (i=1, 2, 3, ..., n) can be expressed as:

[0098] α i (t),v i (t),f ri (t),A i (t),r i (t)

[0099] The bat position of the i-th bat in the t-th iteration is denoted as α i (t)=(α i1 (t),α i2 (t),...,α ik (t),...,α iD (t)), α i In (t), 1, 2, ..., k, ..., D represent the dimensions of the bat's position.

[0100] The speed of the i-th bat in the t-th generation is expressed as vi (t)=(v(t),v i2 (t),...,v ik (t),...,v iD (t)), v i In (t), 1, 2, ..., k, ..., D represent the dimensions of the bat's velocity.

[0101] The bat frequency of the i-th bat in the t-th iteration round is denoted as f ri (t), where f ri (t) = f rmin +(f rmax -f rmin )·rand1. It should be noted that f rmax The preset maximum frequency value and f rmin is the preset minimum frequency value, and rand f is a random number uniformly distributed in [0,1]. It should be noted that the bat frequency f ri (t) is a fixed value, the bat frequency f ri There are many ways to determine (t), which can be to select the minimum frequency value f rmin To determine the bat frequency f ri (t), or it can be based on the minimum frequency value f rmin With the maximum frequency f rmax To determine the bat frequency f ri (t), as in the above example. It should be understood that determining the bat frequency f ri The method of (t) is not limited to the above examples.

[0102] The loudness of the i-th bat in the t-th iteration is represented by A i (t); the firing rate of the i-th bat in the t-th iteration is denoted as r i (t).

[0103] It is important to emphasize that the bat algorithm is used to simulate the solution of the loss weight based on the bat position where the virtual bat is located.

[0104] In step S301, the bat simulation parameters for the current iteration are obtained. These parameters include loss weight, bat speed, bat sound wave frequency, bat sound wave emissivity, and bat sound wave loudness. It should be noted that the bat algorithm is used to update the loss weight, and the process of solving the loss weight needs to be simulated as the process of locating a virtual bat. The bat simulation parameters refer to the various parameters involved in this simulation process.

[0105] In some more specific embodiments, when the current iteration round is the t-th iteration round, the loss weight is expressed as the bat position α of the i-th bat i(t), the bat speed is expressed as the speed of the i-th bat v i (t), the bat sound wave frequency is expressed as the bat frequency f of the i-th bat ri (t), the bat sound wave emission rate is expressed as the emission rate r of the i-th bat i (t).

[0106] In step S302, a speed update calculation is performed based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed of the next iteration round. It should be noted that the speed update calculation is performed based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed and the optimal weight determined in the iteration round before the current iteration round, and its purpose is to obtain the bat speed of the next iteration round. Among them, the bat speed of the next iteration round is the necessary information required to determine the loss weight of the next iteration round. Therefore, the speed update calculation is used to provide a data basis for the calculation of the loss weight of the next iteration round. It should be pointed out that the optimal weight determined in the iteration round before the current iteration round needs to be taken from several iteration rounds before the current iteration round.

[0107] In some embodiments, the tth iteration round includes t-1 iteration rounds, and each iteration round includes predictions of bat positions for multiple bats, or predictions of multiple loss weights. For example, in the first iteration round, α1(1), α2(1), ..., α k (1) The solution of k loss weights; for example, in the second iteration, we can get α1(2), α2(2), ..., α m (2) The solution of m loss weights; for example, in the t-1th iteration round, we can get α1(t-1), α2(t-1), ..., α j (t-1) such a solution for j loss weights. Then, the number of loss weights obtained in the iterations before the current iteration is k+m+...+j. The optimal weight determined from the iterations before the current iteration can be the loss weight that best meets the preset requirements from the k+m+...+j loss weights, and this is used as the optimal weight.

[0108] It should be pointed out that if the multiple loss weights obtained in several iterations before the current iteration are called alternative weights, then each of the alternative weights corresponds to a certain prediction loss function, and each iteration will calculate the prediction loss value based on the prediction loss function. Therefore, based on the size of the prediction loss value, it can be judged whether the alternative weight corresponding to the prediction loss value meets the preset requirements. For example, in the several iterations before the current iteration, there are a total of k+m+...+j alternative weights mentioned above, and each alternative weight corresponds to a prediction loss function, and also corresponds to a set of prediction loss values. Determine the prediction loss function corresponding to the minimum prediction loss value. If the prediction loss function includes the loss weight α1(t-1), it means that α1(t-1) is the optimal weight before the tth iteration.

[0109] According to some more specific embodiments of the present application, step S302 may include but is not limited to the following steps S401 to S403.

[0110] Step S401: Subtract the loss weight of the current iteration round from the optimal weight to obtain a weight comparison difference.

[0111] Step S402, performing a product operation based on the weighted comparison difference and the bat sound wave frequency to obtain a speed update increment;

[0112] Step S403 , performing a sum operation based on the bat speed of the current iteration round and the speed update increment to obtain the bat speed of the next iteration round.

[0113] In step S401, the loss weight of the current iteration round is subtracted from the optimal weight to obtain the weight comparison difference. It should be noted that the optimal weight before the current iteration round is represented as p k (t), then the weighted comparison difference can be expressed as α ik (t)-p k (t).

[0114] In step S402, the speed update increment is obtained by multiplying the weighted comparison difference with the bat sound wave frequency. ri (t), so based on the weighted comparison difference α ik (t)-p k (t) and bat sound wave frequency f ri (t) is multiplied to obtain the speed update increment (α ik (t)-p k (t))·f ri (t).

[0115] In step S403, the bat speed of the current iteration round is summed with the speed update increment to obtain the bat speed of the next iteration round. It should be noted that the bat speed of the next iteration round is summed with the speed update increment to obtain the bat speed of the current iteration round, which can be expressed as:

[0116] v ik (t+1)=v ik (t)+(α ik (t)-p k (t))·f ri (t)

[0117] It should be clear that the best weight before the current iteration round is expressed as p k (t) can be determined from the historical loss weight p(t) before the current iteration round. Where p(t)=(p(t),p2(t),...,p k (t),...,p D (t)).

[0118] In steps S303 to S304, the bat sound wave emission rate is compared with the first random number obtained in advance to obtain a first comparison result. Then, the loss weight is updated and calculated based on the bat sound wave loudness, the bat speed of the next iteration round, and the first comparison result to obtain the loss weight of the next iteration round. It should be noted that if the bat sound wave emission rate is too large, it means that the bat activity range is relatively large, that is, the range of variation of the loss weight is relatively large; conversely, if the bat sound wave emission rate is too small, it means that the bat activity range is relatively small, that is, the range of variation of the loss weight is relatively small. In some embodiments of the present application, the bat sound wave emission rate is determined to be too large or too small by using the first random number obtained in advance. It should be pointed out that pseudo-random numbers are random number sequences from a uniform distribution of [0,1] calculated using a deterministic algorithm. They are not truly random, but have statistical characteristics similar to random numbers, such as uniformity and independence. When calculating pseudo-random numbers, if the initial value (seed) used does not change, the sequence of the pseudo-random numbers will not change. Pseudorandom numbers can be generated in large quantities using computers. In simulation research, pseudorandom numbers are often used instead of true random numbers to improve efficiency. These numbers are typically very long-lived and can pass random number checks to ensure the randomness of the calculation results.

[0119] It should be clarified that the first random number obtained in advance is a random number uniformly distributed within [0,1]. When the first comparison result reflects that the bat sound wave emission rate is greater than the first random number, it can be judged that the first comparison result reflects that the bat sound wave emission rate is too large. In this case, a global search should be performed, and the weight of the loss weight should be updated based on the bat speed and the bat sound wave loudness of the next iteration round; when the first comparison result reflects that the bat sound wave emission rate is less than the first random number, it can be judged that the first comparison result reflects that the bat sound wave emission rate is too small. In this case, a local search should be performed, and the weight of the loss weight should be updated based on the bat sound wave loudness. It should be understood that the situation where the bat sound wave emission rate is equal to the first random number is very rare. If it occurs, choose one of the two search modes to implement the weight update calculation of the loss weight. It should be understood that there are many ways to perform weight update calculation on the loss weight to obtain the loss weight of the next iteration round, which is not limited to the above examples.

[0120] Reference Figure 5 According to some embodiments of the present application, the bat simulation parameters in the current iteration round also include bat sound wave loudness, and step S304 may include but is not limited to the following steps S501 to S504.

[0121] Step S501, performing candidate update calculation on the loss weight based on the first comparison result to obtain the candidate update weight;

[0122] Step S502: Substitute the triplet prediction result and the triplet label into the prediction loss function with the candidate update weight to calculate and obtain a second loss value;

[0123] Step S503, based on the bat sound wave loudness, the first loss value and the second loss value, determining whether the candidate update weight meets the preset update condition;

[0124] Step S504: When the candidate update weight meets the update condition, the candidate update weight is determined as the loss weight for the next iteration round.

[0125] Steps S501 to S504 are further described below.

[0126] According to some more specific embodiments of the present application, the original model needs to use the cross entropy loss value L of the relationship prediction as the target value of the algorithm optimization. The calculation formula of L is as follows:

[0127]

[0128] Among them, ∈ represents the triplet prediction result, w represents the downsampling parameter, (s, r, o) represents the triplet label, α represents the loss weight, l represents the sigmoid function, and f(s, r, o) is used to calculate the triplet score. The calculation formula is as follows:

[0129]

[0130] in, represents the transpose of the topic vector, R r The diagonal matrix representing the relationship, e o A vector representing an object.

[0131] In step S501, a candidate update calculation is performed on the loss weight based on the first comparison result to obtain a candidate update weight. It should be noted that the candidate update calculation based on the first comparison result can be performed based on the first comparison result and the bat acoustic emission rate, or based on the first comparison result and the bat speed in the next iteration round.

[0132] Reference Figure 6 According to some embodiments of the present application, step S501 may include but is not limited to the following steps S601 to S603.

[0133] Step S601: When the first comparison result is that the bat sound wave emission rate is greater than the first random number, the loss weight of the current iteration round is updated based on the bat speed of the next iteration round to obtain the candidate update weight.

[0134] Step S602: When the first comparison result indicates that the bat sound wave emission rate is less than or equal to the first random number, a weight update increment is obtained by multiplying the average sound wave loudness by a pre-acquired second random number; wherein the average sound wave loudness is an average of the sound wave loudnesses of multiple bats;

[0135] Step S603: Perform candidate updates on the loss weights of the current iteration round based on the weight update increment to obtain candidate update weights.

[0136] It should be pointed out that when the first comparison result reflects that the bat sound wave emission rate is greater than the first random number, it can be judged that the first comparison result reflects that the bat sound wave emission rate is too large, and a global search should be performed at this time, and the candidate should be updated based on the bat speed in the next iteration round; when the first comparison result reflects that the bat sound wave emission rate is less than or equal to the first random number, it can be judged that the first comparison result reflects that the bat sound wave emission rate is too small, and a local search should be performed at this time, and the candidate should be updated based on the bat sound wave loudness.

[0137] In step S601, when the first comparison result is that the bat sound wave emission rate is greater than the first random number, the loss weight of the current iteration round is updated based on the bat speed of the next iteration round to obtain the candidate update weight. It should be noted that if the first random number is represented as rand1, the bat sound wave emission rate greater than the first random number can be represented as r i(t)>rand1. At this time, when the i-th bat in the t-th iteration round performs candidate updates, a global search can be performed according to the following analytical expression:

[0138] α′ ik (t+1)=α ik (t)+v ik (t+1)

[0139] In steps S602 to S603, when the first comparison result is that the bat sound wave emission rate is less than or equal to the first random number, a weight update increment is obtained based on the product operation of the average sound wave loudness and the pre-acquired second random number; wherein the average sound wave loudness is the average of the sound wave loudnesses of multiple bats; and then based on the weight update increment, a candidate update is performed on the loss weight of the current iteration round to obtain a candidate update weight. It should be noted that the second random number is represented by rand2, then when r i When (t)≤rand2, it is necessary to base it on the average sound wave loudness Multiply it with the pre-obtained second random number rand2 to get the weight update increment Among them, the average sound wave loudness Going further, update the increment based on the weight Perform candidate updates on the loss weights of the current iteration to obtain candidate update weights. It should be noted that rand2 is a random number generated by a uniform distribution within [-1, 1].

[0140] Specifically, when the bat sound wave emission rate is less than or equal to the second random number, that is, r i (t)≤rand2, at this time, the i-th bat in the t-th iteration round performs candidate update, and the local search can be performed according to the following analytical expression:

[0141]

[0142] It should be pointed out that p k (t) is the optimal weight determined in the iteration round before the current iteration round. The determination of the optimal weight before the current iteration round has been explained above and will not be repeated here.

[0143] The embodiment of the present application shown in the above steps S601 to S602 shows how to calculate the candidate update weight α′ when the first comparison result reflects that the bat sound wave emission rate is greater than the first random number, and when the first comparison result reflects that the bat sound wave emission rate is less than or equal to the first random number. ik (t+1) facilitates further determination of the optimal solution for loss weights in subsequent steps. This helps to further improve the accuracy of knowledge graph construction models and the efficiency of entity relationship prediction.

[0144] In steps S502 to S504, the triple prediction results and triple labels are substituted into the prediction loss function with candidate update weights for calculation to obtain a second loss value. Then, based on the bat sound wave loudness, the first loss value, and the second loss value, it is determined whether the candidate update weights meet the preset update conditions. When the candidate update weights meet the update conditions, the candidate update weights are determined as the loss weights for the next iteration. It should be noted that after the loss weights of the prediction loss function are updated, the entity relationship prediction ability of the model may not be improved. Therefore, in order to ensure that the loss weights of the next iteration can further improve the entity relationship prediction ability, it is necessary to first determine whether the update weights meet the preset update conditions.

[0145] Reference Figure 7 According to some embodiments of the present application, step S503 may include but is not limited to the following steps S701 to S702.

[0146] Step S701: When the loudness of the bat sound wave is greater than the pre-acquired third random number and the first loss value is greater than the second loss value, it is determined that the candidate update weight meets the preset update condition;

[0147] Step S702: When the bat sound wave loudness is less than or equal to the third random number, it is determined that the candidate update weight does not meet the preset update condition; or when the first loss value is less than or equal to the second loss value, it is determined that the candidate update weight does not meet the preset update condition.

[0148] In step S701, when the loudness of the bat sound wave is greater than the pre-acquired third random number and the first loss value is greater than the second loss value, it is determined that the candidate update weight meets the preset update condition. It should be noted that if the third random number is represented as rand3, the loudness of the bat sound wave is greater than the pre-acquired third random number can be represented as A i (t)>rand3, and the first loss value is greater than the second loss value, which can be expressed as L(α′ ik (t+1))>L(α ik (t)). Therefore, when the candidate update weight meets the update condition, the candidate update weight is determined as the loss weight of the next iteration round, which can be expressed as: α ik (t+1)=α′ ik (t+1).

[0149] In step S702, when the loudness of the bat sound wave is less than or equal to the third random number, it is determined that the candidate update weight does not meet the preset update condition, or when the first loss value is less than or equal to the second loss value, it is determined that the candidate update weight does not meet the preset update condition. It should be noted that the loudness of the bat sound wave is less than or equal to the third random number, which can be expressed as A i(t)≤rand3, the first loss value is less than or equal to the second loss value, which can be expressed as L(α ik (t))≤L(α′ ik (t+1)). Therefore, when the candidate update weight does not meet the update condition, it can be expressed as: α ik (t+1)=α ik (t), keeping the original loss weight unchanged.

[0150] The embodiment shown by steps S701 to S702 provides an optional embodiment for determining whether the candidate update weight meets the preset update conditions. The advantage is that this embodiment sets the update conditions based on the two dimensions of bat sound wave loudness and loss value, which can more accurately reflect whether the candidate loss weight is a higher quality option compared to the original loss weight.

[0151] In the embodiment of the present application shown in steps S301 to S304, the bat simulation parameters can be used to first realize the updated calculation of the bat speed. Further, the loss weight can be selected to perform the weight update calculation based on the result of comparing the bat sound wave emission rate with the first random number obtained in advance, thereby obtaining the loss weight for the next iteration round. Yes, by updating the prediction loss function of the original model through the bat algorithm, the optimal loss weight value can be quickly found. The optimal model parameters are trained for different knowledge graph entity and relationship data sets, thereby further improving the accuracy of the knowledge graph construction model and improving the efficiency of entity relationship prediction.

[0152] In step S103, when the original model meets the first preset condition in the iterative training, the knowledge graph construction model is obtained. It should be noted that the first preset condition is a pre-set condition for determining whether the original model has achieved the expected training effect. In some embodiments, the first preset condition may be that the predicted loss value of the prediction loss function converges to a constant value, or that the predicted loss value of the prediction loss function is less than a preset threshold value. The first preset condition may also be other conditions for determining whether the original model has achieved the expected training effect. When the original model meets the first preset condition in the iterative training, it can be determined that the original model has achieved the expected training effect. At this time, the original model of the current iteration round is output to obtain a knowledge graph construction model with good entity relationship prediction capabilities. It should be emphasized that the knowledge graph construction model is used to perform relationship prediction on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on entities and entity relationships. The knowledge graph is used for dialogue generation or information retrieval.

[0153] Figure 8An electronic device 800 provided in an embodiment of the present application is shown. The electronic device 800 includes: a processor 801, a memory 802, and a computer program stored in the memory 802 and executable on the processor 801. When the computer program is executed, it is used to execute the training method for the knowledge graph construction model described above.

[0154] The processor 801 and the memory 802 may be connected via a bus or other means.

[0155] Memory 802, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs, such as the training method for the knowledge graph construction model described in the embodiments of this application. Processor 801 implements the above-mentioned training method for the knowledge graph construction model by running the non-transitory software program and instructions stored in memory 802.

[0156] The memory 802 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function. The data storage area may store a training method for executing the above-mentioned knowledge graph construction model. In addition, the memory 802 may include a high-speed random access memory 802, and may also include a non-transitory memory 802, such as at least one storage device storage device, a flash memory device or other non-transitory solid-state storage device. In some embodiments, the memory 802 may optionally include a memory 802 remotely arranged relative to the processor 801, and these remote memories 802 may be connected to the electronic device 800 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0157] The non-transient software program and instructions required to implement the above-mentioned training method for the knowledge graph construction model are stored in the memory 802. When executed by one or more processors 801, the above-mentioned training method for the knowledge graph construction model is executed, for example, Figure 1 Steps S101 to S103 of the method, Figure 2 Steps S201 to S203 of the method, Figure 3 Steps S301 to S304 of the method, Figure 4 Steps S401 to S403 of the method, Figure 5 Steps S501 to S504 of the method, Figure 6 Steps S601 to S603 of the method, Figure 7 Method steps S701 to S702.

[0158] An embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions, which are used to execute the above-mentioned training method for constructing a knowledge graph model.

[0159] In one embodiment, the computer readable storage medium stores computer executable instructions, which are executed by one or more control processors, for example, Figure 1 Steps S101 to S103 of the method, Figure 2 Steps S201 to S203 of the method, Figure 3 Steps S301 to S304 of the method, Figure 4 Steps S401 to S403 of the method, Figure 5 Steps S501 to S504 of the method, Figure 6 Steps S601 to S603 of the method, Figure 7 Method steps S701 to S702.

[0160] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0161] Those skilled in the art will appreciate that all or some of the steps and systems in the method disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, and the computer-readable medium can include computer storage media (or non-transitory media) and communication media (or temporary media). As known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory, or other memory technology, CD-ROM, digital versatile disks (DVD), or other optical disk storage, magnetic cassettes, magnetic tapes, storage device storage, or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media generally include computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium. It should also be understood that the various implementations provided in the embodiments of the present application may be arbitrarily combined to achieve different technical effects.

[0162] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the art can also make various equivalent modifications or substitutions under the shared conditions that do not violate the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A training method for building a knowledge graph model, characterized in that: include: Acquire a training data set, wherein the training data set includes training entity data and triple labels, and the training entity data comes from a preset question-answering database or an information retrieval database; Inputting the training data set into a preset original model, and iteratively training the original model based on the training entity data and the triplet label; In each round of iterative training, the prediction loss function of the original model is updated by the bat algorithm; When the original model meets the first preset condition in iterative training, the knowledge graph construction model is obtained, wherein the knowledge graph construction model is used to perform relationship prediction on each entity in the acquired target data, obtain entity relationships, and generate a knowledge graph based on the entities and the entity relationships, and the knowledge graph is used for dialogue generation or information retrieval.

2. The training method according to claim 1, characterized in that: The step of inputting the training data set into a preset original model and iteratively training the original model based on the training entity data and the triplet label includes: In each round of iterative training, the triple prediction result and the triple label are substituted into a prediction loss function with a loss weight for calculation to obtain a first loss value; wherein the triple prediction result is obtained by the original model performing relationship prediction on the training entity data; Updating the loss weight by a preset bat algorithm; The prediction loss function is updated based on the updated loss weight.

3. The training method according to claim 2, characterized in that: The bat algorithm is used to simulate the solution of the loss weight based on the bat position of the virtual bat, and updating the loss weight by the bat algorithm includes: Obtain bat simulation parameters of the current iteration round, wherein the bat simulation parameters include the loss weight, bat speed, bat sound wave frequency, bat sound wave emission rate, and bat sound wave loudness; Perform speed update calculation based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed of the next iteration round; Comparing the bat sound wave emission rate with a pre-acquired first random number to obtain a first comparison result; The loss weight is updated and calculated based on the bat sound wave loudness, the bat speed of the next iteration round, and the first comparison result to obtain the loss weight of the next iteration round.

4. The training method according to claim 3, characterized in that: The loss weight is updated and calculated based on the loudness of the bat sound wave, the bat speed of the next iteration round, and the first comparison result to obtain the loss weight of the next iteration round, including: Performing candidate update calculation on the loss weight based on the first comparison result to obtain a candidate update weight; Substituting the triple prediction result and the triple label into the prediction loss function with the candidate update weight for calculation to obtain a second loss value; Based on the bat sound wave loudness, the first loss value, and the second loss value, determining whether the candidate update weight meets a preset update condition; When the candidate update weight satisfies the update condition, the candidate update weight is determined as the loss weight for the next iteration round.

5. The training method according to claim 4, characterized in that: The performing candidate update calculation on the loss weight based on the first comparison result to obtain the candidate update weight includes: When the first comparison result is that the bat sound wave emission rate is greater than the first random number, the loss weight of the current iteration round is updated based on the bat speed of the next iteration round to obtain the candidate update weight.

6. The training method according to claim 4, characterized in that: The performing candidate update calculation on the loss weight based on the first comparison result to obtain the candidate update weight includes: When the first comparison result is that the bat sound wave emission rate is less than or equal to the first random number, a weight update increment is obtained based on the average sound wave loudness and a pre-acquired second random number. The average sound wave loudness is the average of the multiple bat sound wave loudnesses. Based on the weight update increment, candidate updates are performed on the loss weight of the current iteration round to obtain the candidate update weight.

7. The training method according to claim 4, characterized in that: The determining whether the candidate update weight meets a preset update condition based on the bat sound wave loudness, the first loss value, and the second loss value includes: When the bat sound wave loudness is greater than a third random number obtained in advance, and the first loss value is greater than the second loss value, it is determined that the candidate update weight meets the preset update condition; When the bat sound wave loudness is less than or equal to the third random number, it is determined that the candidate update weight does not meet the preset update condition; or, when the first loss value is less than or equal to the second loss value, it is determined that the candidate update weight does not meet the preset update condition.

8. The training method according to claim 3, characterized in that: The speed update calculation based on the loss weight of the current iteration round, the bat sound wave frequency, the bat speed and the optimal weight determined in the iteration round before the current iteration round to obtain the bat speed of the next iteration round includes: Subtract the loss weight based on the current iteration round from the optimal weight to obtain a weight comparison difference; A speed update increment is obtained by performing a product operation based on the weight comparison difference and the bat sound wave frequency; The bat speed of the next iteration round is obtained by performing a sum operation based on the bat speed of the current iteration round and the speed update increment.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the training method for constructing a knowledge graph model as described in any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the training method for building a knowledge graph model as described in any one of claims 1 to 8.