User classification model training method and device, computer equipment, readable storage medium and program product
By adopting replay-based continuous learning strategies and task-level model training methods on data sets across populations and medical institutions, the problem of slow training speed of artificial intelligence models is solved, and the accuracy and efficiency of the model is improved, which is suitable for medical care. User classification for scenarios with lack of resources.
Patent Information
- Application Number
- CN202411277990.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-27
AI Technical Summary
When applying artificial intelligence models across populations and institutions, the current technology has a low speed of model training, especially when training tasks with large sample size data, which significantly reduces the speed of model training.
By obtaining rich sample data from different medical institutions and groups, using replay-based continuous learning strategies and task-level model training methods, we determine that each training set trains the classification model as a task, and follow the training from within the medical institution to the medical institution to the medical institution Sorting out of the organization is done in sequence, updating the model gradually, and improving training efficiency.
The high cumulative accuracy and high classification performance of the model across populations and medical institutions is achieved, the training efficiency is improved, and the continuous learning mechanism is used when there are fewer data sets, maintaining satisfactory model identification performance.
Smart Images

Figure CN119202834A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method, apparatus, computer equipment, computer-readable storage medium, and computer program product for a user classification model. Background Art
[0002] The development of artificial intelligence technology has provided strong support for population health management, mainly reflected in the fact that massive medical and health data sets are used to build artificial intelligence models and help prevent, control and manage various diseases and their risk factors. In this field, digital electronic medical record systems for different medical and health institutions and scenarios face challenges in how to quickly and effectively deploy artificial intelligence methods across populations and institutions. In particular, when there are differences in population distribution, artificial intelligence methods trained in a data set usually face the problem of reduced generalization.
[0003] In related technologies, the main way to apply artificial intelligence models across populations and institutions is continuous learning, but this method requires updating the data in the buffer and sampling the playback data in the next batch for each batch of model training. This method significantly reduces the speed of model training when facing data training tasks with large sample sizes. Summary of the invention
[0004] Based on this, it is necessary to provide a user classification model training method, apparatus, computer equipment, computer-readable storage medium and computer program product to address the technical problem of low model training speed in the above method.
[0005] In a first aspect, the present application provides a method for training a user classification model. The method comprises:
[0006] Obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0007] Determine that the training of the classification model for each training set is a task, and determine the execution order of each task;
[0008] According to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
[0009] In one embodiment, determining the execution order of each task includes:
[0010] Sorting each task in order from inside the medical institution to outside the medical institution to obtain a first sorting result;
[0011] Sorting the training sets between different medical institutions according to the sample priority order of different medical institutions to obtain a second sorting result;
[0012] According to the order of sample collection time, or by random sorting, multiple training sets outside the medical institution and within the same medical institution are sorted to obtain the execution order of each task.
[0013] In one embodiment, the pre-built classification model is trained in sequence using the training set corresponding to each task in the execution order to obtain the trained classification model, including:
[0014] Determining the current task according to the execution order, and sampling playback data from the buffer;
[0015] Training the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model;
[0016] Sampling the training set corresponding to the current task to update the data in the buffer, and sampling the playback data for the next training from the updated buffer;
[0017] The updated classification model is trained according to the playback data of the next training and the training set corresponding to the next task until the training sets corresponding to all tasks have completed the training of the classification model.
[0018] In one embodiment, the training of the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model includes:
[0019] Inputting the first sample and the second sample in the playback data and the training set corresponding to the current task into the classification model trained in the previous task respectively, and outputting the prediction result of the training set corresponding to the current task, the current prediction probability corresponding to the first sample, and the prediction category corresponding to the second sample; the current prediction probability represents the probability that the user in the first sample belongs to each category;
[0020] Obtaining a first loss value in the current task based on the prediction result of the training set corresponding to the current task, obtaining a second loss value based on the current prediction probability and the stored prediction probability corresponding to the first sample, and obtaining a third loss value based on the prediction category and the true category label corresponding to the second sample;
[0021] According to the first loss value, the second loss value and the third loss value, the parameters of the classification model trained for the previous task are adjusted to obtain an updated classification model.
[0022] In one embodiment, obtaining the first loss value in the current task includes:
[0023] Obtaining contrast loss values and classification loss values in the task;
[0024] The contrast loss value and the classification loss value are summed to obtain the first loss value.
[0025] In one embodiment, the method further comprises:
[0026] Obtaining medical data of the user to be identified;
[0027] The medical data is input into the trained classification model to obtain the category of the user to be identified.
[0028] In a second aspect, the present application also provides a training device for a user classification model. The device comprises:
[0029] An acquisition module, used to acquire a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0030] The sorting module is used to determine that the training of the classification model for each training set is a task and determine the execution order of each task;
[0031] The training module is used to train the pre-built classification model using the training set corresponding to each task in turn according to the execution order to obtain a trained classification model.
[0032] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0033] Obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0034] Determine that the training of the classification model for each training set is a task, and determine the execution order of each task;
[0035] According to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0037] Obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0038] Determine that the training of the classification model for each training set is a task, and determine the execution order of each task;
[0039] According to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
[0040] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0041] Obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0042] Determine that the training of the classification model for each training set is a task, and determine the execution order of each task;
[0043] According to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
[0044] The training method, device, computer equipment, storage medium and computer program product of the user classification model above obtains rich sample data from different medical institutions and groups to train the classification model, so that the trained classification model can be used for continuous learning across populations and medical institutions, and is suitable for the classification of people outside medical institutions in scenarios where medical resources are scarce; further, on the data sets collected across populations and medical institutions, it is proposed to adopt a playback-based continuous learning strategy for model training, so that the model can achieve a higher cumulative accuracy; further, on the basis of the playback-based continuous learning strategy, the task level is adopted for model training, which can improve the training efficiency while maintaining a high classification performance. In addition, when the training data set provided by the cross-medical institutions is small, this method can also use the continuous learning mechanism to achieve a more satisfactory model recognition performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] FIG1 is a schematic diagram of a flow chart of a method for training a user classification model in one embodiment;
[0046] FIG2 is a schematic diagram of a continuous learning process in one embodiment;
[0047] FIG3 is a flow chart of steps for determining the execution order of each task in one embodiment;
[0048] FIG4 is a schematic diagram of a process of buffer sampling and updating in one embodiment;
[0049] FIG5 is a structural block diagram of a training device for a user classification model in one embodiment;
[0050] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0053] In one embodiment, as shown in FIG1 , a method for training a user classification model is provided. This embodiment uses the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster consisting of multiple servers. In this embodiment, the method includes the following steps:
[0054] Step S110, obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups.
[0055] In specific implementation, patient data samples can be collected from multiple medical institutions (such as hospitals, clinics, etc.). The training sets of different medical institutions may cover different populations, disease types, etc., for example, the electronic medical records of hospitals. In addition to the data within the medical institutions, external sample data needs to be collected, such as public databases, data sets provided by scientific research institutions, etc. These data samples can be electronic health data, such as epidemiological survey data and out-of-hospital physical examination data.
[0056] The data collected in the same medical institution and outside the medical institution are organized according to different characteristics, for example, grouped by age, gender, geographic location, health status, sample collection time, etc., and each training set is clearly labeled to ensure traceability during data processing and model training. In this way, multiple training sets can be obtained in each medical institution, and multiple training sets can be obtained outside the medical institution, forming a comprehensive training set across populations and medical institutions (including across different medical institutions and outside medical institutions).
[0057] Step S120, determining that the training of the classification model for each training set is a task, and determining the execution order of each task.
[0058] In the specific implementation, the training of the classification model for each training set is regarded as a task, and multiple tasks can be obtained. Then, the tasks are sorted in the order from inside the medical institution to outside the medical institution to obtain the execution order of each task. In the subsequent model training, the model is updated and trained in units of tasks.
[0059] Step S130, according to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
[0060] In a specific implementation, a playback-based continuous learning strategy can be adopted, and the pre-built classification model can be trained in turn using the training set corresponding to each task in the execution order to obtain a trained classification model. Specifically, an initial classification model can be constructed using deep learning, machine learning and other algorithms, and the task sequence determined in S120 is traversed to train the model based on the training set corresponding to each task. After completing the training of each task, the trained classification model can be tested on the test set of the current task and the combined test set of the current and previously trained tasks to evaluate the adaptability of the model to the current task and whether the previous tasks have been forgotten.
[0061] In the context of a playback-based continuous learning strategy, the classification model will be trained sequentially on each training set, using the model checkpoint with the smallest loss in the validation set. That is, when training on each task, the model checkpoint finally taken is the one that minimizes the loss in the validation set of the task. Figure 2 is a schematic diagram of a continuous learning process provided by an embodiment. In this process, task 0, task 1, and task 2 represent three training and model evaluation stages, and the data set used for training in each stage is determined by the training order. Taking task 1 as an example, the classification model trained in the task 0 stage is trained with the training set of task 1. After the training is completed, the classification model obtained from this training is tested with the test set of task 1, and the classification model obtained from this training is tested with the combined test set of task 0 and task 1.
[0062] In the training method of the above user classification model, by acquiring rich sample data from different medical institutions and groups to train the classification model, the trained classification model can be used for continuous learning across populations and medical institutions, and is suitable for the classification of people outside medical institutions in scenarios where medical resources are scarce; further, on the data sets collected across populations and medical institutions, it is proposed to adopt a replay-based continuous learning strategy for model training, so that the model can achieve a higher cumulative accuracy; further, on the basis of the replay-based continuous learning strategy, the task level is adopted for model training, which can improve the training efficiency while maintaining a high classification performance. In addition, when the training data set provided by the cross-medical institutions is small, this method can also use the continuous learning mechanism to achieve a more satisfactory model recognition performance.
[0063] In an exemplary embodiment, as shown in FIG. 3 , the above step S120 determines the execution order of each task, specifically including:
[0064] Step S121, sorting the tasks in order from inside the medical institution to outside the medical institution to obtain a first sorting result;
[0065] Step S122, sorting the training sets between different medical institutions according to the sample priority order of different medical institutions to obtain a second sorting result;
[0066] Step S123, sorting multiple training sets outside the medical institution and within the same medical institution according to the order of sample collection time, or by random sorting, to obtain the execution order of each task.
[0067] In the specific implementation, considering that the population characteristics distribution difference between the data sets within the medical institution is greater than that outside the medical institution, the characteristics of the in-hospital population can better enable the model to learn information to identify user categories. At the same time, the quality of sample data within the medical institution is often better than that outside the medical institution. When determining the execution order of each task, the tasks can be sorted in the order from within the medical institution to outside the medical institution, and the sorting inside and outside the medical institution is achieved to obtain the first sorting result. Further, the training sets between different medical institutions are sorted, for example, the training sets between different medical institutions are sorted according to the sample priority order of different medical institutions to obtain the second sorting result; wherein the sample priority order can be determined according to indicators such as sample quality, sample integrity, and representativeness. Finally, according to the order of sample collection time, which can be specifically from early to late, or a random sorting method is used to sort multiple training sets outside the medical institution and within the same medical institution, and the task sorting results within and outside the medical institution are integrated to form a complete task execution order list.
[0068] In this embodiment, on a cross-scenario medical data set, the training set is selected in order from in-hospital to out-of-hospital to minimize the catastrophic forgetting of the model. At the same time, by carefully sorting the tasks, it can be ensured that during the model training process, sample sets with higher importance and timeliness are prioritized, thereby improving model performance. This process not only helps to improve training efficiency, but also ensures the transfer learning effect of the model between different tasks. It avoids the problem that the existing playback-based continuous learning technology does not fully consider the impact of the training order of the continuous learning model in cross-population applications under different medical backgrounds, resulting in the performance of the continuous learning model being reduced due to poor training order.
[0069] In an exemplary embodiment, the above-mentioned step S130 trains the pre-built classification model in sequence using the training set corresponding to each task in accordance with the execution order to obtain a trained classification model, including: determining the current task in accordance with the execution order, and sampling playback data from the buffer; training the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model; sampling the training set corresponding to the current task to update the data in the buffer, and sampling the playback data for the next training from the updated buffer; training the updated classification model according to the playback data for the next training and the training set corresponding to the next task, until the training sets corresponding to all tasks have completed the training of the classification models.
[0070] Specifically, the replay-based continuous learning strategy, specifically the improved method of Dark Experience replay++ (Der++), builds on the previously established ER (Experience replay) method and additionally introduces the mechanism of knowledge distillation. Der++ stores a subset of past data and replays it periodically, ensuring that the learned knowledge is reinforced and not forgotten when new data is introduced. The use of knowledge distillation helps to integrate and integrate new information with previously learned representations.
[0071] It can be understood that in the original DER++ method, the buffer for playback operates at the sample level, where the sampling step occurs after each new sample is introduced during model training. This method is conducive to continuous learning without task boundaries and more timely memory updates. However, due to the large sample size of medical data sets, this strategy significantly slows down the speed of model training. In addition, training without task boundaries is not an important focus of this application, because the user classification model in this application can and needs to know what task it is currently in (i.e., from which source the data set is collected, which medical institution or outside the medical institution). Therefore, this application adopts a simplified sampling process, and no longer samples after each new sample, but moves the sampling process to the end of each task, and during the training of each task, the rehearsal buffer samples are not updated.
[0072] Refer to Figure 4, which is a schematic diagram of the process of buffer sampling and updating shown in an embodiment. Taking the current task as task1 as an example, playback data is sampled from the buffer, and the classification model trained for the previous task (task0) is trained according to the playback data and the training set corresponding to task1 (i.e., the samples in task1) to obtain an updated classification model. After the training is completed, sample sampling is performed on the training set corresponding to task1 to update the data in the buffer, and the playback data of the next training (task2) is sampled from the updated buffer; the classification model updated by task1 is trained according to the playback data of the next training and the training set corresponding to task2, until the training of the classification model corresponding to all tasks has completed the training.
[0073] Furthermore, in one embodiment, sample sampling is performed on the training set corresponding to the current task, including: determining the total number of samples contained in the buffer and the number of tasks that have completed training; determining the number of samples corresponding to the current task based on the total number of samples and the number of tasks that have completed training; and sampling the training set corresponding to the current task according to the number of samples. For example, assuming that the total size of the buffer (i.e., the number of samples contained) is fixed to M, then the amount of samples sampled and placed in the buffer at the end of each task is M / N, where N is the number of tasks currently executed, and each time a sample is added to the buffer, part of the samples in the buffer will be randomly discarded (the size is equal to the number of samples added). During model training, random samples will be continuously taken from the buffer (the size depends on the batch) and added to the model training process.
[0074] In this embodiment, on the basis of the playback-based continuous learning strategy, task-level randomly selected samples are used to form a buffer, which can simultaneously improve the training efficiency and maintain a high classification performance for users.
[0075] In an exemplary embodiment, the above-mentioned training of the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model specifically includes: respectively inputting the first sample and the second sample in the playback data, and the training set corresponding to the current task into the classification model trained for the previous task, and outputting the prediction result of the training set corresponding to the current task, the current prediction probability corresponding to the first sample, and the prediction category corresponding to the second sample; the current prediction probability represents the probability that the user in the first sample belongs to each category; obtaining a first loss value in the current task based on the prediction result of the training set corresponding to the current task, obtaining a second loss value based on the current prediction probability corresponding to the first sample and the stored prediction probability, and obtaining a third loss value based on the prediction category corresponding to the second sample and the true category label; adjusting the parameters of the classification model trained for the previous task according to the first loss value, the second loss value and the third loss value to obtain an updated classification model.
[0076] Specifically, the loss function of the classification model consists of three parts, namely, the loss in the current task (i.e., the first loss value), the Euclidean distance between the logit value of the first sample sampled from the buffer and the logit value output by the current model (i.e., the second loss value), and the loss between the true label value of the second sample sampled from the buffer and the predicted type output by the current model (i.e., the third loss value). The first loss value, the second loss value, and the third loss value are summed to obtain the total loss. The model is trained based on the total loss. The total loss is expressed as follows:
[0077]
[0078] For any t∈{1,...,t c},have:
[0079] Among them, α and β are two hyperparameters. represents the samples sampled from all buffers generated in the past, h θ (x) represents the logit value of the model output, x is the model input value, and y is the true label value.
[0080] Further, in an exemplary embodiment, the above-mentioned obtaining of the first loss value in the current task includes: obtaining a contrast loss value and a classification loss value in the task; and summing the contrast loss value and the classification loss value to obtain the first loss value.
[0081] Specifically, considering that the proportion of different types of people in the general population is not balanced, and this proportion is different in different population sources, this embodiment adopts a supervised contrastive learning method to enhance the classification performance of the model on an unbalanced data set. Specifically, the contrastive learning method introduces a set of learnable centers to make samples of the same class closer to their corresponding centers. In the contrastive learning setting, the feature vector before the final classification layer of the original network is used to learn the center and establish a contrastive loss. The new loss function is obtained by combining the binary cross entropy loss function (BCELoss) of the original classification task to represent the loss function of the first loss value. As shown below:
[0082] L total =L BCELoss +L con
[0083] Among them, L total is the first loss value, L con is the contrast loss value, L BCELoss is the classification loss value.
[0084] Where: z i is the feature vector of the i-th sample; c i is the center vector corresponding to the i-th sample category; τ is a hyperparameter; K is the total number of center vectors, which is equal to the number of categories; N is the total number of samples; y i is the true label of the i-th sample; is the predicted probability of the ith sample.
[0085] In this embodiment, the use of cross-entropy and contrast loss functions can improve the continuous learning classification performance across populations and medical institutions, overcoming the defect that the conventional cross-entropy loss function used in the prior art leads to limited continuous learning classification performance across populations and medical scenarios (especially when there is an imbalance in data labels).
[0086] In an exemplary embodiment, the method further includes: acquiring medical data of the user to be identified; and inputting the medical data into a trained classification model to obtain a category of the user to be identified.
[0087] In a specific implementation, after the classification model is trained, the trained classification model can be used to identify the type of users in any group or any medical scenario. Specifically, the medical data of the user to be identified can be obtained, and the medical data can be input into the trained classification model for classification processing to obtain the user type of the user to be identified.
[0088] In this embodiment, using a trained classification model to classify users can improve the accuracy and efficiency of recognition.
[0089] In addition, experimental tests have also verified the effectiveness of the training method proposed in this application.
[0090] First, in terms of training speed, after experimental testing, the same continuous learning process (each task training epoch = 50, and other parameters such as model architecture remain consistent) was completed in the same three medical data sets and computers with the same hardware configuration. The Der++ algorithm optimized by this application took 30 minutes, while the traditional Der++ algorithm took 120 minutes, and the training speed was increased by about 300%. At the same time, the AUROC value of the final model overall performance of the Der++ algorithm optimized by this application was 0.85, and the AUROC value of the final model performance of the Der++ algorithm before optimization was 0.89, a decrease of about 4.7%. It can be seen that the optimization strategy of this application improves training efficiency while still maintaining a high classification performance. Among them, AUROC (Area under the receiver operating characteristic curve) represents the area under the receiver operating characteristic curve, which is a performance indicator for measuring the quality of the classifier. The closer it is to 1, the better the classification effect.
[0091] Secondly, we also conducted a test on the effect of training order on continuous learning by disrupting the order of three medical data sets from inside and outside medical institutions (physical examination or population research). The results show that when the training order is from inside to outside medical institutions, the model achieves the best in the evaluation of the final overall performance, and has a significant advantage over other training orders. Compared with the worst training order in the experiment, the model AUROC value increased by about 7.6% (from 0.79 to 0.85), which shows that on cross-scenario medical data sets, the use of the order from inside to outside medical institutions to select training sets makes the model's catastrophic forgetting the lowest.
[0092] Finally, we verify the effect of using contrast loss on the model. In most of the experiments, the performance is improved by 1%-5% compared to not using contrast loss.
[0093] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0094] Based on the same inventive concept, the embodiment of the present application also provides a user classification model training device for implementing the user classification model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the training device for one or more user classification models provided below can refer to the limitations of the user classification model training method above, and will not be repeated here.
[0095] In one embodiment, as shown in FIG5 , a training device for a user classification model is provided, comprising:
[0096] An acquisition module 510 is used to acquire a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups;
[0097] A sorting module 520 is used to determine that the training of the classification model by each training set is a task and determine the execution order of each task;
[0098] The training module 530 is used to train the pre-built classification model using the training set corresponding to each task in turn according to the execution order to obtain a trained classification model.
[0099] In one embodiment, the sorting module 520 is specifically used to sort each task in order from inside the medical institution to outside the medical institution to obtain a first sorting result; sort the training sets between different medical institutions according to the sample priority order of different medical institutions to obtain a second sorting result; sort multiple training sets outside the medical institution and within the same medical institution according to the order of sample collection time, or by random sorting, to obtain the execution order of each task.
[0100] In one embodiment, the training module 530 is also used to determine the current task according to the execution order, and to sample playback data from the buffer; to train the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model; to sample the training set corresponding to the current task to update the data in the buffer, and to sample the playback data for the next training from the updated buffer; to train the updated classification model according to the playback data for the next training and the training set corresponding to the next task, until the training of the classification model for the training sets corresponding to all tasks has been completed.
[0101] In one embodiment, the training module 530 is also used to input the first sample and the second sample in the playback data, and the training set corresponding to the current task into the classification model trained for the previous task, and output the prediction result of the training set corresponding to the current task, the current prediction probability corresponding to the first sample, and the prediction category corresponding to the second sample; the current prediction probability represents the probability that the user in the first sample belongs to each category; based on the prediction result of the training set corresponding to the current task, a first loss value in the current task is obtained, based on the current prediction probability corresponding to the first sample and the stored prediction probability, a second loss value is obtained, and based on the prediction category corresponding to the second sample and the true category label, a third loss value is obtained; according to the first loss value, the second loss value and the third loss value, the parameters of the classification model trained for the previous task are adjusted to obtain an updated classification model.
[0102] In one embodiment, the training module 530 is further used to obtain a contrast loss value and a classification loss value in the task; and sum the contrast loss value and the classification loss value to obtain a first loss value.
[0103] In one of the embodiments, the device further includes a classification module for acquiring medical data of the user to be identified; inputting the medical data into a trained classification model to obtain the category of the user to be identified.
[0104] Each module in the training device of the user classification model can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0105] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a training method for a user classification model is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, a trackball or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0106] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0108] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0109] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0110] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0111] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0112] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0113] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for training a user classification model, characterized in that: The method comprises: Obtaining a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups; Determine that the training of the classification model for each training set is a task, and determine the execution order of each task; According to the execution order, the pre-built classification model is trained in turn using the training set corresponding to each task to obtain a trained classification model.
2. The method according to claim 1, characterized in that Determining the execution order of each task includes: Sorting each task in order from inside the medical institution to outside the medical institution to obtain a first sorting result; Sorting the training sets between different medical institutions according to the sample priority order of different medical institutions to obtain a second sorting result; According to the order of sample collection time, or by random sorting, multiple training sets outside the medical institution and within the same medical institution are sorted to obtain the execution order of each task.
3. The method according to claim 1, characterized in that The pre-built classification model is trained in turn using the training set corresponding to each task in the execution order to obtain a trained classification model, including: Determining the current task according to the execution order, and sampling playback data from the buffer; Training the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model; Sampling the training set corresponding to the current task to update the data in the buffer, and sampling the playback data for the next training from the updated buffer; The updated classification model is trained according to the playback data of the next training and the training set corresponding to the next task until the training sets corresponding to all tasks have completed the training of the classification model.
4. The method according to claim 3, characterized in that The step of training the classification model trained for the previous task according to the playback data and the training set corresponding to the current task to obtain an updated classification model includes: Inputting the first sample and the second sample in the playback data and the training set corresponding to the current task into the classification model trained in the previous task respectively, and outputting the prediction result of the training set corresponding to the current task, the current prediction probability corresponding to the first sample, and the prediction category corresponding to the second sample; the current prediction probability represents the probability that the user in the first sample belongs to each category; Obtaining a first loss value in the current task based on the prediction result of the training set corresponding to the current task, obtaining a second loss value based on the current prediction probability and the stored prediction probability corresponding to the first sample, and obtaining a third loss value based on the prediction category and the true category label corresponding to the second sample; According to the first loss value, the second loss value and the third loss value, the parameters of the classification model trained for the previous task are adjusted to obtain an updated classification model.
5. The method according to claim 4, characterized in that The obtaining of a first loss value in the current task includes: Obtaining contrast loss values and classification loss values in the task; The contrast loss value and the classification loss value are summed to obtain the first loss value.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtaining medical data of the user to be identified; The medical data is input into the trained classification model to obtain the category of the user to be identified.
7. A training device for a user classification model, characterized in that: The device comprises: An acquisition module, used to acquire a training data set; the training data set includes multiple training sets in different medical institutions and multiple training sets outside medical institutions, and each training set corresponds to at least two groups; The sorting module is used to determine that the training of the classification model for each training set is a task and determine the execution order of each task; The training module is used to train the pre-built classification model using the training set corresponding to each task in turn according to the execution order to obtain a trained classification model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for training a user classification model according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for training a user classification model according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for training a user classification model according to any one of claims 1 to 6 are implemented.
