Training methods, apparatuses, and computer-readable storage media
Patent Information
- Application Number
- CN202310361877.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-04-06
AI Technical Summary
[0003]但是,受样本采集偏差、模型训练过程的随机性等影响,最终得到的特征与模型的输出预测值之间不满足先验经验约束
[0022]本公开的方法中样本组包括第一类特征的值互不相同,第二类特征的值相同的多个样本,将样本组输入机器学习模型,得到输出的样本组中各个样本对应的结果,根据各个样本对应的结果确定第一损失函数的值,并调整机器学习模型的参数。由于第一损失函数根据单调约束条件构建,训练过程中可以使机器学习模型学习第一类特征和结果的单调相关的特性,训练得到的机器学习模型可以更加符合单调约束条件,提高了训练后模型的准确性和合理性。
Smart Images

Figure CN116384507B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a training method, apparatus and computer-readable storage medium. Background Technology
[0002] Data-driven artificial intelligence and related technologies have played a significant role and brought high value to various industries. Furthermore, with the widespread application of machine learning, deep learning, and other technologies in various scenarios, there is an extremely high demand for model interpretability. One important aspect of model interpretability lies in the relationship between sample attributes and sample predicted values. Typically, modeling experts require that features and the model's output predicted values satisfy certain prior empirical constraints.
[0003] However, due to factors such as sample collection bias and the randomness of the model training process, the final features obtained do not satisfy the prior experience constraints with respect to the model's output predictions. Summary of the Invention
[0004] The inventors discovered that in certain scenarios, based on prior knowledge, the values of the input features exhibit a monotonic correlation with the model's output values within a certain range. However, in actual training, the values of the input features and the model's output values do not satisfy the monotonic correlation characteristic and the deviation is large, affecting the accuracy and rationality of the model.
[0005] One of the technical problems this disclosure aims to solve is: how to improve the accuracy and rationality of the trained model.
[0006] According to some embodiments of this disclosure, a training method is provided, comprising: obtaining a sample group for training, wherein the sample group includes multiple samples, the values of the first type features of the multiple samples are different from each other, and the values of the second type features are the same; inputting the sample group into a machine learning model to obtain the output results corresponding to each sample in the sample group; determining the value of a first loss function based on the results corresponding to each sample, wherein the first loss function is constructed according to a monotonic constraint condition, the more the results corresponding to each sample conform to the monotonic constraint condition, the smaller the value of the first loss function, the monotonic constraint condition being that the values of the first type features of each sample are monotonically correlated with the results corresponding to each sample within a preset interval; and adjusting the parameters of the machine learning model based on the value of the first loss function.
[0007] In some embodiments, determining the value of the first loss function based on the results corresponding to each sample includes: arranging the results corresponding to each sample in a preset order, wherein the preset order is based on the values of the first type features of each sample from smallest to largest or from largest to smallest; and determining the value of the first loss function based on the difference between the results corresponding to each two adjacent samples.
[0008] In some embodiments, determining the value of the first loss function based on the difference between the results corresponding to each pair of adjacent samples includes: determining whether the difference between the results corresponding to each pair of adjacent samples satisfies the monotonic constraint; summing up the differences that do not satisfy the monotonic constraint to obtain a summation result; and determining the value of the first loss function based on the summation result.
[0009] In some embodiments, the sample group further includes an original sample, which is the same as one of the multiple samples. The method further includes: determining the value of a second loss function based on the result corresponding to the original sample and the annotation information of the original sample; adjusting the parameters of the machine learning model based on the value of the first loss function includes: weighting and summing the values of the first loss function and the second loss function to obtain the value of the total loss function; and adjusting the parameters of the machine learning model based on the value of the total loss function.
[0010] In some embodiments, adjusting the parameters of a machine learning model based on the value of the total loss function includes: determining whether a preset convergence condition has been met based on the value of the total loss function; and if the preset convergence condition has not been met, adjusting the parameters of the machine learning model based on the total loss function and a preset parameter adjustment method.
[0011] In some embodiments, the method further includes: obtaining an original sample; generating multiple samples based on the values of a first type of feature and a second type of feature of the original sample; and forming a sample group by combining the original sample and the multiple new samples.
[0012] In some embodiments, when the value of the first type of feature is a continuous value, the preset range of the value of the first type of feature is divided into multiple sub-ranges, and a transformation value corresponding to each sub-range is set; the original value of the first type of feature of the original sample is replaced with the transformation value corresponding to the sub-range, which is used as the value of the first type of feature of the original sample; and the transformation value of each sub-range is used as the value of the first type of feature of each sample in the multiple samples.
[0013] In some embodiments, the first type of feature is a user's knowledge level evaluation index, the second type of feature includes the user's historical behavior information, the machine learning model is a risk prediction model, and the result corresponding to each sample is the probability that the resource usage exceeds the time limit for each sample.
[0014] In some embodiments, the first type of feature is the number of times a user has visited an object in the past, the second type of feature includes the user's attribute information, the machine learning model is an object recommendation model, and the result corresponding to each sample is the recommendation probability of the object corresponding to each sample.
[0015] In some embodiments, the first type of feature is the user's age, the second type of feature includes the user's historical medical records, the machine learning model is a prediction model, and the result corresponding to each sample is the probability of the user corresponding to each sample having a preset symptom.
[0016] In some embodiments, the method further includes: inputting the feature information of the user to be predicted into a risk prediction model, wherein the feature information of the user to be predicted includes: the knowledge level evaluation index of the user to be predicted, and the historical behavior information of the user to be predicted; and obtaining the probability of the user to be predicted exceeding the time limit for resource occupation output by the risk prediction model.
[0017] In some embodiments, the method further includes: inputting the feature information of the user to be recommended into an object recommendation model, wherein the feature information of the user to be recommended includes: the number of times the user has visited an object in the past and the attribute information of the user to be recommended; and determining whether to recommend an object to the user to be recommended based on the recommendation probability of the object output by the object recommendation model.
[0018] In some embodiments, the method further includes: inputting the feature information of the user to be predicted into the prediction model, wherein the feature information of the user to be predicted includes: the user's historical medical records and the user's age; and obtaining the probability of the user to be predicted exhibiting preset symptoms as output by the prediction model.
[0019] According to some embodiments of this disclosure, a training apparatus is provided, comprising: an acquisition module for acquiring a sample group for training, wherein the sample group includes multiple samples, the values of the first type features of the multiple samples are different from each other, and the values of the second type features are the same; an input module for inputting the sample group into a machine learning model to obtain the results corresponding to each sample in the output sample group; a determination module for determining the value of a first loss function based on the results corresponding to each sample, wherein the first loss function is constructed according to a monotonic constraint condition, the more the results corresponding to each sample conform to the monotonic constraint condition, the smaller the value of the first loss function, the monotonic constraint condition being that the values of the first type features of each sample are monotonically correlated with the results corresponding to each sample within a preset interval; and an adjustment module for adjusting the parameters of the machine learning model according to the value of the first loss function.
[0020] According to some other embodiments of this disclosure, a training apparatus is provided, comprising: a processor; and a memory coupled to the processor for storing instructions, which, when executed by the processor, cause the processor to perform a training method as described in any of the foregoing embodiments.
[0021] According to further embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the training method of any of the foregoing embodiments.
[0022] In this method, the sample group includes multiple samples with distinct values for the first type of feature and identical values for the second type of feature. The sample group is input into a machine learning model to obtain the output results corresponding to each sample in the sample group. The value of the first loss function is determined based on the results corresponding to each sample, and the parameters of the machine learning model are adjusted accordingly. Since the first loss function is constructed based on monotonic constraints, the machine learning model can learn the monotonic correlation between the first type of feature and the results during training. The trained machine learning model better conforms to the monotonic constraints, improving the accuracy and rationality of the trained model.
[0023] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating a training method according to some embodiments of this disclosure is shown.
[0026] Figure 2 A flowchart illustrating a training method according to other embodiments of this disclosure is shown.
[0027] Figure 3 A schematic diagram of the structure of a training apparatus according to some embodiments of the present disclosure is shown.
[0028] Figure 4 A schematic diagram of the structure of a training apparatus according to other embodiments of this disclosure is shown.
[0029] Figure 5 A schematic diagram of the structure of a training apparatus according to further embodiments of the present disclosure is shown. Detailed Implementation
[0030] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0031] This disclosure proposes a training method, which is described below in conjunction with... Figure 1 Describe it.
[0032] Figure 1 Flowcharts are shown for some embodiments of the training method disclosed herein. Figure 1 As shown, the method of this embodiment includes steps S102 to S108.
[0033] In step S102, a sample group for training is obtained.
[0034] Multiple sample groups are used for training. Each sample group can include multiple samples. The values of the first type of features of the samples are different, while the values of the second type of features are the same. The values of the first type of features are monotonically correlated with the output of the machine learning model within a preset range. The second type of features are all features except for the first type of features. The annotation information of multiple samples in each sample group can be the same.
[0035] In some embodiments, the sample group also includes original samples, and multiple samples are new samples generated based on the original samples. For example... Figure 2 As shown, steps S202-S206 are the same as steps S102-S106. Before step S202, the method further includes step S201, generating multiple samples based on the original samples to form a sample group. For example, obtaining the original samples; generating multiple (new) samples based on the values of the first and second type features of the original samples; and forming a sample group by combining the original samples and the multiple (new) samples. The original sample is identical to one of the multiple (new) samples.
[0036] For example, the first type of feature is denoted as The values within the preset range include The original sample The value of the feature is One, generate N (new) samples from the original samples, and the (new) samples... The feature values are respectively And each (new) sample corresponds to a non- The features and sample labels (annotation information) remain consistent with the original samples. Through this process, each original sample is transformed into... One (new) sample and One original sample.
[0037] Of course, you can also choose not to generate a sample identical to the original sample, and simply use the original sample as one of multiple samples.
[0038] In some embodiments, when the value of the first type of feature is a continuous value, the preset range of the value of the first type of feature is divided into multiple sub-ranges, and a transformation value corresponding to each sub-range is set; the original value of the first type of feature of the original sample is replaced with the transformation value corresponding to the sub-range, which is used as the value of the first type of feature of the original sample; and the transformation value of each sub-range is used as the value of the first type of feature of each sample in the multiple samples.
[0039] For continuous first-class features, binning can be performed first. For example, the 0-100 interval can be divided into sub-intervals such as (0, 18), (18, 25), (25, 50), and (50, 100). Then, the transformation values corresponding to each sub-interval can be set to 0, 1, 2, and 3. This converts the continuous interval into discrete values, which facilitates the generation of new samples and the calculation of the subsequent first loss function. Binning methods can be equal-frequency or equal-interval binning, and are not limited to the examples given.
[0040] In step S104, the sample group is input into the machine learning model to obtain the results corresponding to each sample in the output sample group.
[0041] Machine learning models include, but are not limited to, deep learning models and linear models. For example, by performing forward computation on the original samples and multiple (new) samples in a sample group, the corresponding results can be obtained. The results are denoted as follows: , among which the former The first item represents the result corresponding to the (new) sample, and the (N+1)th item represents the result corresponding to the original sample.
[0042] In step S106, the value of the first loss function is determined based on the results corresponding to each sample.
[0043] In some embodiments, the first loss function is constructed based on monotonic constraints. The more the results corresponding to each sample conform to the monotonic constraints, the smaller the value of the first loss function. The monotonic constraints are that the values of the first type features of each sample are monotonically correlated with the results corresponding to each sample within a preset interval; that is, the monotonic constraints are that the results corresponding to each sample are monotonically increasing or monotonically decreasing with respect to the values of the first type features of each sample within the preset interval. If the monotonicity of the values of the first type features of each sample and the results corresponding to each sample differs in different preset intervals, then multiple monotonic constraints may be included, and the first loss function is constructed based on multiple monotonic constraints.
[0044] In some embodiments, the results corresponding to each (new) sample are arranged in a preset order, wherein the preset order is based on the values of the first type features of each (new) sample from smallest to largest or from largest to smallest; the value of the first loss function is determined based on the difference between the results corresponding to each two adjacent (new) samples.
[0045] For example, for The results corresponding to the new sample are based on Sort the feature values from smallest to largest to obtain In practical applications, since samples conforming to this sorting relationship can be directly generated in multiple new sample generation stages, it is only necessary to ensure that the order of the results obtained by the machine learning model is not disrupted.
[0046] To calculate the difference between the results of any two adjacent (new) samples, you can either subtract the result of the previous sample from the result of the next sample, or vice versa, as long as the calculation method for each difference is consistent. For example, calculating the difference between the result of the next sample and the result of the previous sample generates a total of [number missing]. The term can be represented by the following formula.
[0047] (1)
[0048] Furthermore, in some embodiments, for the difference between the results corresponding to each two adjacent (new) samples, it is determined whether the difference satisfies the monotonic constraint; the differences that do not satisfy the monotonic constraint are summed to obtain a summation result; and the value of the first loss function is determined based on the summation result.
[0049] Whether the difference satisfies the monotonicity constraint depends on the direction of monotonicity, the preset order, and the method of calculating the difference. For example, the monotonicity constraint requires that the value of the first type feature corresponding to each sample increases monotonically within a preset interval. The preset order is based on the ascending order of the first type feature values of each (new) sample, using the method of subtracting the result of the previous sample from the result of the next sample. A difference greater than 0 satisfies the monotonicity constraint, while a difference less than 0 does not. A function can be set to sum the differences that do not satisfy the monotonicity constraint.
[0050] You can also set the ReLU function so that for any value x, if its value is less than or equal to 0, then... ,otherwise The first loss function can be constructed based on the ReLU function.
[0051] For example, the first loss function is denoted as If the monotonic constraint condition is as the first type of feature... As the value of increases, the output remains monotonically constant, i.e. If the value of is positively correlated with the result, then the difference calculated in formula (1) is transformed by the ReLU function and added term by term; conversely, if the monotonic constraint condition is as the first type of feature As the value of increases, the output result remains monotonically non-increasing, that is... The value of is negatively correlated with the result. The difference calculated in formula (1) can be expressed by the following formula after being transformed by the ReLU function and added item by item.
[0052] (2)
[0053] In step S108, the parameters of the machine learning model are adjusted according to the value of the first loss function.
[0054] In some embodiments, such as Figure 2 As shown, in step S207, the value of the second loss function is determined based on the result corresponding to the original sample and the annotation information of the original sample; in step S208, the value of the first loss function and the value of the second loss function are weighted and summed to obtain the value of the total loss function; in step S210, the parameters of the machine learning model are adjusted based on the value of the total loss function.
[0055] Besides the first loss function, all other common loss terms, such as RMSE (Root Mean Square Error), LogLoss (Logarithmic Loss), and Cross-Entropy Loss, can be calculated using the original samples, and the specific loss term is determined based on the training task. For example, the second loss function is denoted as... First loss function Set weights Total loss function The first loss function and the second loss function are weighted and summed, and For example, the following formula can be used to represent
[0056] (3)
[0057] Weight The specific value can be selected experimentally, such as through cross-validation, and varies with the weights. As the value increases, the intensity of the monotonic constraint will gradually increase.
[0058] In some embodiments, it is determined whether a preset convergence condition has been met based on the value of the total loss function; if the preset convergence condition has not been met, the parameters of the machine learning model are adjusted according to the total loss function and a preset parameter adjustment method.
[0059] Preset convergence conditions include, for example, the total loss function reaching a threshold or minimum value. If the preset convergence condition is reaching a preset number of iterations, then it is not necessary to determine the number of iterations based on the total loss function value; the number of iterations can be determined directly. For example, optimization algorithms such as Adam (Adaptive Moment Estimation) and SGD (Stochastic Gradient Descent) can be used to optimize the model, ultimately resulting in a model that meets specific monotonic constraints.
[0060] The training samples can be divided into multiple batches, each containing multiple sample groups. In one iteration, for each sample group, the results corresponding to each sample in the output sample group are obtained. The value of the total loss function is determined based on the results corresponding to each sample in each sample group. The parameters of the machine learning model are adjusted based on the total loss function. The above process is repeated until the preset convergence condition is reached.
[0061] In the method of the above embodiments, the sample group includes multiple samples whose values of the first type of feature are all different and whose values of the second type of feature are the same. The sample group is input into the machine learning model to obtain the output results corresponding to each sample in the sample group. The value of the first loss function is determined based on the results corresponding to each sample, and the parameters of the machine learning model are adjusted. Since the first loss function is constructed based on the monotonic constraint condition, the machine learning model can learn the monotonic correlation between the first type of feature and the result during the training process. The trained machine learning model can better conform to the monotonic constraint condition, improving the accuracy and rationality of the trained model.
[0062] The following describes some specific embodiments of the training method disclosed herein.
[0063] The method disclosed herein can be applied to scenarios such as resource allocation. When allocating resources to users, a corresponding resource occupancy time can be set, after which the user actively returns the resource. For example, various physical or virtual resources such as server resources and bandwidth resources can be allocated to users. To ensure the rationality and sustainability of resource allocation, it is necessary to predict the probability that a user's resource occupancy will exceed the time limit, in order to determine whether the resource can be allocated to subsequent users. Based on prior knowledge, it has been found that the higher the value of a user's knowledge level evaluation index, the lower the probability of exceeding the resource occupancy time limit. Therefore, monotonic constraints can be set based on this prior knowledge.
[0064] In some embodiments, the first type of feature is a user's knowledge level evaluation index, the second type of feature includes the user's historical behavior information, the machine learning model is a risk prediction model, and the result corresponding to each sample is the probability that the resource usage exceeds the time limit for each sample.
[0065] For example, (1) obtain a sample group for training, wherein the sample group includes multiple samples corresponding to a user, the values of the knowledge level evaluation index of the multiple samples are different, the values of the second type of feature are the same, and the second type of feature includes the user's historical behavior information; (2) input the sample group into risk prediction and obtain the probability of resource occupation exceeding the time limit corresponding to each sample in the output sample group; (3) determine the value of the first loss function according to the probability of resource occupation exceeding the time limit corresponding to each sample, wherein the first loss function is constructed according to the monotonic constraint condition, the more the probability of resource occupation exceeding the time limit corresponding to each sample conforms to the monotonic constraint condition, the smaller the value of the first loss function, the monotonic constraint condition is that the probability of resource occupation exceeding the time limit corresponding to each sample decreases monotonically with respect to the value of the knowledge level evaluation index of each sample within a preset interval; (4) adjust the parameters of the risk prediction model according to the value of the first loss function. The risk prediction model is, for example, a deep learning model, specifically an MLP (multilayer perceptron), etc., and is not limited to the examples given.
[0066] In some embodiments, the sample group further includes original samples, i.e., the user's original data; the value of the second loss function is determined based on the probability of resource occupancy exceeding the time limit corresponding to the original sample and the annotation information of the original sample; the value of the first loss function and the value of the second loss function are weighted and summed to obtain the value of the total loss function; the parameters of the risk prediction model are adjusted based on the value of the total loss function. The calculation methods of the first loss function and the total loss function can refer to the foregoing embodiments.
[0067] The second category of features can also include other user attribute information, such as age, region, gender, marital status, and credit history. Specific attribute information can be selected based on actual needs. Historical behavior information includes, for example, information related to each historical instance of resource usage and return. Examples include, but are not limited to, the number of days overdue for each historical instance of resource usage, the amount of resources used, the return time, the number of times resources were overdue, the total amount of overdue resources, and the maximum number of overdue days.
[0068] In some embodiments, after the risk prediction model is trained, the feature information of the user to be predicted is input into the risk prediction model to obtain the probability output by the risk prediction model that the user will exceed the resource usage period. The feature information of the user to be predicted includes: the user's knowledge level evaluation index, the user's historical behavior information, and may also include other attribute information of the user, such as age, region, gender, marital status, credit status, etc.
[0069] The methods described in the above embodiments can improve the accuracy and rationality of risk prediction models, thereby improving the accuracy of risk prediction.
[0070] The method disclosed herein can be applied to object recommendation scenarios, such as news, video, music, and product recommendations. Based on prior knowledge, it is found that the higher the number of times a user has accessed an object in the past, the higher the probability of recommending that object to the user. This results in more relevant recommended objects that better meet the user's needs and can achieve a higher click-through rate. Therefore, monotonic constraints can be set based on this prior knowledge.
[0071] In some embodiments, the first type of feature is the number of times a user has visited an object in the past, the second type of feature includes the user's attribute information, the machine learning model is an object recommendation model, and the result corresponding to each sample is the recommendation probability of the object corresponding to each sample.
[0072] For example, (1) obtain a sample set for training, wherein the sample set includes multiple samples corresponding to a user, the historical access counts of the multiple samples about the object are different, the values of the second type of feature are the same, and the second type of feature includes the user's attribute information; (2) input the sample set into the object recommendation model to obtain the recommendation probability of the object corresponding to each sample in the output sample set; (3) determine the value of the first loss function according to the recommendation probability of the object corresponding to each sample, wherein the first loss function is constructed according to the monotonic constraint condition, the more the recommendation probability of the object corresponding to each sample conforms to the monotonic constraint condition, the smaller the value of the first loss function, the monotonic constraint condition is that the recommendation probability of the object corresponding to each sample increases monotonically with respect to the historical access count of each sample within a preset interval; (4) adjust the parameters of the object recommendation model according to the value of the first loss function. The object model is, for example, a deep learning model, and is not limited to the example given.
[0073] A user's historical access count for an object includes at least one of the following: number of clicks, searches, comments, purchases, and favorites. User attribute information may include, but is not limited to, age, region, gender, marital status, and education level.
[0074] In some embodiments, the sample group further includes original samples, i.e., the user's original data; the value of the second loss function is determined based on the recommendation probability of the object corresponding to the original sample and the annotation information of the original sample; the values of the first loss function and the second loss function are weighted and summed to obtain the value of the total loss function; the parameters of the object recommendation model are adjusted based on the value of the total loss function. The calculation methods of the first loss function and the total loss function can refer to the foregoing embodiments.
[0075] In some embodiments, the feature information of the user to be recommended is input into the object recommendation model. Based on the recommendation probability of the object output by the object recommendation model, it is determined whether to recommend the object to the user. The feature information of the user to be recommended includes: the user's historical access count to the object and the user's attribute information.
[0076] The methods described in the above embodiments can improve the accuracy and rationality of the object recommendation model, thereby improving the accuracy and rationality of the recommended objects.
[0077] The method disclosed herein can be applied to scenarios involving predictions for users, such as predicting whether a user will experience a certain symptom. Based on prior knowledge, it is found that for certain preset symptoms, the older the user, the higher the probability of experiencing these symptoms. Therefore, monotonic constraints can be set based on this prior knowledge.
[0078] In some embodiments, the first type of feature is the user's age, the second type of feature includes at least one of the user's historical consultation information and medical record information, the machine learning model is a prediction model, and the result corresponding to each sample is the probability of the user corresponding to each sample having a preset symptom.
[0079] For example, (1) obtain a sample group for training, wherein the sample group includes multiple samples corresponding to a user, the age values of the multiple samples are different, the values of the second type of features are the same, and the second type of features include at least one of the user's historical consultation information and case information; (2) input the sample group into the prediction model to obtain the probability of the occurrence of the preset symptoms corresponding to each sample in the output sample group; (3) determine the value of the first loss function according to the probability of the occurrence of the preset symptoms corresponding to each sample, wherein the first loss function is constructed according to the monotonic constraint condition, the more the probability of the occurrence of the preset symptoms corresponding to each sample conforms to the monotonic constraint condition, the smaller the value of the first loss function, the monotonic constraint condition is that the probability of the occurrence of the preset symptoms corresponding to each sample increases monotonically with respect to the age of each sample within a preset interval; (4) adjust the parameters of the prediction model according to the value of the first loss function. The object model is, for example, a deep learning model, and is not limited to the example given.
[0080] The user's historical medical consultation information includes, for example, the department, doctor, symptoms, and diagnosis results of each historical consultation, and is not limited to the examples given. In some embodiments, the sample group also includes original samples, i.e., the user's original data; the value of the second loss function is determined based on the probability of the occurrence of a preset symptom corresponding to the original sample and the annotation information of the original sample; the values of the first loss function and the second loss function are weighted and summed to obtain the value of the total loss function; the parameters of the prediction model are adjusted based on the value of the total loss function. The calculation methods of the first loss function and the total loss function can refer to the foregoing embodiments.
[0081] In some embodiments, the characteristic information of the user to be predicted is input into the prediction model to obtain the probability of the user exhibiting preset symptoms, as output by the prediction model. The characteristic information of the user to be predicted includes: the user's historical medical records and the user's age.
[0082] The methods described in the above embodiments can improve the accuracy and rationality of the prediction model, thereby improving the accuracy of predicting that users will experience preset symptoms.
[0083] The scheme disclosed herein can also be applied to other scenarios, as long as the results corresponding to each sample are monotonically correlated with the values of the first type of features of each sample within a preset range.
[0084] This disclosure also provides a training device, which is described below in conjunction with... Figure 3 Describe it.
[0085] Figure 3 These are structural diagrams of some embodiments of the training device disclosed herein. Figure 3 As shown, the device 30 in this embodiment includes: an acquisition module 310, an input module 320, a determination module 330, and an adjustment module 340.
[0086] The acquisition module 310 is used to acquire a sample group for training, wherein the sample group includes multiple samples, the values of the first type features of the multiple samples are different from each other, and the values of the second type features are the same.
[0087] The input module 320 is used to input the sample group into the machine learning model and obtain the results corresponding to each sample in the output sample group.
[0088] The determination module 330 is used to determine the value of the first loss function based on the results corresponding to each sample. The first loss function is constructed based on the monotonic constraint condition. The more the results corresponding to each sample conform to the monotonic constraint condition, the smaller the value of the first loss function. The monotonic constraint condition is that the value of the first type feature of each sample is monotonically correlated with the results corresponding to each sample within a preset interval.
[0089] In some embodiments, the determining module 330 is used to arrange the results corresponding to each sample in a preset order, wherein the preset order is in the order of the values of the first type of features of each sample from small to large or from large to small; and to determine the value of the first loss function based on the difference between the results corresponding to each two adjacent samples.
[0090] In some embodiments, the determining module 330 is used to determine whether the difference between the results corresponding to each pair of adjacent samples satisfies the monotonic constraint; to sum the differences that do not satisfy the monotonic constraint to obtain a summation result; and to determine the value of the first loss function based on the summation result.
[0091] The adjustment module 340 is used to adjust the parameters of the machine learning model based on the value of the first loss function.
[0092] In some embodiments, the sample group further includes an original sample, which is the same as one of the multiple samples. The determining module 330 is further configured to determine the value of the second loss function based on the result corresponding to the original sample and the annotation information of the original sample. The adjusting module 340 is configured to perform a weighted summation of the value of the first loss function and the value of the second loss function to obtain the value of the total loss function. The parameters of the machine learning model are adjusted based on the value of the total loss function.
[0093] In some embodiments, the adjustment module 340 is used to determine whether a preset convergence condition has been met based on the value of the total loss function; if the preset convergence condition has not been met, the parameters of the machine learning model are adjusted according to the total loss function and a preset parameter adjustment method.
[0094] In some embodiments, the apparatus 30 further includes: a generation module 350 for acquiring original samples; generating multiple samples based on the values of a first type of feature and a second type of feature of the original samples; and forming a sample group by combining the original samples and the multiple new samples.
[0095] In some embodiments, the generation module 350 is used to divide the preset range of the values of the first type of feature into multiple sub-ranges when the values of the first type of feature are continuous, and set the transformation value corresponding to each sub-range; replace the original value of the first type of feature of the original sample with the transformation value corresponding to the sub-range where it is located, and use it as the value of the first type of feature of the original sample; and use the transformation value of each sub-range as the value of the first type of feature of each sample in the multiple samples.
[0096] In some embodiments, the first type of feature is a user's knowledge level evaluation index, the second type of feature includes the user's historical behavior information, the machine learning model is a risk prediction model, and the result corresponding to each sample is the probability that the resource usage exceeds the time limit for each sample. The device 30 further includes: a risk prediction module, used to input the feature information of the user to be predicted into the risk prediction model, wherein the feature information of the user to be predicted includes: the user's knowledge level evaluation index and the user's historical behavior information; and to obtain the probability of the user to be predicted exceeding the time limit for resource usage output by the risk prediction model.
[0097] In some embodiments, the first type of feature is the user's historical access count to an object, the second type of feature includes the user's attribute information, the machine learning model is an object recommendation model, and the result corresponding to each sample is the recommendation probability of the object corresponding to each sample. The device 30 further includes: an object recommendation module, used to input the feature information of the user to be recommended into the object recommendation model, wherein the feature information of the user to be recommended includes: the user's historical access count to an object and the user's attribute information; and to determine whether to recommend an object to the user to be recommended based on the object recommendation probability output by the object recommendation model.
[0098] In some embodiments, the first type of feature is the user's age, the second type of feature includes the user's historical medical records, the machine learning model is a prediction model, and the result corresponding to each sample is the probability of the user corresponding to each sample exhibiting a preset symptom. The device 30 further includes: a prediction module, used to input the feature information of the user to be predicted into the prediction model, wherein the feature information of the user to be predicted includes: the user's historical medical records and the user's age; and to obtain the probability of the user to be predicted exhibiting a preset symptom output by the prediction model.
[0099] The training devices in the embodiments of this disclosure can be implemented by various computing devices or computer systems, as described below. Figure 4 as well as Figure 5 Describe it.
[0100] Figure 4 These are structural diagrams of some embodiments of the training device disclosed herein. Figure 4 As shown, the apparatus 40 of this embodiment includes a memory 410 and a processor 420 coupled to the memory 410, the processor 420 being configured to execute training methods in any of the embodiments of this disclosure based on instructions stored in the memory 410.
[0101] The memory 410 may include, for example, system memory, fixed non-volatile storage media, etc. The system memory may store, for example, the operating system, application programs, boot loader, database, and other programs.
[0102] Figure 5 These are structural diagrams of other embodiments of the training device disclosed herein. Figure 5 As shown, the device 50 in this embodiment includes a memory 510 and a processor 520, which are similar to the memory 410 and processor 420, respectively. It may also include an input / output interface 530, a network interface 540, a storage interface 550, etc. These interfaces 530, 540, 550, and the memory 510 and processor 520 can be connected, for example, via a bus 560. The input / output interface 530 provides a connection interface for input / output devices such as a display, mouse, keyboard, and touchscreen. The network interface 540 provides a connection interface for various networked devices, such as connecting to a database server or cloud storage server. The storage interface 550 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0103] It should be noted that the acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with relevant laws and regulations and do not violate public order and good morals.
[0104] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0105] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0106] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0107] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0108] The above description is only a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.
Claims
1. A training method, comprising: Obtain a sample group for training, wherein the sample group includes multiple samples, the values of the first type features of the multiple samples are different from each other, and the values of the second type features are the same; The sample group is input into the machine learning model to obtain the output results corresponding to each sample in the sample group; The value of the first loss function is determined based on the results corresponding to each sample. The first loss function is constructed based on a monotonic constraint. The more the results corresponding to each sample conform to the monotonic constraint, the smaller the value of the first loss function. The monotonic constraint is that the value of the first type feature of each sample is monotonically correlated with the results corresponding to each sample within a preset interval. The parameters of the machine learning model are adjusted based on the value of the first loss function. in, The first type of feature is the user's historical access count to an object; the second type of feature includes the user's attribute information; the machine learning model is an object recommendation model; and the result corresponding to each sample is the recommendation probability of the object corresponding to each sample. The first type of feature is the user's age; the second type of feature includes the user's historical medical records; the machine learning model is a predictive model; and the result corresponding to each sample is the probability of the user exhibiting a preset symptom for that sample. The sample group further includes an original sample, which is identical to one of the plurality of samples. The method further includes: The value of the second loss function is determined based on the results corresponding to the original samples and the annotation information of the original samples; The step of adjusting the parameters of the machine learning model based on the value of the first loss function includes: The values of the first loss function and the second loss function are weighted and summed to obtain the value of the total loss function. The parameters of the machine learning model are adjusted based on the value of the total loss function.
2. The training method according to claim 1, wherein, Determining the value of the first loss function based on the results corresponding to each sample includes: The results corresponding to each sample are arranged in a preset order, wherein the preset order is based on the values of the first type of features of each sample from smallest to largest or from largest to smallest; The value of the first loss function is determined based on the difference between the results of each pair of adjacent samples.
3. The training method according to claim 2, wherein, Determining the value of the first loss function based on the difference between the results of each pair of adjacent samples includes: For the difference between the results of each pair of adjacent samples, determine whether the difference satisfies the monotonic constraint condition; Add up all the differences that do not satisfy the monotonic constraint to get the summation result; The value of the first loss function is determined based on the summation result.
4. The training method according to claim 1, wherein, The step of adjusting the parameters of the machine learning model based on the value of the total loss function includes: Determine whether the preset convergence condition has been met based on the value of the total loss function; If the preset convergence condition is not met, the parameters of the machine learning model are adjusted according to the total loss function and the preset parameter adjustment method.
5. The training method according to claim 1, further comprising: Obtain the original sample; The plurality of samples are generated based on the values of the first type of features and the values of the second type of features of the original samples; The original sample and the multiple samples are combined into a sample group.
6. The training method according to claim 5, wherein, When the value of the first type of feature is a continuous value, the preset interval of the value of the first type of feature is divided into multiple sub-intervals, and a conversion value corresponding to each sub-interval is set. The original value of the first type feature of the original sample is replaced with the transformed value corresponding to the sub-interval, which is then used as the value of the first type feature of the original sample. The transformation value of each sub-interval is used as the value of the first type feature of each sample in the plurality of samples.
7. The training method according to claim 1, further comprising: The feature information of the user to be recommended is input into the object recommendation model, wherein the feature information of the user to be recommended includes: the number of times the user to be recommended has visited the object in history and the attribute information of the user to be recommended; Based on the recommendation probability of the object output by the object recommendation model, determine whether to recommend the object to the user to be recommended.
8. The training method according to claim 1, further comprising: The feature information of the user to be predicted is input into the prediction model, wherein the feature information of the user to be predicted includes: the user's historical medical records and the user's age. Obtain the probability that the user to be predicted will exhibit the preset symptoms, as output by the prediction model.
9. A training device, comprising: The acquisition module is used to acquire a sample group for training, wherein the sample group includes multiple samples, the values of the first type features of the multiple samples are different from each other, and the values of the second type features are the same; The input module is used to input the sample group into the machine learning model and obtain the output results corresponding to each sample in the sample group. The determination module is used to determine the value of the first loss function based on the results corresponding to each sample. The first loss function is constructed based on a monotonic constraint condition. The more the results corresponding to each sample conform to the monotonic constraint condition, the smaller the value of the first loss function. The monotonic constraint condition is that the values of the first type features of each sample are monotonically correlated with the results corresponding to each sample within a preset interval. The adjustment module is used to adjust the parameters of the machine learning model based on the value of the first loss function. in, The first type of feature is the user's historical access count to an object; the second type of feature includes the user's attribute information; the machine learning model is an object recommendation model; and the result corresponding to each sample is the recommendation probability of the object corresponding to each sample. The first type of feature is the user's age; the second type of feature includes the user's historical medical records; the machine learning model is a predictive model; and the result corresponding to each sample is the probability of the user exhibiting a preset symptom for that sample. The sample group further includes an original sample, which is the same as one of the plurality of samples. The determining module is further configured to determine the value of the second loss function based on the result corresponding to the original sample and the annotation information of the original sample. The adjusting module is further configured to perform a weighted summation of the value of the first loss function and the value of the second loss function to obtain the value of the total loss function, and adjust the parameters of the machine learning model based on the value of the total loss function.
10. A training device, comprising: processor; as well as A memory coupled to the processor is used to store instructions that, when executed by the processor, cause the processor to perform the training method as described in any one of claims 1-8.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein, When executed by a processor, the program implements the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Model training method and device and electronic equipment
CN111523663A
Model training method and device, electronic equipment and storage medium
CN114418113A
Machine-learning techniques for monotonic neural networks
US20200134439A1