Classification prediction model training method, classification prediction method, device and equipment
By using sample sets from different sources to train models, combining coding and mapping sub-models, the catastrophic forgetting problem of machine learning models between tasks is solved, and the accuracy of prediction models is improved.
Patent Information
- Application Number
- CN202011576746.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2040-12-28
AI Technical Summary
When training predictive models for multiple tasks, machine learning models are prone to catastrophic forgetting, resulting in the model's performance on previous tasks and the inability to give accurate predictive classification results.
By training the first coding submodel using a second sample set from different sources, a second coding submodel is obtained, and the mapped sample set is encoded through the second coding submodel, combining the first mapped submodel and the second classification submodel, a second classification prediction model is constructed to avoid knowledge coverage and improve the accuracy of the model.
It effectively avoids catastrophic forgetting, improves the accuracy of the classification prediction model, ensures that the model is not lost in knowledge transmission between different tasks, and improves the accuracy of the prediction results.
Smart Images

Figure CN114757247B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a classification prediction model training method, classification prediction method, device and equipment. Background Art
[0002] With the rapid development of artificial intelligence (AI), computers can replace humans in decision-making and judgment in many fields. This not only reduces human labor but also improves the accuracy of decisions and judgments. Predictive models are a successful example of this. Predictive models are obtained by training sample data sets based on machine learning. Predictive models can provide predictions and classifications based on input data, thereby achieving automated predictions.
[0003] When training a prediction model for predicting the results of multiple tasks, the machine learning model learns multiple tasks in a sequence. At this time, catastrophic forgetting will occur. That is, the knowledge learned by the machine learning model in the previous task will be overwritten by the new knowledge of the subsequent task, resulting in the performance of the finally trained prediction model on the previous task being degraded, making it impossible for the prediction model to give accurate prediction and classification results for the previous task. Therefore, the accuracy of the prediction model is low. Summary of the Invention
[0004] The embodiments of the present application provide a classification prediction model training method, classification prediction method, device, and apparatus that can avoid catastrophic forgetting during model training, thereby improving the accuracy of the prediction results of the trained classification prediction model. The technical solution is as follows:
[0005] On the one hand, a training method for a classification prediction model is provided, comprising:
[0006] Obtaining a first classification prediction model obtained by training with a first sample set, wherein the first classification prediction model includes a first encoding sub-model and a first classification sub-model;
[0007] Training the first encoding sub-model using a second sample set to obtain a second encoding sub-model, where the second sample set and the first sample set are extracted from multimedia data, and the second sample set and the first sample set have different sources, and the multimedia data includes at least one of text, video, picture, or audio data;
[0008] Encoding the mapping sample set by using the second encoding sub-model to obtain a first vector;
[0009] A first mapping sub-model is trained using the first vector and the second vector, the second vector is obtained by encoding the mapping sample set using the first encoding sub-model, a difference between the second vector and a third vector is less than a loss threshold, and the third vector is obtained by mapping the first vector using the first mapping sub-model;
[0010] encoding the second sample set into a fourth vector using the second encoding sub-model;
[0011] Mapping the fourth vector into a fifth vector by using the first mapping sub-model;
[0012] Training the first classification sub-model using the fifth vector to obtain a second classification sub-model;
[0013] A second classification prediction model is constructed by the second encoding sub-model, the first mapping sub-model and the second classification sub-model, and the second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
[0014] On the other hand, a classification prediction method is provided, comprising:
[0015] Obtain target data for result prediction;
[0016] Obtaining a second classification prediction model, where the second classification prediction model includes a second encoding sub-model, a first mapping sub-model, and a second classification sub-model, the second classification prediction model is obtained based on the second sample set and the first classification prediction model, the first classification prediction model is obtained by training the first sample set, the first classification prediction model includes the first encoding sub-model and the first classification sub-model, a difference between a second vector obtained by mapping the first vector by the first mapping sub-model and a third vector obtained by encoding the mapped sample set by the first encoding sub-model is less than a loss threshold, and the first vector is obtained by encoding the mapped sample set by the second encoding sub-model; the second sample set and the first sample set are extracted from multimedia data, and the first sample set and the second sample set have different sources, and the multimedia data includes at least one type of data selected from text, video, picture, or audio;
[0017] encoding the target data using the second encoding sub-model to obtain a first target vector;
[0018] Mapping the first target vector to a second target vector through the first mapping sub-model;
[0019] The second target vector is input into the second classification sub-model to obtain a second predicted classification result output by the second classification sub-model, and the second predicted classification result is used as the classification result of the target data.
[0020] In another aspect, a training device for a classification prediction model is provided, comprising:
[0021] A first acquisition module is used to acquire a first classification prediction model obtained by training with a first sample set, wherein the first classification prediction model includes a first encoding sub-model and a first classification sub-model;
[0022] an encoding training module, configured to train the first encoding sub-model using a second sample set to obtain a second encoding sub-model, wherein the second sample set and the first sample set are extracted from multimedia data, and the second sample set and the first sample set have different sources, and the multimedia data includes at least one type of data selected from text, video, image, or audio;
[0023] A first encoding module, configured to encode the mapping sample set using the second encoding sub-model to obtain a first vector;
[0024] a mapping training module, configured to train a first mapping sub-model using the first vector and the second vector, wherein the second vector is obtained by encoding the mapping sample set using the first encoding sub-model, wherein a difference between the second vector and a third vector is less than a loss threshold, and the third vector is obtained by mapping the first vector using the first mapping sub-model;
[0025] The first encoding module is further configured to encode the second sample set into a fourth vector using the second encoding sub-model;
[0026] a first mapping module, configured to map the fourth vector into a fifth vector through the first mapping sub-model;
[0027] a classification training module, configured to train the first classification sub-model using the fifth vector to obtain a second classification sub-model;
[0028] A construction module is used to construct a second classification prediction model through the second encoding sub-model, the first mapping sub-model and the second classification sub-model, and the second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
[0029] In one possible implementation, the encoding training module is configured to perform the following processing:
[0030] Encoding the second sample set using the first encoding sub-model to obtain a sixth vector;
[0031] Obtaining a first predicted classification result output by the first classification sub-model based on the sixth vector;
[0032] According to the first predicted classification result, the model parameters of the first encoding sub-model are iteratively updated until the first predicted classification result matches the actual classification result of the second sample set, thereby obtaining the second encoding sub-model.
[0033] In a possible implementation, the mapping sample set includes all or part of the samples in the first sample set, the mapping sample set is read from the first storage space, and the mapping sample set is stored in the first storage space after the first classification prediction model is obtained through training.
[0034] In a possible implementation, the second vector is read from a second storage space, and the second vector is stored in the second storage space after the first classification prediction model is obtained through training.
[0035] In one possible implementation, the first sample set includes at least two sub-sample sets, and different sub-sample sets have different sources; the first classification prediction model is obtained by sequentially training the at least two sub-sample sets, and the method of training the first classification prediction model through each sub-sample set is the same as the method of training the second classification prediction model through the second sample set.
[0036] In a possible implementation, the first classification prediction model further includes a second mapping sub-model;
[0037] The mapping training module is used to iteratively train the second mapping sub-model using the first vector as input until the difference between a third vector output by the second mapping sub-model and the second vector is less than the loss threshold.
[0038] In a possible implementation, the mapping training module is configured to perform the following processing:
[0039] Inputting the first vector into the second mapping sub-model to obtain the third vector output by the second mapping sub-model;
[0040] Inputting the second vector and the third vector into a loss function;
[0041] Iteratively update the model parameters of the second mapping sub-model to minimize the loss function until the loss function outputs a minimum value, thereby obtaining the first mapping sub-model, and the minimum value output by the loss function is less than the loss threshold.
[0042] In a possible implementation, the mapping sample set includes at least two sub-mapping sample sets, each sub-mapping sample set corresponds to one sub-sample set, different sub-mapping sample sets correspond to different sub-sample sets, and the sub-mapping sample set includes all or part of the samples in the corresponding sub-sample set.
[0043] In a possible implementation, the device further includes:
[0044] The model evaluation module is used to obtain the first accuracy of the second classification prediction model for each of the sub-sample sets; obtain the second accuracy of the second classification prediction model for the second sample set; and determine the average of the first accuracy and the second accuracy as the prediction accuracy of the second classification prediction model.
[0045] In one possible implementation, the first encoding sub-model includes a bidirectional long short-term memory network BiLSTM model.
[0046] In another aspect, a classification prediction device is provided, comprising:
[0047] The second acquisition module is used to obtain target data for result prediction;
[0048] a third acquisition module, configured to acquire a second classification prediction model, the second classification prediction model including a second encoding sub-model, a first mapping sub-model, and a second classification sub-model, the second classification prediction model being obtained based on the second sample set and the first classification prediction model, the first classification prediction model being obtained by training the first sample set, the first classification prediction model including the first encoding sub-model and the first classification sub-model, a difference between a second vector obtained by mapping the first vector by the first mapping sub-model and a third vector obtained by encoding the mapping sample set by the first encoding sub-model being less than a loss threshold, and the first vector being obtained by encoding the mapping sample set by the second encoding sub-model;
[0049] a second encoding module, configured to encode the target data using the second encoding sub-model to obtain a first target vector;
[0050] a second mapping module, configured to map the first target vector to a second target vector through the first mapping sub-model;
[0051] A classification module is used to input the second target vector into the second classification sub-model, obtain a second predicted classification result output by the second classification sub-model, and use the second predicted classification result as the classification result of the target data.
[0052] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the operations performed by the training method of the classification prediction model or the classification prediction method as described above.
[0053] On the other hand, a computer-readable storage medium is provided, in which at least one instruction is stored. The instruction is loaded and executed by a processor to implement the operations performed by the above-mentioned classification prediction model training method or classification prediction method.
[0054] On the other hand, a computer program product or computer program is provided, which includes a program code, which is stored in a computer-readable storage medium. The processor of a computer device reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the computer device performs the operations performed by the training method of the classification prediction model or the classification prediction method as described above.
[0055] The beneficial effects of the technical solutions provided in the embodiments of the present application include:
[0056] For a first sample set and a second sample set from different sources, after the first encoding sub-model is trained using the second sample set to obtain the second encoding sub-model, the knowledge learned by the second encoding sub-model in the first sample set will be overwritten by the knowledge learned in the second sample set. To this end, the mapping sample set is encoded using the second encoding sub-model to obtain a first vector, a second vector obtained by encoding the mapping sample set by the first encoding sub-model is obtained, and the first mapping sub-model is trained using the first vector and the second vector so that the difference between the third vector mapped by the first mapping sub-model from the first vector and the second vector is less than a loss threshold. Thus, for the same sample, the vector obtained by the second encoding sub-model and the first mapping sub-model is the same as or similar to the vector obtained by the first encoding sub-model. This ensures that the knowledge learned by the second classification prediction model in the first sample set is not overwritten, thereby avoiding catastrophic forgetting during the training of the classification prediction model, thereby improving the accuracy of the trained classification prediction model, and further increasing the accuracy of the prediction results obtained by classification prediction based on the classification prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0058] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0059] Figure 2 This is a flowchart of a training method for a classification prediction model provided in an embodiment of the present application;
[0060] Figure 3 This is a flowchart of another classification prediction model training method provided in an embodiment of the present application;
[0061] Figure 4 This is a schematic diagram of a training process of a classification prediction model provided in an embodiment of the present application;
[0062] Figure 5 This is a schematic diagram of a main complaint text provided in an embodiment of the present application;
[0063] Figure 6 This is a schematic diagram of a comparison of prediction results of different classification prediction models provided in an embodiment of the present application;
[0064] Figure 7 This is a flow chart of a classification prediction method provided by an embodiment of the present application;
[0065] Figure 8 Schematic diagram of a training device for a classification prediction model provided in an embodiment of the present application;
[0066] Figure 9 Schematic diagram of another training device for a classification prediction model provided in an embodiment of the present application;
[0067] Figure 10 is a schematic diagram of a classification prediction device provided in an embodiment of the present application;
[0068] Figure 11 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0069] Figure 12 This is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0071] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0072] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0073] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0074] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning through demonstration.
[0075] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.
[0076] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0077] The solutions provided in the embodiments of the present application involve the prediction of results of artificial intelligence services, for example, model training and result prediction based on machine learning, which are specifically illustrated by the following embodiments.
[0078] Figure 1 This is a schematic diagram of the implementation environment of a training method for a classification prediction model provided in an embodiment of the present application, see Figure 1 , the implementation environment includes: a terminal 101 and a server 102;
[0079] Terminal 101 is connected to server 102 via a wireless network or a wired network. Terminal 101 can be a smartphone, tablet computer, portable computer, medical computer, material testing computer, or other device. Those skilled in the art will appreciate that the number of terminals 101 can be greater or lesser, for example, there can be only one terminal 101, or there can be dozens, hundreds, or even more terminals 101. The embodiments of this application do not limit the number or device type of terminals 101.
[0080] The server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. It will be appreciated by those skilled in the art that the number of the above-mentioned servers 102 can be more or less, and this application does not limit this. Of course, the server 102 can also include servers with other functions in order to provide more comprehensive and diversified services.
[0081] In the embodiment of the present application, the technical solution provided in the embodiment of the present application can be implemented by the terminal 101 or the server 102 as the execution subject, or the technical solution provided in the embodiment of the present application can be implemented through interaction between the terminal 101 and the server 102, which is not limited in the embodiment of the present application. The following description will take the execution subject as the server 102 as an example:
[0082] In an embodiment of the present application, a storage space for storing training samples is provided on the terminal 101, and the training samples stored in the storage space are used to train the classification prediction model. The terminal 101 can receive training samples input from the outside and store the received training samples in the storage space. The terminal 101 can also extract training samples from multimedia materials such as text, video, pictures or audio, and store the extracted training samples in the storage space. After the server 102 obtains the training samples from the terminal 101, the server 102 trains the classification prediction model based on the obtained training samples, and then performs classification prediction through the classification prediction model.
[0083] Figure 2 This is a flowchart of a training method for a classification prediction model provided in an embodiment of the present application, see Figure 2 , the method comprises the following steps:
[0084] 201. Obtain a first classification prediction model obtained by training with a first sample set, where the first classification prediction model includes a first encoding sub-model and a first classification sub-model.
[0085] Exemplarily, the second sample set and the first sample set are extracted from multimedia data, and the first sample set and the second sample set have different sources. The multimedia data includes at least one type of data selected from the group consisting of text, video, image, or audio. The first sample set includes at least one sample, and the samples included in the first sample set are in the form of data such as text, image, or audio.
[0086] The first classification prediction model is obtained by training the first sample set. The first classification prediction model can output a corresponding predicted classification result based on the input target data. The first classification prediction model includes a first encoding sub-model and a first classification sub-model. The first encoding sub-model is used to encode the input data into a corresponding vector. The first classification sub-model is used to output a predicted classification result based on the vector encoded by the first encoding sub-model.
[0087] In one possible implementation, the first encoding sub-model and the first classification sub-model are initialized, the samples in the first sample set are encoded by the first encoding sub-model to obtain a vector, the obtained vector is input into the first classification sub-model to obtain a predicted classification result output by the first classification sub-model, and the model parameters of the first encoding sub-model and the first classification sub-model are iteratively updated according to the difference between the obtained predicted classification result and the true classification result corresponding to the sample in the first sample set, until the predicted classification result output by the first classification sub-model is the same as the true classification result corresponding to the sample or the difference meets the requirement, and the iterative updating of the model parameters of the first encoding sub-model and the first classification sub-model is stopped, thereby obtaining a first classification prediction model including the first encoding sub-model and the first classification sub-model.
[0088] In another possible implementation, since the training of the classification prediction model can be continuous, the first classification prediction model can be trained according to the method of training the second classification prediction model. For example, according to the training method of the classification prediction model provided in this embodiment, the first classification prediction model can be obtained based on the third prediction model training.
[0089] It should be noted that the first classification prediction model can also be obtained through other methods, which is not limited in this application.
[0090] 202. Train the first encoding sub-model using a second sample set to obtain a second encoding sub-model, where the second sample set and the first sample set have different sources.
[0091] The second sample set includes at least one sample, and the samples included in the second sample set are in data formats such as text, images, or audio. The data formats of the samples in the second sample set and the first sample set may be the same or different. The second sample set and the first sample set may have different sources. For example, if the samples in the first and second sample sets are chief complaint texts in medical records, the second sample set and the first sample set may come from different hospitals, or they may come from different departments in the same hospital.
[0092] The first encoding sub-model is trained using the second sample set to obtain a second encoding sub-model, where the second encoding sub-model is used to encode the input data into corresponding vectors.
[0093] 203. Encode the mapping sample set using a second encoding sub-model to obtain a first vector.
[0094] The mapping sample set includes at least one sample, and the samples included in the mapping sample set are in the form of data such as text, image, or audio. Both the first encoding sub-model and the second encoding sub-model can encode the mapping sample set into a corresponding vector.
[0095] The samples in the mapping sample set can be randomly selected from outside the first sample set and the second sample set, or some or all of the samples in the first sample set can be selected as the mapping sample set, or some or all of the samples in the second sample set can be selected as the mapping sample set, or some samples can be selected from the first sample set and the second sample set respectively as the mapping sample set.
[0096] After the mapping sample set is input into the second encoding sub-model, the second encoding sub-model encodes the mapping sample set to obtain a first vector.
[0097] 204. Train the first mapping sub-model using the first vector and the second vector, obtain the second vector by encoding the mapping sample set using the first encoding sub-model, obtain the third vector by mapping the first vector using the first mapping sub-model if the difference between the second vector and the third vector is less than a loss threshold.
[0098] The second vector is obtained by encoding the mapping sample set through the first encoding sub-model. The first mapping sub-model is trained by the first vector and the second vector. The trained first mapping sub-model can map the first vector to a third vector, and the difference between the mapped third vector and the second vector is less than the loss threshold.
[0099] For example, after training to obtain the first mapping sub-model, for a sample in the mapping sample set, the first encoding sub-model encodes the sample as vector 1, the second encoding sub-model encodes the sample as vector 2, and the first mapping sub-model maps vector 2 to vector 3. Then, the difference between vector 1 and vector 3 is less than the loss threshold, that is, vector 1 is the same as or similar to vector 3.
[0100] The loss threshold serves as a target for training the first mapping sub-model and is used to measure the difference between the third vector and the second vector. When the difference between the third vector and the second vector is less than the loss threshold, training of the first mapping sub-model ends. Optionally, the loss threshold is a preset value.
[0101] 205. Encode the second sample set into a fourth vector using a second encoding sub-model.
[0102] The first classification sub-model in the first classification prediction model is used to output a predicted classification result based on the input vector. After the second encoding sub-model is obtained through training with the second sample set, in order to train the first classification sub-model with the second sample set to obtain the second classification sub-model, it is necessary to encode the samples in the second sample set into a fourth vector through the second encoding sub-model, and then the first classification sub-model can be trained based on the fourth vector to obtain the second classification sub-model.
[0103] It should be noted that step 204 and step 205 may be executed simultaneously or in the current order, or step 205 may be executed first and then step 204.
[0104] 206. Map the fourth vector to a fifth vector through the first mapping sub-model.
[0105] The first encoding sub-model is trained using the second sample set. After obtaining the second encoding sub-model, the new knowledge learned by the second encoding sub-model in the second sample set will overwrite the knowledge learned in the first sample set. The vector encoded by the second encoding sub-model is mapped to another vector by the first mapping sub-model, thereby converting the sample into a vector based on the knowledge learned in the first and second sample sets, thus avoiding catastrophic forgetting during the model training process. The fourth vector is mapped to a fifth vector by the first mapping sub-model, so that the fifth vector is a vector obtained based on the knowledge learned in the first and second sample sets. This ensures that when the second classification sub-model is subsequently trained based on the fifth vector, catastrophic forgetting will not occur in the second classification sub-model, thereby further ensuring the accuracy of the trained classification prediction model.
[0106] 207. Train the first classification sub-model using the fifth vector to obtain a second classification sub-model.
[0107] Each sample in the second sample set has a corresponding label. The label corresponding to a sample is the true classification result of the sample. For example, if the sample is text data describing an object, the label of the sample is the category to which the object described by the sample belongs.
[0108] Since the second encoding sub-model encodes the second sample set into a fourth vector, and the first mapping sub-model maps the fourth vector into a fifth vector, exemplarily, when the first classification sub-model is trained using the fifth vector, the first classification sub-model can be trained based on the fifth vector and the labels corresponding to each sample in the second sample set to obtain the second classification sub-model, so that after the fifth vector is input into the second classification sub-model, the second classification sub-model can output the corresponding label.
[0109] 208. Construct a second classification prediction model through the second encoding sub-model, the first mapping sub-model and the second classification sub-model. The second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
[0110] The second classification prediction model includes a second encoding sub-model, a first mapping sub-model and a second classification sub-model. The second encoding sub-model is used to encode the input data into a corresponding vector, the first mapping sub-model is used to map the vector encoded by the second encoding sub-model into another vector, and the second classification sub-model is used to output a predicted classification result based on the vector mapped by the first mapping sub-model.
[0111] The solution provided by the embodiment of the present application is that after the first encoding sub-model is trained with the second sample set to obtain the second encoding sub-model, the knowledge learned by the second encoding sub-model in the first sample set will be overwritten by the knowledge learned in the second sample set. To this end, the first vector is obtained by encoding the mapping sample set with the second encoding sub-model, and the second vector obtained by encoding the mapping sample set with the first encoding sub-model is obtained. The first mapping sub-model is trained with the first vector and the second vector so that the difference between the third vector mapped by the first mapping sub-model and the second vector is less than the loss threshold, so that for the same sample, the vector obtained by the second encoding sub-model and the first mapping sub-model is the same or similar to the vector obtained by the first encoding sub-model. The first classification sub-model is trained based on the second encoding sub-model, the first mapping sub-model and the second sample set to obtain the second classification sub-model, and then the second classification prediction model including the second encoding sub-model, the first mapping sub-model and the second classification sub-model is obtained. Since the samples are converted into vectors through the second encoding sub-model and the first mapping sub-model, catastrophic forgetting is avoided during the training process of the classification prediction model, thereby improving the accuracy of the trained classification prediction model, and further making the prediction results obtained by classification prediction based on the classification prediction model more accurate.
[0112] Figure 3 This is a flowchart of a training method for a classification prediction model provided in an embodiment of the present application, see Figure 3 , the training method of the classification prediction model includes:
[0113] 301. Obtain a first classification prediction model obtained by training with a first sample set.
[0114] The first classification prediction model is obtained by training the first sample set. Depending on the number of sample sources in the first sample set, the first classification prediction model is obtained through one or more trainings.
[0115] In a first possible implementation, all samples in the first sample set have the same source. In this case, a first classification prediction model is obtained by training the first sample set once. The obtained first classification prediction model includes a first encoding sub-model and a first classification sub-model. For example, the samples in the first sample set are text data describing individual attributes, and all samples in the first sample set come from the same department of the same unit. Therefore, all samples in the first sample set have the same data format. The first classification prediction model trained on the first sample set is used to determine the category to which an individual belongs based on the individual attributes.
[0116] The first sample set includes not only multiple samples but also labels corresponding to each sample. The labels are the actual classification results corresponding to the corresponding samples. For example, if the samples in the first sample set are text data describing individual attributes, the labels corresponding to the samples are the categories to which the corresponding individuals belong.
[0117] During implementation, the first encoding sub-model encodes the first sample set into a vector, and the first classification sub-model outputs a predicted classification result based on the vector encoded by the first encoding sub-model. According to the gap between the predicted classification result and the true classification result corresponding to the sample in the first sample set, the first encoding sub-model and the first classification sub-model are iteratively trained until the predicted classification result output by the first classification sub-model is the same as the true classification result of the sample or the gap meets the requirements, thereby obtaining a first classification prediction model including the first encoding sub-model and the first classification sub-model.
[0118] In a second possible implementation, the first sample set includes at least two subsample sets, each subsample set includes at least one sample, and the different subsample sets have different sources. In this case, a first classification prediction model is obtained by sequentially training the subsample sets. The obtained first classification prediction model includes a first encoding submodel, a second mapping submodel, and a first classification submodel. For example, the first sample set includes k subsample sets, and the samples in each subsample set are text data describing individual attributes. The samples in the same subsample set come from the same unit or department, while the samples in different subsample sets come from different units or departments. The samples in the same subsample set have the same data format.
[0119] During implementation, when training the first classification prediction model through each subsample set in the first sample set, according to the different order of training the first classification prediction model, there are three ways to train the first classification prediction model through each subsample set in the samples in the first sample set. For the first subsample set (the first subsample set in the samples in the first sample set used to train the first classification prediction model), the first classification prediction model is trained using the first method. For the second subsample set (the second subsample set in the samples in the first sample set used to train the first classification prediction model), the first classification prediction model is trained using the second method. For the subsample sets in the first sample set other than the first and second subsample sets, the first classification prediction model is trained using the third method. The following describes the above three methods for training the first classification prediction model through subsample sets. For the convenience of description, the first subsample set in the first sample set used to train the first classification prediction model is defined as subsample set S1, the second subsample set in the first sample set used to train the first classification prediction model is defined as subsample set S2, and the subsample sets in the first sample set after the second subsample set used to train the first classification prediction model are defined as subsample set S k .
[0120] For training the first classification prediction model through the sub-sample set S1: the first encoding sub-model encodes the sub-sample set S1 into a vector, and the first classification sub-model outputs a predicted classification result based on the vector encoded by the first encoding sub-model. According to the gap between the predicted classification result and the true classification result corresponding to the sample in the sub-sample set S1, the first encoding sub-model and the first classification sub-model are iteratively trained until the predicted classification result output by the first classification sub-model is the same as the true classification result of the sample in the sub-sample set S1, thereby obtaining the first classification prediction model M1 including the first encoding sub-model B1 and the first classification sub-model F1.
[0121] When performing classification prediction through the first classification prediction model M1, the input data is first encoded into a vector through the first encoding sub-model B1, and then the vector encoded by the first encoding sub-model B1 is input into the first classification sub-model F1 to obtain the predicted classification result output by the first classification sub-model F1.
[0122] For training the first classification prediction model using the subsample set S2: train the first encoding submodel B1 using the subsample set S2 to obtain the first encoding submodel B2. Encode the mapping sample set including at least one sample using the first encoding submodel B1 to obtain vector 1, encode the above mapping sample set using the first encoding submodel B2 to obtain vector 2, and train the second mapping submodel Y2 based on vector 1 and vector 2, wherein the second mapping submodel Y2 can map vector 2 to vector 3, and the difference between vector 1 and vector 3 is less than the loss threshold. Encode the subsample set S2 into vector 4 using the first encoding submodel B2, map vector 4 to vector 5 using the second mapping submodel Y2, and train the first classification submodel F1 using vector 5 to obtain the first classification submodel F2, thereby obtaining the first classification prediction model M2 including the first encoding submodel B2, the second mapping submodel Y2, and the first classification submodel F2.
[0123] When performing classification prediction through the first classification prediction model M2, the input data is first encoded into a vector through the first encoding sub-model B2, and then the vector encoded by the first encoding sub-model B2 is mapped into another vector through the second mapping sub-model Y2, and then the vector mapped by the second mapping sub-model Y2 is input into the first classification sub-model F2 to obtain the predicted classification result output by the first classification sub-model F2.
[0124] For the subsample set S k Training the first classification prediction model: Get the subsample set S k-1 The first classification prediction model M obtained through training k-1 , subsample set S k-1 is the subsample set S k The previous subsample set, the first classification prediction model M k-1 Including the first encoding sub-model B k-1 , the second mapping sub-model Y k-1 and the first classification sub-model F k-1 . Through the subsample set S k Train the first encoding sub-model B k-1 , get the first encoding sub-model B k . Through the first encoding sub-model B k-1 The mapping sample set including at least one sample is encoded to obtain a vector 6, which is then encoded by the first encoding sub-model B k Encode the above mapping sample set to obtain vector 7, and encode the second mapping sub-model Y according to vector 6 and vector 7. k-1 Perform training to obtain the second mapping sub-model Y k , where the second mapping sub-model Y k Vector 7 can be mapped to vector 8, and the difference between vector 6 and vector 8 is less than the loss threshold.k The subsample set S k Encoded as vector 9, through the second mapping sub-model Y k Map vector 9 to vector 10, and use vector 10 to classify the first sub-model F k-1 Perform training to obtain the first classification sub-model F k , and then obtain the first coding sub-model B k , the second mapping sub-model Y k and the first classification sub-model F k The first classification prediction model M k .
[0125] In the first classification prediction model M k When making classification predictions, first pass the first encoding sub-model B k The input data is encoded into a vector and then passed through the second mapping sub-model Y k The first encoding sub-model B k The encoded vector is mapped to another vector, and then the second mapping sub-model Y k The mapped vector is input into the first classification sub-model F k , get the first classification sub-model F k Output prediction classification results.
[0126] It should be noted that the specific method for training the first encoding sub-model using the sub-sample set is described in the subsequent embodiments for training the first encoding sub-model using the second sample set. The specific method for training the second mapping sub-model is described in the subsequent embodiments for training the first mapping sub-model.
[0127] 302. Obtain a second sample set.
[0128] The second sample set includes at least one sample. The second sample set and the first sample set are extracted from multimedia data, and the sources of the first sample set and the second sample set are different. The multimedia data includes at least one type of data including text, video, picture or audio. The samples in the second sample set and the first sample set have the same data type. For example, the samples in the first sample set and the second sample set are both text data used to describe individual attributes.
[0129] In one possible implementation, the first sample set and the second sample set come from different units, or from different departments of the same unit. For example, the samples in the first sample set come from automobile factory A, and the samples in the second sample set come from automobile factory B. The samples in the first sample set and the second sample set are both text data describing defects in the automobile, and the prediction model is used to predict the fault location of the automobile production line based on the text data of the defects in the automobile. For another example, the samples in the first sample set come from the paint shop of automobile factory A, and the samples in the second sample set come from the final assembly shop of automobile factory A. The samples in the first sample set and the second sample set are both text data describing defects in the automobile, and the prediction model is used to predict the fault location of the automobile production line based on the text data of the defects in the automobile.
[0130] In another possible implementation, the prediction model is used to predict the category to which an individual belongs based on text data describing individual attributes. The samples in the first and second sample sets are text data describing individual attributes. In this case, the samples in the first and second sample sets are used to describe the attributes of individuals in different categories. For example, the samples in the first sample set are used to describe the attributes of individuals belonging to category A, category B, or category C, while the samples in the second sample set are used to describe the attributes of individuals in category D or category E.
[0131] 303. Train the first encoding sub-model using the second sample set to obtain a second encoding sub-model.
[0132] The second sample set is encoded using the first encoding sub-model in the first classification prediction model to obtain a sixth vector. The sixth vector is mapped into a seventh vector using the second mapping sub-model in the first classification prediction model. The seventh vector is input into the first classification sub-model included in the first classification prediction model to obtain a first predicted classification result output by the first classification sub-model. Based on the first predicted classification result output by the first classification sub-model, the model parameters of the first encoding sub-model are iteratively updated until the first predicted classification result output by the first classification sub-model matches the actual classification result of the second sample set, thereby obtaining a second encoding sub-model.
[0133] Since the model parameters of the first encoding sub-model are iteratively updated, after each update of the model parameters of the first encoding sub-model, the second sample set is encoded using the first encoding sub-model after the updated model parameters to obtain a sixth vector. The sixth vector is then mapped into a seventh vector using the second mapping sub-model, and the seventh vector is input into the first classification sub-model to obtain a first predicted classification result. If the first predicted classification result matches the actual classification result of the second sample set, the iterative update of the model parameters of the first encoding sub-model is stopped, and the first encoding sub-model at this point is used as the second encoding sub-model. If the first predicted classification result does not match the actual classification result of the second sample set, the above process is repeated after updating the model parameters of the first encoding sub-model until the first predicted classification result output by the first classification sub-model matches the actual classification result of the second sample set.
[0134] 304. Obtain a mapping sample set.
[0135] The mapping sample set includes at least one sample, and the samples in the mapping sample set have the same data type as the samples in the first sample set and the second sample set, ensuring that the first encoding sub-model and the second encoding sub-model can encode the mapping sample set into corresponding vectors. For example, if the samples in the first sample set and the second sample set are text data used to describe individual attributes, then the samples in the mapping sample set are also text data used to describe individual attributes.
[0136] In a possible implementation, samples in the mapping sample set are randomly acquired. For example, according to the data types of the samples in the first sample set and the second sample set, 10,000 samples are randomly acquired as the mapping sample set.
[0137] In another possible implementation, the mapping sample set is a subset of the first sample set, that is, the samples in the mapping sample set are obtained from the first sample set. Depending on the number of sub-sample sets included in the first sample set, the mapping sample set has different composition forms. The composition form of the mapping sample set is described below with reference to the above step 301.
[0138] When the samples in the first sample set have the same source, that is, when the first classification prediction model is obtained by training the first sample set once, the mapping sample set includes all or part of the samples in the first sample set. Optionally, after obtaining the first classification prediction model through training the first sample set, a certain number of samples are randomly selected from the first sample set, and each of the selected samples is used as the mapping sample set. For example, after obtaining the first classification prediction model through training the first sample set, 10,000 samples are randomly selected from the first sample set, and the selected 10,000 samples are used as the mapping sample set.
[0139] When the first sample set includes at least two subsample sets, that is, when the first classification prediction model is obtained by sequentially training the subsample sets included in the first sample set, the mapping sample set then includes at least two submapped sample sets, each submapped sample set corresponds to a subsample set included in the first sample set, different submapped sample sets correspond to different subsample sets, and each submapped sample set includes all or part of the samples in the corresponding subsample. Optionally, after training the first classification prediction model using a subsample set, a certain number of samples are randomly selected from the subsample set as the submapped sample set corresponding to the subsample set, and then the submapped sample set corresponding to the subsample set and the submapped sample set corresponding to the subsample set before the subsample set are used as mapping sample sets.
[0140] For example, the first sample set includes k subsample sets. When the first classification prediction model is trained by the kth subsample set in the first sample set, some samples are randomly selected from the kth subsample set as the sub-mapping sample set R corresponding to the kth subsample set. k Similarly, we can obtain the sub-mapped sample sets R1~R corresponding to the first k-1 sub-sample sets in the first sample set. k-1 , so the obtained mapping sample set is {R1, R2, R3, ..., R k}.
[0141] It should be noted that when a mapping sample set includes multiple sub-mapping sample sets, the number of samples included in different sub-mapping sample sets is the same or different. In one possible implementation, a fixed number of samples are randomly selected from each sub-sample set as the sub-mapping sample set corresponding to the sample set. At this time, each sub-mapping sample set includes the same number of samples, for example, 10,000 samples are randomly selected from each sub-sample set as the sub-mapping sample set. In another possible implementation, for each sub-sample set, based on the number of samples in the sub-sample set, samples are randomly selected from the sub-sample set so that the ratio of the number of selected samples to the number of samples in the sub-sample set is equal to a preset percentage, and then the selected samples are used as the sub-mapping sample set corresponding to the sub-sample set. For example, for each sub-sample set, samples equal to 1% of the number of samples in the sub-sample set are randomly selected from the sub-sample set as the sub-mapping sample set corresponding to the sub-sample set.
[0142] When the mapping sample set includes all or part of the samples in the first sample set, after the first classification prediction model is obtained through training with the first sample set, the mapping sample set selected from the first sample set is stored in the first storage space, and then when the mapping sample set is obtained, the mapping sample set is read from the first storage space. Optionally, the first storage space on a device is used not only to store the mapping sample set, but also to store the model file of the first classification prediction model. When the prediction model needs to be deployed on other devices, the mapping sample set and the model file of the first classification prediction model in the first storage space are copied together to the device where the prediction model needs to be deployed.
[0143] In some application scenarios, for data security and privacy reasons, not all samples in the first sample set can be copied. For example, the samples used to train the classification prediction model used by unit A cannot be copied to unit B as a mapping dataset to train the classification prediction model used by unit B. To this end, the mapping dataset only includes some samples in the first sample set, thereby meeting the user's requirements for data security and privacy.
[0144] 305. Encode the mapping sample set using a second encoding sub-model to obtain a first vector.
[0145] After obtaining the mapping sample set, the mapping sample set is encoded using the second coding sub-model to obtain a first vector. Those skilled in the art will appreciate that, since the mapping sample set includes multiple samples, encoding the mapping sample set by the second coding sub-model means encoding each sample included in the mapping sample set separately to obtain a vector corresponding to each sample in the mapping sample set. Therefore, the first vector does not refer to a single vector, but rather to a set of vectors including the vectors obtained by encoding each sample in the mapping sample set using the second coding sub-model.
[0146] Since the data types of the samples in the mapping sample set, the first sample set, and the second sample set are the same, and the second encoding sub-model is trained based on the first and second sample sets, the second encoding sub-model can encode the mapping sample set into a first vector. For example, when the samples in the mapping sample set, the first sample set, and the second sample set are all text data, the first encoding sub-model is a BiLSTM model, and the corresponding second encoding sub-model is also a BiLSTM model. When encoding the mapping sample set using the second encoding sub-model, each sample in the mapping sample set is first segmented, and then the obtained segmentation is input into the second encoding sub-model. The second encoding sub-model encodes the sample in two directions and concatenates the codes in the two directions as the vector corresponding to the sample.
[0147] For example, referring to the above step 304, the mapping sample set is {R1, R2, R3, ..., Rk}, the mapped sample set is encoded by the second encoding sub-model, and the first vector obtained is {E1, E2, E3, ..., E k}.
[0148] 306. Obtain a second vector obtained by encoding the mapping sample set using the first encoding sub-model.
[0149] In one possible implementation, after obtaining the mapping sample set, the mapping sample set is encoded using the first coding sub-model to obtain the second vector. It should be noted that the method for encoding the mapping sample set using the first coding sub-model is similar to the method for encoding the mapping sample set using the second coding sub-model in step 305 above.
[0150] In another possible implementation, when the first sample set includes at least two subsample sets, that is, when the first classification prediction model is obtained by sequentially training the subsample sets included in the first sample set, during the process of training the first classification prediction model using the last subsample set in the first sample set, the first encoding submodel encodes the mapping sample set to obtain a second vector, and the obtained second vector is stored in the second storage space. Subsequently, when obtaining the second vector obtained by encoding the mapping sample set using the first encoding submodel, the second vector is read from the second storage space.
[0151] Optionally, the second storage space on a device is the same as the first storage space, that is, the first storage space / second storage space is used to store the mapping sample set, the model file of the first classification prediction model, and the second vector. When the classification prediction model needs to be deployed on another device, the mapping sample set, the model file of the first classification prediction model, and the second vector in the first storage space / second storage space are copied to the device where the classification prediction model needs to be deployed.
[0152] In the process of training the first classification prediction model through the first sample set, the mapping sample set is encoded through the first encoding sub-model to obtain a second vector, and the obtained second vector is stored in the second storage space. In the process of training the first classification prediction model through the second sample set to obtain the second classification prediction model, the second vector is directly read from the second storage space without the need to encode the mapping sample set again through the first encoding sub-model to obtain the second vector, which can improve the efficiency of classification prediction model training.
[0153] For example, referring to the above step 304, the mapping sample set is {R1, R2, R3, ..., R k}, the second vector obtained by encoding the mapped sample set through the first coding sub-model is {E′1, E′2, E′3, …, E′ k}.
[0154] 307. Train a first mapping sub-model using the first vector and the second vector.
[0155] After obtaining the first vector and the second vector, the first mapping sub-model is trained using the first vector and the second vector. After the trained first mapping sub-model maps the first vector to a third vector, a difference between the third vector and the second vector is less than a loss threshold.
[0156] When the first encoding sub-model is trained using the second sample set to obtain the second encoding sub-model, the knowledge learned by the second encoding sub-model in the first sample set will be overwritten by the knowledge learned in the second sample set, resulting in a decrease in the performance of the second encoding sub-model on the first sample set. Therefore, for the same sample, the two vectors obtained by encoding the sample using the first encoding sub-model and the second encoding sub-model are quite different. By training the first mapping sub-model, the first mapping sub-model maps the vector encoded by the second encoding sub-model into another vector. The vector mapped by the first mapping sub-model is the same as or similar to the vector encoded by the first encoding sub-model. Therefore, while the second encoding sub-model learns knowledge from the second sample set, it will not overwrite the knowledge learned in the first sample set. This avoids catastrophic forgetting during the training of the classification prediction model and allows the performance on the first sample set to be maintained while optimizing the model parameters for the second sample set.
[0157] In one possible implementation, when a first classification prediction model is obtained through a first sample set training, the first classification prediction model only includes a first encoding sub-model and a first classification sub-model. At this time, iterative training is performed based on the first vector and the second vector to obtain a first mapping sub-model, so that the trained first mapping sub-model can map the first vector to a third vector, and the difference between the third vector and the second vector is less than the loss threshold.
[0158] In another possible implementation, when a first classification prediction model is obtained by sequentially training the sub-sample sets included in the first sample set, the first classification prediction model includes a first encoding sub-model, a second mapping sub-model, and a first classification sub-model. At this time, the first vector is input into the second mapping sub-model to obtain a third vector output by the second mapping sub-model. The second vector and the third vector are input into the loss function. The model parameters of the second mapping sub-model are iteratively updated to minimize the loss function. When the loss function is minimized, the iterative update of the model parameters of the second mapping sub-model is stopped, and the second mapping sub-model at this time is determined as the first mapping sub-model. It should be noted that when the loss function is minimized, the minimum value output by the loss function is less than the loss threshold.
[0159] 308. Encode the second sample set into a fourth vector using a second encoding sub-model.
[0160] After obtaining the second coding sub-model, the second sample set is encoded into a fourth vector using the second coding sub-model. Those skilled in the art will appreciate that, since the second sample set includes multiple samples, encoding the second sample set by the second coding sub-model means encoding each sample included in the second sample set separately to obtain a vector corresponding to each sample in the second sample set. Therefore, the fourth vector does not refer to a single vector, but rather to a set of vectors including the vectors obtained by encoding each sample in the second sample set using the second coding sub-model.
[0161] Referring to the above step 305, when the second encoding sub-model is a BiLSTM model and the samples in the second sample set are text data, when the second sample set is encoded by the second encoding sub-model, for each sample in the second sample set, the sample is first segmented, and then the obtained segmentation is input into the second encoding sub-model. The second encoding sub-model encodes the sample in two directions, and splices the codes in the two directions to obtain a vector corresponding to the sample, and then determines the set of vectors corresponding to each sample in the second sample set as the fourth vector.
[0162] It should be noted that step 308 and steps 304 to 307 may be executed simultaneously or in the current order, or steps 304 to 307 may be executed first and then step 308.
[0163] 309. Map the fourth vector to a fifth vector through the first mapping sub-model.
[0164] After the first mapping sub-model is trained and the fourth vector is obtained, the fourth vector is input into the first mapping sub-model, which then maps the fourth vector into a fifth vector. Referring to step 308 above, since the fourth vector is a vector set comprising multiple vectors, when the first mapping sub-model is used to map the fourth vector into the fifth vector, each vector included in the fourth vector is input into the first mapping sub-model to obtain a vector mapped by the first mapping sub-model. The set comprising the vectors mapped by the first mapping sub-model is then determined as the fifth vector.
[0165] 310. Train the first classification sub-model using the fifth vector to obtain a second classification sub-model.
[0166] The second sample set includes multiple samples and a label corresponding to each sample. The label is the actual classification result of the corresponding sample. For example, to train a classification prediction model to predict the category of an individual based on text data describing individual attributes, the samples in the second sample set are text data describing individual attributes, and the labels of the samples are the categories to which the corresponding individuals belong.
[0167] For each vector included in the fifth vector, the vector and the label of the sample corresponding to the vector are used as training data, and then the first classification sub-model is trained through each training data to optimize the model parameters of the first classification sub-model and obtain the second classification sub-model, so that after the vector included in the fifth vector is input into the second classification sub-model, the second classification sub-model can output the label of the sample corresponding to the corresponding vector.
[0168] 311. Construct a second classification prediction model through the second encoding sub-model, the first mapping sub-model and the second classification sub-model. The second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
[0169] After the second encoding sub-model, the first mapping sub-model, and the second classification sub-model are obtained through training, a second classification prediction model including the second encoding sub-model, the first mapping sub-model, and the second classification sub-model is obtained. The second classification prediction model can perform classification prediction based on target data having the same source as the second sample set, and output a relatively accurate prediction classification result. The second classification prediction model can also perform classification prediction based on target data having the same source as the first sample set, and output a relatively accurate prediction classification result.
[0170] When performing classification prediction through the second classification prediction model, the target data is first input into the second encoding sub-model for encoding to obtain the vector output by the second encoding sub-model, and then the vector output by the second encoding sub-model is input into the first mapping sub-model for mapping to obtain the vector output by the first mapping sub-model, and then the vector output by the first mapping sub-model is input into the second classification sub-model to obtain the predicted classification result output by the second classification sub-model.
[0171] It should be noted that all optional technical solutions in the above-mentioned method embodiments can be arbitrarily combined to form optional embodiments of the present application, and will not be described one by one here.
[0172] For ease of understanding, the following describes in detail the training method of the classification prediction model provided in the embodiment of the present application, taking the training of a classification prediction model that can perform classification prediction based on the chief complaint text in the medical record as an example.
[0173] The chief complaint in medical records refers to the patient's main symptoms and needs, recorded concisely by the doctor based on the patient's interview. For example, "Nausea for more than a week after catching a cold." Because the chief complaint is text data, complex processing such as structuring the medical records is unnecessary during model training.
[0174] Assume that there is a task sequence consisting of n tasks defined as {T1, T2, T3, ..., T n}, where each task T kBoth are supervised disease prediction and classification tasks, but the disease categories in each task are different. Figure 4 This is a schematic diagram of the training process of a classification prediction model provided in an embodiment of the present application, see Figure 4 The data for the first task includes text describing diseases such as rhinitis and diarrhea, while the data for the second task includes text describing diseases such as acne and dental caries. The division of task sequences has corresponding methods based on different application scenarios. For example, in the scenario of primary care assistant diagnosis, considering the difference in the distribution of cases received by primary care hospitals and key hospitals, different tasks are divided according to the severity of the disease (common diseases are matched to primary care hospitals, and serious and difficult diseases are matched to key hospitals).
[0175] When traditional machine learning models learn multiple tasks in a sequence, they will have various forgetting problems, that is, the performance of the previous task will drop significantly. The embodiment of the present application only trains one prediction model and trains it on the data of different tasks in sequence. That is, when training the data of the kth task, the model parameters of the prediction model are based on T k The data is optimized, but the performance on the first k-1 tasks is maintained. Therefore, the average accuracy of the trained prediction model on all tasks is used as the evaluation indicator of the prediction model, as shown in the following formula:
[0176]
[0177] Among them, acc f,k It is used to represent the accuracy of the trained classification prediction model f on task k, and K is used to represent the number of tasks. Used to represent the average accuracy of the trained classification prediction model on all tasks.
[0178] When training each task, the chief complaint text in the medical record is first segmented and fed into the BiLSTM model. The BiLSTM model then encodes the chief complaint text in two directions simultaneously and concatenates the encodings in both directions as a vector representation of the chief complaint text. As the number of training iterations increases, each task develops its own high-dimensional representation space. Each task's representation space is unique, and model parameters optimized for k tasks cannot preserve the text features of k-1 tasks. Therefore, a mapping module is trained to unify the text features of each task to accommodate all k tasks.
[0179] Figure 5 This is a schematic diagram of a main complaint text provided in the embodiment of this application, see Figure 5For the descriptive texts of two diseases, pneumonia and lung cancer, belonging to two tasks, which share the symptom attributes of coughing and sputum production, the mapping module unifies these similar text features into a unified representation space for lung diseases. Similarly, within a complete medical disease system, most text features are mapped to a common representation space, rather than retaining their specific representations for different diseases.
[0180] For the classification prediction model including the mapping module, the classification prediction model encodes the main complaint text into a vector at the encoding layer, and the mapping module maps the vector encoded by the encoding layer into a vector in a unified high-dimensional space. This process can be expressed as the following formula:
[0181]
[0182] Among them, x c The sample used to represent the input, h c The vector used to represent the sample after passing through the encoding layer, z c Used to represent the vector after encoding and mapping, Used to represent the encoding sub-model in the trained classification prediction model, Used to represent the mapping sub-model in the trained prediction model, namely the mapping module.
[0183] During the training process of the classification prediction model, the classification prediction model retains a small amount of data for each task as memory, which also serves as the training target for the mapping module. The retained data is not only retained in the form of original text, but also retained in the representation form of the respective task vector space.
[0184] When training for each task, we first take a part of the complete dataset as the training set, and then randomly select a smaller subset from the complete dataset for training the mapping model. For the kth task, the randomly selected subset is R k , R k The high-dimensional vector representation after the k-th task training is defined as E k ', similarly, after the training of the first k-1 tasks is completed, the selected subsets and corresponding high-dimensional vector representations are {R1, R2, R3, ..., R k-1} and {E1',E2',E3',…,E k-1 '}. After the k+1th task training is completed, {R1,R2,R3,…,R k} is input into the encoding layer to obtain the corresponding high-dimensional vector {E1, E2, E3, ..., E k}, then the above sets of high-dimensional vectors constitute the training data (X, Y) for the mapping layer, namely {(E1,E1'),(E2,E2'),(E3,E3'),…,(Ek ,E k ')}.
[0185] In summary, for the training of the mapping layer, the high-dimensional vector of the previous task is used as the target to map the optimized encoding result on the new task to a high-dimensional space compatible with all previous tasks.
[0186] Training the classification prediction model is a two-step process: the first step is training the encoding layer, and the second step is training the mapping layer. This two-step training ensures the model's performance on both the current task and all previous tasks. For example, the first step, training the encoding layer, allows the classification prediction model to learn context-specific linguistic features from the data for the current task. The second step targets the vector representation of the previous moment in time to obtain a vector representation that is universal across all tasks.
[0187] In the first step of training, the loss function is designed based on the result of the classifier in the last step. After the mapping layer processing, the vector representation is used as the input of the classifier. The linear layer and softmax function are used in the classifier for classification operation, and the following function can be obtained:
[0188]
[0189] Among them, x is used to represent the original input data, z is used to represent the encoded and mapped vector, y is used to represent the classification label, p(y=l|x;W clf ) is used to represent the probability that x is classified as l. Used to represent the model function trained using linear layers and softmax functions.
[0190] The loss function at this step is:
[0191]
[0192] in, Used to represent the vector z based on encoding and mapping i The prediction results obtained are consistent with the label y i The difference between The initial model parameters used to characterize the encoding sub-model encoding the original data, Model parameters used to characterize the BiLSTM model, Model parameters used to characterize the mapping sub-model, W clf The model parameters used to characterize the classification sub-model. When minimizing this function, the mapping layer parameters Exclude from the parameter collection.
[0193] In the second step of training, the model only updates the parameters corresponding to the mapping layer. The specific loss function is as follows:
[0194]
[0195] Among them, α is used to represent the mapping strength of the preset hyperparameter control to the vector. Used to characterize the mapping layer function.
[0196] Figure 6 This is a comparison diagram of prediction results provided in the embodiment of the present application, see Figure 6 , Curve Q2 corresponds to the EWC prediction model, which adopts a solution of setting constraints on the loss to avoid catastrophic forgetting, that is, when training each task, the EWC prediction model will add a regularization term to the loss function to limit the parameters in the model to be optimized in a direction compatible with all tasks. Curve Q3 corresponds to the AGEM prediction model, which performs quadratic programming on the gradient of each parameter, and records the loss of the current model on the previous task in the gradient of this update. The prediction model corresponding to curve Q4 is updated directly on the new task without adopting any strategy to avoid forgetting. Curve Q1 corresponds to the prediction model trained by the method provided in the embodiment of the present application. It should be noted that, Figure 6 The horizontal axis of the coordinate system shown is the number of tasks, and the vertical axis is the accuracy of the classification model.
[0197] See also Figure 6 , the classification prediction model trained by the method provided in the embodiment of the present application outperforms the other three schemes in performance. EWC performs poorly in NLP tasks because the EWC scheme only constrains the loss, and in NLP tasks and commonly used neural networks (RNN, LSTM), the loss and gradient will gradually weaken as the time series is returned, so the constraints at the loss level are difficult to act on the optimization of NLP-related neural networks. The training method of the classification prediction model provided in the embodiment of the present application directly maps the text vector representation, avoiding the gradient disappearance problem that often occurs in NLP tasks. For the AGEM model, although its solution of constraining at the gradient level also solves the problems faced by the above-mentioned EWC, due to the introduction of quadratic programming, when the number of model parameters is large, the computational complexity of AGEM will be significantly improved, which greatly limits its application value in actual scenarios. The training method of the classification prediction model provided in the embodiment of the present application uses a relatively lightweight model and does not require too much computing power for mapping the vector space, and has better performance in the medical field.
[0198] The training method of the classification prediction model provided in the embodiment of the present application only requires medical record data and takes the text of the chief complaint as input, and has a low demand for data. When the trained classification prediction model is connected to a new hospital or an iterative version, it only needs to be trained on the new data, and there is no need to retain a large amount of relevant data. The training of the classification prediction model can even be completed under the premise that the data is not discharged from the hospital, thereby meeting the hospital's needs for protecting patient privacy. When connecting to a new hospital, there is no need to adjust the model structure of the classification prediction model, nor is it as costly as investing energy and time costs to retrain the model on a large scale. It only needs to be further optimized on the data set of the new hospital, thereby reducing costs.
[0199] Figure 7 This is a flow chart of a classification prediction method provided by an embodiment of the present application, see Figure 7 , the classification prediction method includes:
[0200] 701. Obtain target data for result prediction.
[0201] Since the target data will subsequently need to be predicted based on the second classification prediction model, the second classification prediction model is obtained by training the second sample set. The second encoding sub-model in the second classification prediction model can identify the data type of the samples in the second sample set and encode the samples in the second sample set into corresponding vectors. To ensure that the input target data can be encoded into corresponding vectors by the second encoding sub-model, the target data should have the same data type as the samples in the first sample set and the second sample set. For example, if the samples in the first sample set and the second sample set are text data used to describe individual attributes, then the target data is also text data used to describe individual attributes.
[0202] In one possible implementation, since the second classification prediction model is obtained through training on the second sample set, and data from the same source usually have the same data format, in order to ensure the accuracy of the second classification prediction model in predicting the target data, the target data and the second sample set have the same source. For example, the samples in the first sample set all come from unit A, and the samples in the second sample set all come from unit B. The samples in the first sample set and the second sample set are all text data used to describe individual attributes, but the data formats of the samples from units A and B are not exactly the same. For example, the order and naming of individual attributes in the text data are different. After the second classification prediction model is obtained through training on the second sample set, unit B predicts the results through the second classification prediction model. Subsequently, the target data generated or obtained by unit B is input into the second classification prediction model for result prediction. Since the target data and the samples in the second sample set have the same data format, the accuracy of the predicted classification results can be further guaranteed.
[0203] 702. Obtain a second classification prediction model.
[0204] The second classification prediction model includes a second encoding sub-model, a first mapping sub-model and a second classification sub-model. The second classification prediction model is obtained based on the second sample set and the first classification prediction model. The first classification prediction model is obtained by training the first sample set. The first classification prediction model includes the first encoding sub-model and the first classification sub-model. The difference between the third vector obtained by the first mapping sub-model mapping the first vector and the second vector is less than the loss threshold. The first vector is obtained by encoding the mapping sample set by the second encoding sub-model, and the second vector is obtained by encoding the mapping sample set by the first encoding sub-model.
[0205] In a possible implementation, the second classification prediction model is the second classification prediction model trained in any of the above-mentioned classification prediction model training method embodiments.
[0206] 703. Encode the target data using the second encoding sub-model to obtain a first target vector.
[0207] After obtaining the second classification prediction model and target data, the target data is input into the second encoding sub-model in the second classification prediction model, and the second encoding sub-model encodes the target data to obtain the first target vector output by the second encoding sub-model.
[0208] In one possible implementation, the target data is text data used to describe individual attributes. In this case, the second encoding sub-model is a BiLSTM model. When encoding the target data through the second encoding sub-model, the target data is first segmented, and then the obtained segmented words are input into the second encoding sub-model. The second encoding sub-model encodes the target data in two directions and concatenates the codes in the two directions as the first target vector.
[0209] 704. Map the first target vector to a second target vector through the first mapping sub-model.
[0210] After obtaining the first target vector output by the second encoding sub-model, the obtained first target vector is input into the first mapping sub-model, and the first mapping sub-model maps the first target vector into the second target vector.
[0211] 705. Input the second target vector into the second classification sub-model to obtain a second predicted classification result output by the second classification sub-model, and use the second predicted classification result as the classification result of the target data.
[0212] Exemplarily, after the first mapping sub-model maps the first target vector to the second target vector, the second target vector is input into the second classification sub-model. The second classification sub-model outputs a predicted classification result based on the second target vector. The predicted classification result is the label of the category to which the target data belongs.
[0213] For example, the target data is text data describing defects in cars produced by a car factory. After the second target vector is input into the second classification sub-model, the prediction solution output by the second classification sub-model is the fault location of the car production line.
[0214] The solution provided in the embodiment of the present application is that the second classification prediction model is obtained based on the second sample set and the first classification prediction model. The second encoding sub-model included in the second classification prediction model can encode the mapped sample set into a first vector, the first encoding sub-model included in the first classification prediction model can encode the mapped sample set into a second vector, and the first mapping sub-model included in the second classification prediction model can map the first vector into a third vector. The difference between the second vector and the third vector is less than the loss threshold. Due to the first mapping sub-model included in the second classification prediction model, when the first classification prediction model is optimized by the second sample set to obtain the second classification prediction model, the performance of the second classification prediction model on the first sample set will not decrease. Therefore, when classification prediction is performed by the second classification prediction model, the accuracy of the predicted classification results can be improved.
[0215] It should be noted that all optional technical solutions in the above-mentioned method embodiments can be arbitrarily combined to form optional embodiments of the present application, and will not be described one by one here.
[0216] Figure 8 This is a structural diagram of a training device for a classification prediction model provided in an embodiment of the present application, see Figure 8 , the device comprises:
[0217] A first acquisition module 801 is configured to acquire a first classification prediction model obtained by training with a first sample set, wherein the first classification prediction model includes a first encoding sub-model and a first classification sub-model;
[0218] The encoding training module 802 is configured to train the first encoding sub-model using a second sample set to obtain a second encoding sub-model, where the second sample set and the first sample set are extracted from multimedia data, and the second sample set and the first sample set have different sources; the multimedia data includes at least one of text, video, image, or audio data;
[0219] A first encoding module 803 is configured to encode the mapping sample set using a second encoding sub-model to obtain a first vector;
[0220] a mapping training module 804 configured to train a first mapping sub-model using the first vector and the second vector, the second vector being obtained by encoding the mapping sample set using the first encoding sub-model, the difference between the second vector and a third vector being less than a loss threshold, and the third vector being obtained by mapping the first vector using the first mapping sub-model;
[0221] The first encoding module 803 is further configured to encode the second sample set into a fourth vector using a second encoding sub-model;
[0222] A first mapping module 805 is configured to map the fourth vector to a fifth vector using a first mapping sub-model;
[0223] a classification training module 806, configured to train the first classification sub-model using the fifth vector to obtain a second classification sub-model;
[0224] The construction module 807 is used to construct a second classification prediction model through the second encoding sub-model, the first mapping sub-model and the second classification sub-model. The second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
[0225] In the device provided by the embodiment of the present application, the encoding training module trains the first encoding sub-model through the second sample set. After obtaining the second encoding sub-model, the mapping training module trains the first mapping sub-model based on the encoding results of the first encoding sub-model and the second encoding sub-model for the same mapping sample set. After the first encoding sub-model and the second encoding sub-model encode the same sample into a vector, the first mapping sub-model can map the vector encoded by the second encoding sub-model to another vector, and the difference between the vector mapped by the first mapping sub-model and the vector encoded by the first encoding sub-model is less than the loss threshold, that is, after the first classification prediction model is optimized based on the second sample set to obtain the second classification prediction model, the second classification prediction model still retains the knowledge learned in the first sample set, thereby avoiding catastrophic forgetting during the training process of the classification prediction model, thereby improving the accuracy of the trained classification prediction model.
[0226] In one possible implementation, the encoding training module 802 is configured to perform the following processing:
[0227] Encoding the second sample set using the first encoding sub-model to obtain a sixth vector;
[0228] Obtaining a first predicted classification result output by the first classification sub-model based on the sixth vector;
[0229] According to the first predicted classification result, the model parameters of the first encoding sub-model are iteratively updated until the first predicted classification result matches the actual classification result of the second sample set, thereby obtaining the second encoding sub-model.
[0230] In a possible implementation, the mapping sample set includes all or part of the samples in the first sample set, the mapping sample set is read from the first storage space, and the mapping sample set is stored in the first storage space after the first classification prediction model is obtained through training.
[0231] In a possible implementation, the second vector is read from the second storage space, and the second vector is stored in the second storage space after the first classification prediction model is obtained through training.
[0232] In one possible implementation, the first sample set includes at least two sub-sample sets, and different sub-sample sets have different sources; the first classification prediction model is obtained by sequentially training at least two sub-sample sets, and the method of training the first classification prediction model through each sub-sample set is the same as the method of training the second classification prediction model through the second sample set.
[0233] In one possible implementation, the first classification prediction model further includes a second mapping sub-model;
[0234] The mapping training module 804 is configured to iteratively train the second mapping sub-model using the first vector as input until the difference between the third vector output by the second mapping sub-model and the second vector is less than a loss threshold.
[0235] In one possible implementation, the mapping training module 804 is configured to perform the following processing:
[0236] Input the first vector into the second mapping sub-model to obtain a third vector output by the second mapping sub-model;
[0237] Input the second and third vectors into the loss function;
[0238] The model parameters of the second mapping sub-model are iteratively updated to minimize the loss function until the loss function outputs a minimum value, and the first mapping sub-model is obtained, and the minimum value output by the loss function is less than the loss threshold.
[0239] In a possible implementation, the mapping sample set includes at least two sub-mapping sample sets, each sub-mapping sample set corresponds to a sub-sample set, different sub-mapping sample sets correspond to different sub-sample sets, and the sub-mapping sample set includes all or part of the samples in the corresponding sub-sample set.
[0240] In one possible implementation, Figure 9 This is a schematic diagram of another classification prediction model training device provided in an embodiment of the present application, see Figure 9 , the device further comprises:
[0241] The model evaluation module 808 is used to obtain the first accuracy of the second classification prediction model for each sub-sample set, obtain the second accuracy of the second classification prediction model for the second sample set, and determine the average of the first accuracy and the second accuracy as the prediction accuracy of the second classification prediction model.
[0242] In an embodiment of the present application, since the second classification prediction model does not overwrite the knowledge previously learned in the first sample set after learning new knowledge from the second sample set, the second classification prediction model can predict the samples in the first sample set and the second sample set. The average of the first accuracy rate and the second accuracy rate is used as the prediction accuracy rate of the second classification prediction model, which can more objectively evaluate the accuracy of the classification prediction of the second classification prediction model.
[0243] In one possible implementation, the first encoding sub-model includes a bidirectional long short-term memory network BiLSTM model.
[0244] It should be noted that the modules included in the classification prediction model training device provided in the embodiment of the present application can perform the processing in the above-mentioned classification prediction model training method embodiment. Therefore, the specific processing process of each module can refer to the description in the above-mentioned classification prediction model training method embodiment, and will not be repeated here.
[0245] Figure 10 This is a structural diagram of a classification prediction device provided in an embodiment of the present application, see Figure 10 , the device comprises:
[0246] The second acquisition module 1001 is used to acquire target data for result prediction;
[0247] A third acquisition module 1002 is configured to acquire a second classification prediction model, the second classification prediction model including a second encoding sub-model, a first mapping sub-model, and a second classification sub-model, the second classification prediction model being obtained based on the second sample set and the first classification prediction model, the first classification prediction model being obtained by training the first sample set, the first classification prediction model including the first encoding sub-model and the first classification sub-model, the difference between a second vector obtained by mapping the first vector by the first mapping sub-model and a third vector obtained by encoding the mapped sample set by the first encoding sub-model being less than a loss threshold, the first vector being obtained by encoding the mapped sample set by the second encoding sub-model; the second sample set and the first sample set being extracted from multimedia data, the first sample set and the second sample set being from different sources, the multimedia data including at least one type of data selected from text, video, image, or audio;
[0248] A second encoding module 1003 is configured to encode the target data using a second encoding sub-model to obtain a first target vector;
[0249] A second mapping module 1004 is configured to map the first target vector to a second target vector using the first mapping sub-model;
[0250] The classification module 1005 is used to input the second target vector into the second classification sub-model, obtain a second predicted classification result output by the second classification sub-model, and use the second predicted classification result as the classification result of the target data.
[0251] In an embodiment of the present application, the second encoding module 1003 encodes the target data through the second encoding sub-model, and after obtaining the first target vector, the second mapping module 1004 maps the first target vector to the second target vector through the first mapping sub-model. Since the first encoding sub-model and the second encoding sub-model encode the same sample into a vector, the first mapping sub-model can map the vector encoded by the second encoding sub-model to another vector, and the difference between the vector mapped by the first mapping sub-model and the vector encoded by the first encoding sub-model is less than the loss threshold, that is, after the first classification prediction model is optimized based on the second sample set to obtain the second classification prediction model, the second classification prediction model still retains the knowledge learned in the first sample set, and therefore can avoid catastrophic forgetting during the training process of the classification prediction model, thereby improving the accuracy of the trained classification prediction model.
[0252] It should be noted that the modules included in the classification prediction device provided in the embodiment of the present application can perform the processing in the above-mentioned classification prediction method embodiment. Therefore, the specific processing process of each module can refer to the description in the above-mentioned classification prediction method embodiment, and will not be repeated here.
[0253] The present application provides a computer device for executing the methods provided in the above embodiments. The computer device may be implemented as a terminal or a server. The structure of the terminal is described below.
[0254] Figure 11 1 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal 1100 may be a smartphone, tablet computer, laptop computer, or desktop computer. The terminal 1100 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.
[0255] Typically, the terminal 1100 includes: one or more processors 1101 and one or more memories 1102 .
[0256] The processor 1101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1101 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1101 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0257] The memory 1102 may include one or more computer-readable storage media, which may be non-transitory. The memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1102 is used to store at least one computer program, which is used to be executed by the processor 1101 to implement the training method or classification prediction method of the classification prediction model provided in the method embodiment of the present application.
[0258] In some embodiments, terminal 1100 may optionally include a peripheral device interface 1103 and at least one peripheral device. Processor 1101, memory 1102, and peripheral device interface 1103 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 1103 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, a positioning assembly 1108, and a power supply 1109.
[0259] The peripheral device interface 1103 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 1101 and the memory 1102. In some embodiments, the processor 1101, the memory 1102, and the peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1101, the memory 1102, and the peripheral device interface 1103 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0260] RF circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. RF circuit 1104 may optionally include an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like.
[0261] Display screen 1105 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1105 is a touch screen display, display screen 1105 is also capable of collecting touch signals on or above the surface of display screen 1105. The touch signals can be input as control signals to processor 1101 for processing. In this case, display screen 1105 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards.
[0262] The camera assembly 1106 is used to collect images or videos. Optionally, the camera assembly 1106 includes a front camera and a rear camera. Typically, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal.
[0263] The audio circuit 1107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input to the processor 1101 for processing, or input to the radio frequency circuit 1104 for voice communication.
[0264] The positioning component 1108 is used to locate the current geographical location of the terminal 1100 to implement navigation or LBS (Location Based Service).
[0265] The power supply 1109 is used to supply power to various components in the terminal 1100. The power supply 1109 can be alternating current, direct current, a disposable battery, or a rechargeable battery.
[0266] In some embodiments, the terminal 1100 further includes one or more sensors 1110 , including but not limited to: an acceleration sensor 1111 , a gyroscope sensor 1112 , a pressure sensor 1113 , a fingerprint sensor 1114 , an optical sensor 1115 , and a proximity sensor 1116 .
[0267] The acceleration sensor 1111 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established with the terminal 1100 .
[0268] The gyroscope sensor 1112 can detect the body direction and rotation angle of the terminal 1100 . The gyroscope sensor 1112 can cooperate with the acceleration sensor 1111 to collect the user's 3D actions on the terminal 1100 .
[0269] The pressure sensor 1113 can be provided on the side frame of the terminal 1100 and / or below the display screen 1105. When the pressure sensor 1113 is provided on the side frame of the terminal 1100, it can detect the user's gripping signal of the terminal 1100, and the processor 1101 can perform left and right hand recognition or shortcut operations based on the gripping signal collected by the pressure sensor 1113. When the pressure sensor 1113 is provided below the display screen 1105, the processor 1101 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1105.
[0270] The fingerprint sensor 1114 is used to collect the user's fingerprint, and the processor 1101 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 1114, or the fingerprint sensor 1114 identifies the user's identity based on the collected fingerprint.
[0271] The optical sensor 1115 is used to collect ambient light intensity. In one embodiment, the processor 1101 can control the display brightness of the display screen 1105 according to the ambient light intensity collected by the optical sensor 1115.
[0272] The proximity sensor 1116 is used to collect the distance between the user and the front of the terminal 1100 .
[0273] Those skilled in the art will understand that Figure 11 The structure shown in the figure does not constitute a limitation on the terminal 1100, and the terminal 1100 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0274] The above-mentioned computer device can also be implemented as a server. The structure of the server is introduced below:
[0275] Figure 12 This is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 1200 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1201 and one or more memories 1202, wherein at least one computer program is stored in one or more memories 1202, and at least one computer program is loaded and executed by one or more processors 1201 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server 1200 may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The server 1200 may also include other components for implementing device functions, which will not be described in detail here.
[0276] In an exemplary embodiment, a computer-readable storage medium is further provided, such as a memory including a computer program, wherein the computer program can be executed by a processor to implement the classification prediction model training method or classification prediction method in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0277] In an exemplary embodiment, a computer program product or computer program is also provided, which includes a program code, which is stored in a computer-readable storage medium. The processor of a computer device reads the program code from the computer-readable storage medium, and the processor executes the program code to complete the training method or classification prediction method of the classification prediction model in the above embodiment.
[0278] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0279] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A training method for a classification prediction model, characterized in that: include: Obtaining a first classification prediction model obtained by training with a first sample set, wherein the first classification prediction model includes a first encoding sub-model and a first classification sub-model; Training the first encoding sub-model using a second sample set to obtain a second encoding sub-model, where the second sample set and the first sample set are extracted from multimedia data, the first sample set and the second sample set having different sources, and the multimedia data includes at least one of text, video, image, or audio data; Encoding the mapping sample set by using the second encoding sub-model to obtain a first vector; A first mapping sub-model is trained using the first vector and the second vector, the second vector is obtained by encoding the mapping sample set using the first encoding sub-model, a difference between the second vector and a third vector is less than a loss threshold, and the third vector is obtained by mapping the first vector using the first mapping sub-model; encoding the second sample set into a fourth vector using the second encoding sub-model; Mapping the fourth vector into a fifth vector by using the first mapping sub-model; Training the first classification sub-model using the fifth vector to obtain a second classification sub-model; A second classification prediction model is constructed by the second encoding sub-model, the first mapping sub-model and the second classification sub-model, and the second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
2. The method according to claim 1, characterized in that The first encoding sub-model is trained using the second sample set to obtain a second encoding sub-model, including: Encoding the second sample set using the first encoding sub-model to obtain a sixth vector; Obtaining a first predicted classification result output by the first classification sub-model based on the sixth vector; According to the first predicted classification result, the model parameters of the first encoding sub-model are iteratively updated until the first predicted classification result matches the actual classification result of the second sample set, thereby obtaining the second encoding sub-model.
3. The method according to claim 1, characterized in that The mapping sample set includes all or part of the samples in the first sample set. The mapping sample set is read from the first storage space, and the mapping sample set is stored in the first storage space after the first classification prediction model is obtained through training.
4. The method according to claim 1, wherein The second vector is read from the second storage space, and the second vector is stored in the second storage space after the first classification prediction model is obtained through training.
5. The method according to any one of claims 1 to 4, characterized in that The first sample set includes at least two sub-sample sets, and different sub-sample sets have different sources; The first classification prediction model is obtained by sequentially training the at least two sub-sample sets, and the method of training the first classification prediction model through each sub-sample set is the same as the method of training the second classification prediction model through the second sample set.
6. The method according to claim 5, characterized in that The first classification prediction model also includes a second mapping sub-model; The training of the first mapping sub-model by using the first vector and the second vector includes: The second mapping sub-model is iteratively trained using the first vector as input until a difference between a third vector output by the second mapping sub-model and the second vector is less than the loss threshold.
7. The method according to claim 6, characterized in that The iteratively training the second mapping sub-model using the first vector as input until a difference between a third vector output by the second mapping sub-model and the second vector is less than the loss threshold includes: Inputting the first vector into the second mapping sub-model to obtain the third vector output by the second mapping sub-model; Inputting the second vector and the third vector into a loss function; Iteratively update the model parameters of the second mapping sub-model to minimize the loss function until the loss function outputs a minimum value, thereby obtaining the first mapping sub-model, and the minimum value output by the loss function is less than the loss threshold.
8. The method according to claim 5, characterized in that The mapping sample set includes at least two sub-mapping sample sets, each sub-mapping sample set corresponds to one sub-sample set, different sub-mapping sample sets correspond to different sub-sample sets, and the sub-mapping sample set includes all or part of the samples in the corresponding sub-sample set.
9. The method according to claim 5, characterized in that The method further comprises: Obtaining a first accuracy rate of prediction performed by the second classification prediction model on each of the subsample sets; Obtaining a second accuracy rate of prediction of the second sample set by the second classification prediction model; An average of the first accuracy rates and the second accuracy rates is determined as the prediction accuracy rate of the second classification prediction model.
10. A classification prediction method, characterized in that: include: Obtain target data for result prediction; Obtaining a second classification prediction model, where the second classification prediction model includes a second encoding sub-model, a first mapping sub-model, and a second classification sub-model, the second classification prediction model is obtained based on the second sample set and the first classification prediction model, the first classification prediction model is obtained by training the first sample set, the first classification prediction model includes the first encoding sub-model and the first classification sub-model, a difference between a second vector obtained by mapping the first vector by the first mapping sub-model and a third vector obtained by encoding the mapped sample set by the first encoding sub-model is less than a loss threshold, and the first vector is obtained by encoding the mapped sample set by the second encoding sub-model; the second sample set and the first sample set are extracted from multimedia data, and the first sample set and the second sample set have different sources, and the multimedia data includes at least one type of data selected from text, video, picture, or audio; encoding the target data using the second encoding sub-model to obtain a first target vector; Mapping the first target vector to a second target vector through the first mapping sub-model; The second target vector is input into the second classification sub-model to obtain a second predicted classification result output by the second classification sub-model, and the second predicted classification result is used as the classification result of the target data.
11. A training device for a classification prediction model, characterized in that: include: A first acquisition module is used to acquire a first classification prediction model obtained by training with a first sample set, wherein the first classification prediction model includes a first encoding sub-model and a first classification sub-model; an encoding training module, configured to train the first encoding sub-model using a second sample set to obtain a second encoding sub-model, wherein the second sample set and the first sample set are extracted from multimedia data, and the first sample set and the second sample set have different sources, and the multimedia data includes at least one type of data selected from text, video, image, or audio; A first encoding module, configured to encode the mapping sample set using the second encoding sub-model to obtain a first vector; a mapping training module, configured to train a first mapping sub-model using the first vector and the second vector, wherein the second vector is obtained by encoding the mapping sample set using the first encoding sub-model, wherein a difference between the second vector and a third vector is less than a loss threshold, and the third vector is obtained by mapping the first vector using the first mapping sub-model; The first encoding module is further configured to encode the second sample set into a fourth vector using the second encoding sub-model; a first mapping module, configured to map the fourth vector into a fifth vector through the first mapping sub-model; a classification training module, configured to train the first classification sub-model using the fifth vector to obtain a second classification sub-model; A construction module is used to construct a second classification prediction model through the second encoding sub-model, the first mapping sub-model and the second classification sub-model, and the second classification prediction model is used to perform classification prediction on the target data for which result prediction is to be performed.
12. A classification prediction device, characterized in that: include: The second acquisition module is used to obtain target data for result prediction; a third acquisition module, configured to acquire a second classification prediction model, the second classification prediction model including a second encoding sub-model, a first mapping sub-model, and a second classification sub-model, the second classification prediction model being obtained based on the second sample set and the first classification prediction model, the first classification prediction model being obtained by training the first sample set, the first classification prediction model including the first encoding sub-model and the first classification sub-model, a difference between a second vector obtained by mapping the first vector by the first mapping sub-model and a third vector obtained by encoding the mapped sample set by the first encoding sub-model being less than a loss threshold, the first vector being obtained by encoding the mapped sample set by the second encoding sub-model; the second sample set and the first sample set being extracted from multimedia material, the first sample set and the second sample set being from different sources, the multimedia material including at least one type of data selected from text, video, picture, or audio; a second encoding module, configured to encode the target data using the second encoding sub-model to obtain a first target vector; a second mapping module, configured to map the first target vector to a second target vector through the first mapping sub-model; A classification module is used to input the second target vector into the second classification sub-model, obtain a second predicted classification result output by the second classification sub-model, and use the second predicted classification result as the classification result of the target data.
13. A computer device, characterized in that: The computer device includes one or more processors and one or more memories, wherein at least one instruction is stored in the one or more memories, and the instruction is loaded and executed by the one or more processors to implement the training method of the classification prediction model as described in any one of claims 1 to 9, or to implement the classification prediction method as described in claim 10.
14. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, which is loaded and executed by the processor to implement the training method of the classification prediction model as described in any one of claims 1 to 9, or to implement the classification prediction method as described in claim 10.
Citation Information
Patent Citations
Search sorting model training method and device and search sorting method and device
CN112084435A
Text classification model training method and device, text classification method and device and storage medium
CN112131366A