Model training method, data processing method, device, medium and electronic equipment

By adjusting the loss function in machine learning to reflect the sample distribution density, the problem of sample imbalance is solved, and the prediction accuracy of the model is improved.

CN115795309BActive Publication Date: 2026-05-19NEUSOFT CORP
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEUSOFT CORP
Filing Date
2022-12-01
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Machine learning suffers from imbalanced distribution of positive and negative samples and uneven distribution of easily and difficult-to-classify samples, which leads to poor model prediction accuracy.

Method used

By determining the value range within the numerical distribution range of the prediction error, adjusting the loss function according to the sample distribution density to make it inversely correlated with the sample distribution density of the value range, and performing multiple training iterations, the target mathematical model is obtained.

Benefits of technology

It balances the proportion of minority and majority class samples in loss calculation, improves the model's ability to distinguish between positive and negative samples and easy and difficult samples, suppresses outlier interference, and improves the model's prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115795309B_ABST
    Figure CN115795309B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a model training method, a data processing method, an apparatus, a medium and an electronic device to improve the prediction accuracy of a model. The method comprises: obtaining training samples; inputting data corresponding to each training sample into an initial mathematical model trained according to an initial loss function to obtain a prediction value corresponding to each training sample, and determining a prediction error of each training sample according to a label and the prediction value; determining a plurality of value intervals in the numerical distribution range of the prediction error, and determining a sample distribution density of each value interval according to the number of corresponding training samples in each value interval; determining a target loss function according to the initial loss function and the sample distribution density, and training the initial mathematical model multiple times according to a plurality of training samples and the target loss function to obtain a target mathematical model, wherein the loss value calculated by the target loss function for any training sample is inversely related to the sample distribution density of the value interval corresponding to the training sample.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of machine learning technology, and more specifically, to a model training method, data processing method, apparatus, medium, and electronic device. Background Technology

[0002] With the rapid development of machine learning technology, it has been gradually applied to many fields, such as image processing, healthcare, and intelligent control.

[0003] However, machine learning often encounters problems such as an imbalance in the distribution of positive and negative samples or an uneven distribution between easily distinguishable and difficult-to-distinguish samples, which reduces the prediction accuracy of machine learning models and poses a challenge to the further promotion and application of machine learning. Summary of the Invention

[0004] The purpose of this disclosure is to provide a model training method, data processing method, apparatus, medium, and electronic device to improve the accuracy of predictions made by the trained model.

[0005] To achieve the above objectives, firstly, this disclosure provides a method for training a model, the method comprising:

[0006] Obtain multiple training samples, each training sample including data and labels;

[0007] The data corresponding to each training sample is input into the initial mathematical model obtained by training according to the initial loss function to obtain the predicted value corresponding to each training sample, and the prediction error of each training sample is determined according to the label and the predicted value.

[0008] Multiple value intervals are determined within the numerical distribution range of the prediction error, and the sample distribution density of each value interval is determined based on the number of training samples corresponding to each value interval.

[0009] Based on the initial loss function and the sample distribution density, a target loss function is determined, and the initial mathematical model is trained multiple times based on the multiple training samples and the target loss function to obtain the target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample.

[0010] Optionally, the plurality of value intervals are multiple intervals divided within the numerical distribution range according to a first preset value length; or,

[0011] The multiple value intervals are formed by dividing the numerical distribution range into multiple segmented intervals. The endpoint of each segmented interval is used as an anchor point, and the interval is determined with each anchor point as the center point and a second preset value length as the radius. The second preset value length is greater than half of the value length of the segmented interval.

[0012] Optionally, determining the sample distribution density of each value interval based on the number of training samples corresponding to each value interval includes:

[0013] The quotient of the number of training samples corresponding to the value interval and the interval length of the value interval is used as the sample distribution density of the value interval.

[0014] Optionally, if there is an anchor point corresponding to the value range, the method further includes:

[0015] For any training sample, the range of values ​​corresponding to the anchor point that is closest to the prediction error value of that training sample is determined as the range of values ​​corresponding to that training sample.

[0016] Optionally, the mathematical model is a binary classification model, and the label is used to characterize whether the training sample is a positive sample or a negative sample;

[0017] The step of determining the sample distribution density for each value interval based on the number of training samples corresponding to the prediction error distributed within each value interval includes:

[0018] Based on the number of positive and negative samples corresponding to the prediction error distributed within each value interval, the positive sample distribution density and negative sample distribution density of each value interval are determined.

[0019] The loss value calculated by the target loss function for any positive sample is inversely correlated with the positive sample distribution density of the corresponding value interval of the positive sample, and the loss value calculated by the target loss function for any negative sample is inversely correlated with the negative sample distribution density of the corresponding value interval of the positive sample.

[0020] Optionally, the method further includes:

[0021] Obtain a target data set, which includes multiple sub-data sets, each sub-data set corresponding to multiple parameter categories and corresponding labels;

[0022] Based on the parameter missing status of each sub-data in the target dataset, determine the parameter missing rate for each parameter category;

[0023] Based on the parameter missing rate of each parameter category, determine the parameter filling order for each missing parameter category;

[0024] According to the parameter filling order, the random forest regression model corresponding to the parameter category is used sequentially to fill the parameter categories of each missing parameter in the target sub-data, thereby obtaining a training sample. The output of the random forest regression model is the parameter of the parameter category to be filled in the target sub-data, and the input of the random forest regression model is the parameter of other parameter categories in the target sub-data excluding the parameter category to be filled. The target sub-data is any one of the multiple sub-data that has missing parameters.

[0025] Optionally, the method further includes:

[0026] For any parameter category of the target sub-data:

[0027] If an original parameter exists in the parameter category, the original parameter corresponding to the parameter category shall be determined as the parameter of the parameter category;

[0028] If the original parameters are missing in the parameter category and the parameter category with missing original parameters is not filled using a random forest regression model, the mean of the upper limit and lower limit of the parameter values ​​of the parameter category shall be determined as the parameter of the parameter category with missing original parameters.

[0029] If the original parameter is missing in the parameter category, and the parameter category with the missing original parameter is filled using a random forest regression model, the filled parameter is determined as the parameter of the parameter category with the missing original parameter.

[0030] Optionally, the target dataset includes a positive sample dataset and a negative sample dataset, and the random forest regression model corresponding to the parameter categories includes a first random forest regression model and a second random forest regression model. The first random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the positive sample dataset, and the second random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the negative sample dataset. The first random forest regression model is obtained by modeling the sub-data of the positive sample dataset that has corresponding parameter values, and the second random forest regression model is obtained by modeling the sub-data of the negative sample dataset that has corresponding parameter values.

[0031] Secondly, this disclosure provides a data processing method, the method comprising:

[0032] Obtain the data to be processed;

[0033] The data to be processed is input into the target mathematical model to obtain the processing result output by the target mathematical model. The target mathematical model is a classification model or a regression model, and the target mathematical model is trained according to the training method of the model described in any one of the first aspects.

[0034] Thirdly, this disclosure provides a model training apparatus, the apparatus comprising:

[0035] The first acquisition module is used to acquire multiple training samples, each training sample including data and labels;

[0036] The first determining module is used to input the data corresponding to each training sample into the initial mathematical model obtained by training according to the initial loss function, to obtain the predicted value corresponding to each training sample, and to determine the prediction error of each training sample according to the label and the predicted value.

[0037] The second determining module is used to determine multiple value intervals within the numerical distribution range of the prediction error, and to determine the sample distribution density of each value interval based on the number of training samples corresponding to each value interval.

[0038] The training module is used to determine a target loss function based on the initial loss function and the sample distribution density, and to train the initial mathematical model multiple times based on the multiple training samples and the target loss function to obtain a target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample.

[0039] Fourthly, this disclosure provides a data processing apparatus, the apparatus comprising:

[0040] The third acquisition module is used to acquire the data to be processed;

[0041] The second processing module is used to input the data to be processed into the target mathematical model and obtain the processing result output by the target mathematical model. The target mathematical model is a classification model or a regression model, and the target mathematical model is trained according to the training method of the model described in any of the first aspects.

[0042] Fifthly, this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects or the steps of the method described in the second aspect.

[0043] Sixthly, this disclosure provides an electronic device, comprising:

[0044] A memory on which computer programs are stored;

[0045] A processor for executing the computer program in the memory to implement the steps of the method in any of the first aspects or the steps of the method in the second aspect.

[0046] By using the above technical solution to inversely adjust the loss function through sample distribution density, the loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the corresponding value interval of the training sample. Therefore, it can balance the proportion of minority class samples and majority class samples in the loss calculation, as well as the proportion of difficult-to-distinguish and easy-to-distinguish samples in the loss calculation, improve the ability to distinguish between positive and negative samples, as well as the ability to distinguish between difficult-to-distinguish and easy-to-distinguish samples, and suppress the interference of outlier samples, thereby improving the prediction accuracy of the trained mathematical model.

[0047] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0048] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:

[0049] Figure 1 This is a flowchart illustrating a model training method according to an exemplary embodiment of the present disclosure;

[0050] Figure 2 This is a schematic diagram illustrating a value range division according to an exemplary embodiment of the present disclosure;

[0051] Figure 3 This is a schematic diagram illustrating the distribution range of value intervals corresponding to an anchor point according to an exemplary embodiment of the present disclosure;

[0052] Figure 4 This is a flowchart illustrating a data processing method according to an exemplary embodiment of the present disclosure;

[0053] Figure 5 This is a block diagram illustrating a model training apparatus according to an exemplary embodiment of the present disclosure;

[0054] Figure 6 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment of the present disclosure;

[0055] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0056] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.

[0057] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0058] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0059] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0060] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0061] In related technologies, the uneven distribution of positive and negative samples can be mitigated by downsampling the majority class samples, but this method leads to the loss of sample information. Upsampling the minority class samples can also be used, but this method often involves artificially synthesized data, resulting in noisy data. Therefore, there is currently no effective method to solve the problem of uneven sample distribution in related technologies, leading to poor prediction accuracy of machine learning mathematical models trained using unevenly distributed samples.

[0062] In view of this, embodiments of the present disclosure provide a method for training a model to improve the predictive accuracy of the trained mathematical model.

[0063] The following provides illustrative examples of some application scenarios of the model training method according to embodiments of this disclosure.

[0064] The mathematical model used in the training method of the model in this embodiment can be a mathematical model applied to image data processing, text data processing, or speech data processing, etc. Therefore, the training samples can be image samples, text samples, or speech samples. It should be noted that the image samples, text samples, or speech samples can be images, text, or speech from various fields.

[0065] For example, in the field of healthcare, there are some rare diseases, such as myeloma. Mathematical models can be designed to predict the potential risk of rare diseases. For instance, by using collected routine examination indicators, i.e., the textual indicators of parameters for various routine tests, the potential risk of a certain type of rare disease can be predicted, thereby allowing for further clinical diagnosis to determine whether a diagnosis has been made.

[0066] Because rare diseases have extremely low incidence rates, obtaining sample data labeled with rare disease tags is usually difficult due to the small number of cases. If data corresponding to rare diseases are used as positive samples and data without rare diseases are used as negative samples, the distribution of positive and negative samples will be uneven. This poses a challenge to the prediction accuracy of machine learning models trained on samples with rare disease tags. For example, the model in the above example, trained on samples with rare disease tags to judge the risk of text indicators used in routine detection, may have poor prediction accuracy.

[0067] For example, in the field of traffic accident prediction, the probability of a traffic accident occurring on a road segment can be predicted using image data of the road segment environment. In this scenario, there is relatively little image data of traffic accidents, which also means that obtaining sample data labeled with accident occurrences is difficult. If image data corresponding to an accident is used as positive samples and image data without an accident is used as negative samples, the positive and negative samples will still be unevenly distributed. This poses a challenge to the prediction accuracy of machine learning models trained on image samples with accident occurrence labels. For example, the model for predicting the probability of traffic accidents in road segment environment images trained on image samples with accident occurrence labels in the above example may have poor prediction accuracy.

[0068] For example, in the field of speech grammar recognition, the presence of grammatical errors in a given speech segment can be determined by collecting spoken speech data. In this scenario, most spoken speech conforms to grammatical rules, while only a small portion does not. This means that obtaining sample data labeled as non-grammatically correct is relatively difficult. If non-grammatically correct speech data is used as positive samples and grammatically correct speech data as negative samples, the distribution of positive and negative samples will also be uneven. This poses a challenge to the accuracy of machine learning models trained based on whether the speech samples conform to grammatical rules. For instance, the model trained on speech samples labeled as conforming to grammatical rules to determine whether the collected spoken speech data contains grammatical errors, as described above, may have poor prediction accuracy.

[0069] It should be noted that the training method of the model in this disclosure can be applied not only to the three scenarios mentioned above, but also to other scenarios in other fields. The sample data in these scenarios should not be limited to images, text, or voice. When there is an uneven distribution of samples in these fields, the training method of the model in this disclosure can be applied.

[0070] Please see Figure 1 , Figure 1 This is a flowchart illustrating a model training method according to an exemplary embodiment of this disclosure. Figure 1 As shown, the training method for this model includes:

[0071] S110: Obtain multiple training samples, each training sample including data and labels.

[0072] In this embodiment of the disclosure, each training sample may include data and labels, wherein the data of each training sample may include multiple features.

[0073] For example, when training a mathematical model to predict the potential risk of myeloma, the data may include 10 features, such as hemoglobin, creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein. The labels corresponding to samples can be having myeloma (represented by 1) and not having myeloma (represented by 0).

[0074] S120: Input the data corresponding to each training sample into the initial mathematical model obtained by training according to the initial loss function to obtain the predicted value corresponding to each training sample, and determine the prediction error of each training sample based on the label and the predicted value.

[0075] In this embodiment of the disclosure, after obtaining multiple training samples, each training sample can be input into an initial mathematical model trained according to an initial loss function, so that the initial mathematical model trained can output a predicted value for each training sample.

[0076] For example, if 100 training samples are obtained, these 100 training samples can be input into the initial mathematical model obtained through training, thereby obtaining 100 predicted values ​​corresponding to these 100 training samples.

[0077] Next, for each training sample, the difference between the predicted value and the label corresponding to that training sample is calculated as the prediction error. Optionally, this difference can be the absolute value of the difference between the predicted value and the label corresponding to that sample.

[0078] For example, for a binary classification task, the prediction error of the i-th training sample It can be represented as follows:

[0079]

[0080] It should be noted that for binary classification tasks, such as the aforementioned multiple myeloma risk prediction task, For regression tasks, prediction error The range of values ​​is determined based on the actual situation.

[0081] Optionally, the initial mathematical model obtained through training can be obtained by iteratively training the initial model through multiple training samples from another set and an initial loss function for a certain number of rounds. Furthermore, if the number of training samples is too small, the initial mathematical model obtained through training can also be obtained by iteratively training the initial model through multiple training samples obtained in step S110 and an initial loss function for a certain number of rounds.

[0082] Optionally, the initial loss function can be determined according to the specific task. For example, in regression tasks, the initial loss function can be mean squared error loss, squared absolute error loss, quantile loss, etc., and in classification tasks, the initial loss function can be cross-entropy loss, hinge loss, etc.

[0083] S130, determine multiple value intervals within the numerical distribution range of the prediction error, and determine the sample distribution density of each value interval based on the number of training samples corresponding to each value interval.

[0084] In this embodiment of the disclosure, whether it is a classification task or a regression task, multiple value intervals can be determined within the numerical distribution range of the prediction error. Then, the sample distribution density of each value interval is determined based on the number of training samples corresponding to the prediction error distributed in each value interval.

[0085] Based on the foregoing, for binary classification tasks, the prediction error... Then, multiple value ranges can be determined between 0 and 1.

[0086] The value range can be divided in many different ways.

[0087] Optionally, the multiple value intervals are multiple intervals obtained by dividing the numerical distribution range according to the first preset value length.

[0088] In this embodiment of the disclosure, multiple continuous intervals can be evenly divided according to the first preset value length. For example, continuing with the binary classification task, the distribution range of the prediction error is [0,1]. Within this range, 50 continuous intervals are evenly set, that is, starting from the endpoint 0 or 1, a value interval is divided every 0.02. At this time, the first preset value length is 0.02.

[0089] Optionally, multiple value intervals are formed by dividing the numerical distribution range into multiple segmented intervals, with the endpoint of each segmented interval serving as an anchor point, and the interval determined by centering on each anchor point and having a second preset value length as the radius, wherein the second preset value length is greater than half the value length of the segmented interval.

[0090] In this embodiment of the disclosure, based on the uniform division of the numerical distribution range into multiple continuous segmented intervals, the endpoints of each segmented interval are taken as anchor points, and each value interval is determined with each anchor point as the center point and the second preset value length as the radius. In order to improve the rationality of the value interval setting, the second preset value length can be set to be greater than half of the value length of the segmented interval. This can make adjacent value intervals overlap and improve the accuracy of the subsequent sample distribution density.

[0091] For example, continuing with the binary classification task, the prediction error is distributed in the range [0,1]. Dividing this range into 50 evenly spaced intervals, we obtain 51 anchor points. These anchor points can then be represented as follows: The maximum value of i is 49.

[0092] For any anchor point Defined as Centered on the second preset value length A closed interval with radius , i.e. There will be some overlap between anchor points that are close together. The value can be determined based on the total number of samples, for example, set in this case. .

[0093] Please refer to Figure 2 , Figure 2 This diagram illustrates a value range division, specifically showing the anchor points. and Each corresponds to a value range, and it can be seen that the anchor point and The corresponding value ranges may have overlapping areas.

[0094] S140. Based on the initial loss function and the sample distribution density, determine the target loss function, and train the initial mathematical model multiple times based on multiple training samples and the target loss function to obtain the target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the corresponding value interval of the training sample.

[0095] In this embodiment of the disclosure, after obtaining the sample distribution density of the value interval corresponding to the training sample, the initial loss function can be adjusted based on the sample distribution density to obtain the target loss function. Specifically, the loss value calculated by the adjusted target loss function for any training sample can be inversely correlated with the sample distribution density of the value interval corresponding to that training sample. Therefore, after obtaining the target loss function, the initial mathematical model can be trained multiple times based on multiple training samples and the target loss function to obtain the target mathematical model.

[0096] Using the above method, multiple training samples are obtained. The data corresponding to each training sample is input into the initial mathematical model obtained by training based on the initial loss function to obtain the predicted value corresponding to each training sample. Based on the label and the predicted value, the prediction error of each training sample is determined. Multiple value intervals are determined within the numerical distribution range of the prediction error. Based on the number of training samples in each value interval, the sample distribution density of each value interval is determined. Based on the initial loss function and the sample distribution density, the target loss function is determined. The initial mathematical model is trained multiple times based on multiple training samples and the target loss function to obtain the target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample. By using sample distribution density to inversely adjust the loss function, the loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the corresponding value interval of the training sample. Therefore, it can balance the proportion of minority class samples and majority class samples in the loss calculation, as well as the proportion of difficult-to-distinguish and easy-to-distinguish samples, thereby improving the ability to distinguish between positive and negative samples, as well as the ability to distinguish between difficult-to-distinguish and easy-to-distinguish samples, and suppressing the interference of outlier samples, thus improving the prediction accuracy of the trained mathematical model.

[0097] In some implementations, determining the sample distribution density of each value interval based on the number of training samples within each value interval in step S130 may include the following steps:

[0098] The quotient of the number of training samples within the value interval and the length of the value interval is used as the sample distribution density of the value interval.

[0099] In this embodiment of the disclosure, after determining multiple value intervals within the numerical distribution range of the prediction error, it is possible to determine which value interval the prediction error corresponding to each sample data falls within based on the magnitude of the prediction error, thereby obtaining the number of training samples corresponding to the prediction error distributed in each value interval. Then, the quotient of the number of training samples corresponding to the prediction error distributed in each value interval and the interval length can be used as the sample distribution density of the value interval.

[0100] For example, suppose at the anchor point If there are 80 training samples distributed within the corresponding value interval, and the value interval length is 0.2, then the anchor point can be determined. The sample distribution density for the corresponding value interval is 400.

[0101] It should be noted that, considering the boundary of the numerical distribution range of the prediction error, the interval length near the boundary is less than twice the second preset value length. Specifically, the interval length of each value interval can be calculated using the following formula:

[0102]

[0103] in, This represents the length of the value interval corresponding to the i-th anchor point. represents the value corresponding to the i-th anchor point, and r represents the second preset value length.

[0104] As can be seen from the foregoing, the aforementioned embodiments described the steps for obtaining the sample distribution density of each value interval. In this embodiment, the method of obtaining the sample distribution density of the value interval corresponding to the training sample may be further included. The value intervals determined by different methods correspond to different methods of determining the value intervals corresponding to the training samples.

[0105] In some implementations, when the multiple value intervals are obtained by dividing the numerical distribution range according to a first preset value length, the method of this disclosure embodiment may include the following steps:

[0106] Obtain the center point of each value interval;

[0107] For any training sample, the range of values ​​corresponding to the center point that is closest to the prediction error value of that training sample is determined as the range of values ​​corresponding to that training sample.

[0108] In this embodiment of the disclosure, since each value interval is uniformly and continuously divided, by determining the center point from which the prediction error value of the training sample is smallest, it is possible to determine which value interval the training sample belongs to, thereby determining the value interval to which the training sample belongs as the value interval corresponding to the training sample.

[0109] In some implementations, when multiple value intervals are formed by dividing the numerical distribution range into multiple segmented intervals, with the endpoint of each segmented interval serving as an anchor point, and the interval being defined with each anchor point as the center point and a second preset value length as the radius, that is, when the value intervals correspond to anchor points, the method of this disclosure embodiment may include the following steps:

[0110] For any training sample, the range of values ​​corresponding to the anchor point that is closest to the prediction error value of that training sample is determined as the range of values ​​corresponding to that training sample.

[0111] In this embodiment of the disclosure, it is considered that at the boundary position, the anchor point and the center point of the value interval are not the same point. Directly using the center point of the value interval to determine the value interval corresponding to the training sample is not very accurate. Therefore, when there is an anchor point corresponding to the value interval, the value interval corresponding to the anchor point with the smallest distance from the prediction error value of a certain training sample is directly determined as the value interval corresponding to the training sample.

[0112] Therefore, the sample distribution density of the interval corresponding to the anchor point closest to the prediction error of the training sample can be determined as the sample distribution density of the interval corresponding to the training sample. That is, for any sample Calculate its prediction error You can get Make The value is minimized, therefore the sample is set to be the smallest. The sample distribution density of the corresponding value interval is the anchor point. The sample distribution density of the corresponding value interval.

[0113] By defining the range of values ​​corresponding to the anchor point with the smallest distance from the prediction error value of the training sample as the range of values ​​corresponding to the training sample, the sample distribution density of each anchor point only needs to be calculated once, which can achieve a result similar to calculating the sample distribution density of each sample, thereby greatly reducing the amount of computation.

[0114] In some embodiments, the mathematical model used in this disclosure can be a binary classification model, where labels are used to characterize whether a training sample is a positive or negative sample. In this case, step S130, determining the sample distribution density for each value interval based on the number of training samples corresponding to the prediction error distributed within each value interval, may include the following steps:

[0115] Based on the number of positive and negative samples corresponding to the prediction error distribution within each value interval, determine the positive sample distribution density and negative sample distribution density for each value interval.

[0116] The loss value calculated by the target loss function for any positive sample is inversely correlated with the positive sample distribution density of the corresponding value interval of the positive sample, and the loss value calculated by the target loss function for any negative sample is inversely correlated with the negative sample distribution density of the corresponding value interval of the positive sample.

[0117] In this embodiment of the disclosure, to further improve the prediction accuracy of the trained mathematical model, positive and negative samples can be processed separately; that is, the positive sample distribution density and negative sample distribution density are calculated separately for each value interval. The positive sample distribution density is calculated based on the number of positive samples corresponding to the prediction error distributed within the value interval, and the negative sample distribution density is calculated based on the number of negative samples corresponding to the prediction error distributed within the value interval. After determining the positive and negative sample distribution densities, the loss value calculated by the target loss function for any positive sample is inversely correlated with the positive sample distribution density of the value interval corresponding to the positive sample, and the loss value calculated by the target loss function for any negative sample is inversely correlated with the negative sample distribution density of the value interval corresponding to the positive sample.

[0118] For example, assuming a training sample S1 is a positive sample, after calculating the prediction error of sample S1, multiple value intervals are determined within the numerical distribution range of the prediction error of positive samples. Then, based on the number of positive samples corresponding to the prediction error distributed within each value interval, the positive sample distribution density of each value interval is determined. Next, the positive sample distribution density of the value interval corresponding to sample S1 is obtained.

[0119] In some implementations, the positive sample distribution density and negative sample distribution density for each value interval are determined based on the number of positive and negative samples corresponding to the prediction error distributed within each value interval. This can be expressed by the following formula:

[0120]

[0121] in, This represents the sample distribution density, including the positive sample distribution density and the negative sample distribution density. This represents the number of negative samples corresponding to the prediction error distributed within the value interval of the i-th anchor point. This represents the number of positive samples corresponding to the prediction error distributed within the value interval of the i-th anchor point. This represents the length of the value range corresponding to the i-th anchor point. This represents the label of each sample, where 0 represents a negative sample and 1 represents a positive sample.

[0122] Furthermore, in some embodiments, the method of this disclosure further includes the following steps:

[0123] Obtain the target dataset, which includes multiple sub-data sets. Each sub-data set corresponds to multiple parameter categories and has corresponding labels.

[0124] Based on the parameter missing status of each subdata in the target dataset, determine the parameter missing rate for each parameter category;

[0125] Based on the parameter missing rate of each parameter category, determine the parameter filling order for each missing parameter category;

[0126] Following the parameter filling order, the random forest regression model corresponding to the parameter category is used sequentially to fill in the parameter categories of each missing parameter in the target sub-data, resulting in a training sample. The output of the random forest regression model is the parameter of the parameter category to be filled in the target sub-data, and the input of the random forest regression model is the parameter of the other parameter categories in the target sub-data excluding the parameter category to be filled. The target sub-data is any one of the multiple sub-data that has missing parameters.

[0127] The target data set can be understood as the data set to be populated. Optionally, the target data set can be the data set obtained after data cleaning of the raw data in the collected original data set. It is understood that in some implementations, after obtaining the original data set, data cleaning and data population can be performed on the raw data in the original data set.

[0128] Data cleaning removes data with a missing rate exceeding a preset threshold, retaining only data with fewer missing parameters. The remaining data is then filled in. For example, the missing rate of each original data point in the dataset can be checked. If a data point has a missing rate greater than 40%, meaning it has missing parameters in four different categories, the sample is considered to have little impact on model building and is deleted.

[0129] Optionally, if the data missing rate of the collected raw data is less than or equal to a preset threshold, data filling can be performed directly without data cleaning.

[0130] The parameter missing rate for a specific parameter category can be determined by the ratio of the number of missing sub-data points of that parameter category to the total number of sub-data points. For example, suppose the target dataset contains one hundred sub-data points, of which 80 sub-data points have missing parameter A, 60 sub-data points have missing parameter B, 20 sub-data points have missing parameter C, no sub-data points have missing parameter D, and 25 sub-data points have missing parameter E. Therefore, the parameter missing rates for the four parameter categories A, B, C, and D are 80%, 60%, 20%, 0%, and 25%, respectively.

[0131] In this embodiment of the disclosure, after determining the parameter missing rate of each parameter category, the parameter filling order of each missing parameter category can be determined based on the parameter missing rate of each parameter category. Optionally, for each sub-data set, the determined parameter filling order of each missing parameter category can be to fill the parameters of each parameter category sequentially in descending order of parameter missing rate.

[0132] Furthermore, in this embodiment of the disclosure, each parameter category can correspond to a random forest regression model. Thus, by using the corresponding random forest regression model, missing parameters for that parameter category can be filled in. After filling in the parameter categories of each missing parameter in the target subdata according to the parameter filling order, a training sample is obtained.

[0133] Furthermore, considering that the input to the random forest regression model consists of parameters from the target subdata excluding the parameter category to be filled, and that the target subdata may be missing parameters from multiple parameter categories, resulting in incomplete input parameters for the random forest regression model, in order to ensure the completeness of the input parameters for the random forest regression model and to perform normal predictions, in some embodiments, the method of this disclosure may further include the following steps:

[0134] For any parameter category of the target subdata:

[0135] If an original parameter exists in the parameter category, the original parameter corresponding to the parameter category will be determined as the parameter of the parameter category;

[0136] In the case where the original parameters are missing in the parameter category and the random forest regression model is not used to fill in the missing original parameters in the parameter category, the mean of the upper limit and lower limit of the parameter value of the parameter category is determined as the parameter of the parameter category with missing original parameters.

[0137] If the original parameters are missing in a parameter category, and the parameter category with missing original parameters is filled using a random forest regression model, the filled parameters are determined as the parameters of the parameter category with missing original parameters.

[0138] In this embodiment of the disclosure, any sub-data may include parameter categories that lack original parameters and parameter categories that have original parameters.

[0139] Therefore, for parameter categories with existing original parameters, the original parameters corresponding to that category can be directly identified as the parameters of that category. For parameter categories lacking original parameters, before parameter imputation using a corresponding random forest regression model, the average of the upper and lower bounds of the parameter values ​​for that category can be used to identify the parameters of the missing original parameters. Conversely, if a parameter category lacks original parameters and has already been imputed using a random forest regression model, the imputed parameters can be identified as the parameters of the missing original parameters category.

[0140] By using the above method, when the parameters of a parameter category are not filled, the mean of the upper and lower bounds of the parameter values ​​can be used to ensure the integrity of the input parameters of the random forest regression model. After the parameters are filled by the random forest regression model, the filled parameters are used to replace the mean of the upper and lower bounds of the parameter values. This further improves the accuracy of the input parameters of the random forest regression model while ensuring the integrity of the input parameters, thus improving the accuracy of the obtained training samples.

[0141] Furthermore, to further improve the accuracy of the obtained training samples, in some implementations, the target dataset includes a positive sample dataset and a negative sample dataset, and the random forest regression model corresponding to the parameter categories includes a first random forest regression model and a second random forest regression model. The first random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the positive sample dataset, and the second random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the negative sample dataset. The first random forest regression model is obtained by modeling the sub-data of the positive sample dataset that has the corresponding parameter values, and the second random forest regression model is obtained by modeling the sub-data of the negative sample dataset that has the corresponding parameter values.

[0142] In this embodiment of the disclosure, sample data with different labels are distinguished to obtain a positive sample data set and a negative sample data set. A first random forest regression model, obtained by modeling the sub-data in the positive sample data set, is used to fill in the parameter categories of missing parameters in the positive sample data set. Similarly, a second random forest regression model, obtained by modeling the sub-data in the negative sample data set, is used to fill in the parameter categories of missing parameters in the negative sample data set. This separates the filling of positive and negative sample data to improve the filling accuracy and further improve the accuracy of the obtained training samples.

[0143] The following is a detailed explanation of the process of obtaining training samples and the process of using training samples to train a model, using a complete example.

[0144] Suppose that biochemical test data of 389 myeloma test samples and 5100 non-myeloma control samples are collected from the hospital's data management platform.

[0145] The biochemical indicators included in each biochemical test are provided by the physician based on their medical expertise. These may include, for example, hemoglobin, creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein. The normal range values ​​for each indicator are shown in Table 1.

[0146] Table 1:

[0147]

[0148] Therefore, for each case of biochemical test data, the aforementioned 10 biochemical indicators are integrated into a single record, representing a patient's risk assessment data for multiple myeloma. Each data point is then labeled, with each biochemical indicator corresponding to a parameter category. The labeling method is as follows: multiple myeloma samples are labeled as 1, and control group samples are labeled as 0. The data is represented as follows:

[0149]

[0150] in This represents the numerical value of the i-th parameter category; For the tag, the value is .

[0151] Check the fill rate of each data point. If the fill rate of a data point is less than or equal to 60%, that is, 4 indicator values ​​are missing, then the sample is considered to have little effect on model building and is deleted.

[0152] Next, for each remaining data entry, if any parameter corresponding to the data's parameter category is missing, the missing values ​​are filled in. The specific filling steps are as follows:

[0153] The target dataset, composed of the retained data, is divided into multiple myeloma datasets according to labels. Non-myeloma dataset The parameter categories are then sorted in descending order according to their parameter missing rate. The method for determining the parameter missing rate for each category can be found in the previous example and will not be repeated here.

[0154] Initially fill in the parameter categories for missing parameters with the middle value of the normal range, for example, the first... The lower limit of the normal range for each parameter category is The upper limit of the normal range is Missing parameters for this parameter category are filled in as follows:

[0155]

[0156] Mark each filled indicator item to indicate that the value can be revised.

[0157] According to the list of missing parameter rates, random forest regression models corresponding to the parameter categories are applied to the dataset in sequence. The method uses the corresponding parameter category as the predicted value and the parameters of other parameter categories as the feature values ​​to perform regression prediction on the parameters that are missing in the corresponding parameter category in the subdata, and fills the missing parameters in the corresponding parameter category with the prediction results.

[0158] For example, suppose the dataset The i-th subdata set has missing parameters in the three parameter categories of hemoglobin, creatinine, and complement C1q, and the parameter filling order is hemoglobin, creatinine, and complement C1q.

[0159] In the dataset First, parameters from nine categories—creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein—are input into a random forest regression model corresponding to hemoglobin to predict the parameters corresponding to hemoglobin. Specifically, when predicting the parameters corresponding to hemoglobin, the parameters for creatinine and complement C1q are the average of their respective upper and lower limits.

[0160] After predicting the parameters corresponding to hemoglobin, the next step is to predict the parameters of creatinine. At this point, the parameters of nine categories—hemoglobin, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein—are input into the random forest regression model corresponding to creatinine to predict the parameters corresponding to creatinine. When predicting the parameters corresponding to creatinine, the parameter for complement C1q is the mean of its upper and lower limits, while the parameter for hemoglobin is the parameter predicted in the previous step.

[0161] After predicting the parameters corresponding to creatinine, the next step is to predict the parameters of complement C1q. At this point, the parameters of nine categories—hemoglobin, creatinine, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein—are input into the random forest regression model corresponding to complement C1q to predict the parameters of complement C1q. When predicting the parameters of complement C1q, the parameters of the hemoglobin and creatinine categories are the parameters predicted in the previous two steps.

[0162] Among them, the above are in the dataset The random forest regression models used in the parameter prediction process are all based on the dataset. It was obtained by modeling the data.

[0163] Similarly, we can apply the random forest regression model corresponding to the parameter category to the dataset according to the list of missing parameter rates. The dataset is analyzed by using the corresponding parameter category as the predicted value and the parameters of other parameter categories as feature values. Regression prediction is performed on parameters corresponding to missing parameter categories in the sub-data, and the prediction results are filled with parameters corresponding to missing parameter categories.

[0164] Therefore, by using the methods described above, the dataset can be... and dataset The sub-data of the parameters are filled to obtain positive and negative samples.

[0165] Next, after obtaining the positive and negative samples, the entire sample set is defined as:

[0166]

[0167] in This represents the label for each sample, where 0 indicates a non-myeloma sample and 1 indicates a myeloma sample. The feature vector representing the parameter category; in this example, the feature vector contains 10 dimensions, i.e. , representing hemoglobin, creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein, respectively; the total number of samples is . Assuming a logistic regression model is used, then the calculation of the ... Predicted values ​​for each sample The process is as follows:

[0168]

[0169] in, These are the model parameters to be learned.

[0170] Depend on Calculate the predicted probability value of the i-th sample. The calculation process is as follows:

[0171]

[0172] From the above formula, it can be seen that, .

[0173] Next, the difference between the true label value and the predicted value for each sample is calculated as the prediction error. The smaller the prediction error, the better the prediction effect. The calculation formula is as follows:

[0174]

[0175] This yields the numerical distribution of prediction errors for the entire sample, where, .

[0176] Next, the values ​​are uniformly set within the numerical range of the prediction error distribution. Anchor points. For example, setting... This indicates that a line segment of length 1 is divided into 50 equal parts, and the anchor points are represented as follows: .

[0177] For any anchor point , defined by Centered on, with A closed interval with radius , i.e. This represents the value range corresponding to the anchor point. Among them, there will be some overlap between anchor points that are close to each other. The value can be determined based on the total number of samples, for example, set in this case. .

[0178] Next, calculate each anchor point. The number of positive and negative samples corresponding to the prediction error distributed within the range of values, where the number of negative samples is... for:

[0179]

[0180] in The calculation method is as follows:

[0181]

[0182] Number of positive samples for:

[0183]

[0184] in The calculation method is as follows:

[0185]

[0186] Next, we calculate the anchor point. The length of the range of values ​​for , due to ,like Figure 3 As shown, therefore The value range contains values ​​less than 0 or greater than 1. Therefore, the formula for calculating the length of the value range is:

[0187]

[0188] Statistical anchor The anchor point can be calculated by dividing the number of samples in the corresponding interval by the length of the interval. Sample distribution density of the corresponding value interval The calculation formula is as follows:

[0189]

[0190] For any sample Calculate its prediction error You can get Make The value is minimized, therefore the sample is set to be the smallest. The sample probability density of the corresponding value interval is .

[0191] The original loss function for binary classification is usually cross-entropy loss, and the loss for a single sample is calculated using the following formula:

[0192]

[0193] Based on this, by incorporating the sample distribution density of the value interval corresponding to the training samples, the new loss function for the batch samples becomes:

[0194]

[0195] As can be seen from the above formula, the denser the sample, the larger the D value. After adjustment, the loss function of denser samples will decrease accordingly, thus achieving the adjustment purpose and improving the prediction accuracy of the trained model.

[0196] Furthermore, after multiple experiments, the model trained in the above examples achieved an average accuracy of 93.3% on the test set, with no significant deviations in the results of multiple trials, indicating that the model generally exhibits a relatively stable state. In particular, for positive cases, which are of greater concern in medical procedures and represent a minority of samples, both precision and recall have been significantly improved.

[0197] Please see Figure 4 , Figure 4 This is a flowchart illustrating a data processing method according to an exemplary embodiment of this disclosure. Figure 4 As shown, the data processing method includes:

[0198] S410, acquire the data to be processed.

[0199] S420: Input the data to be processed into the target mathematical model and obtain the processing result output by the target mathematical model.

[0200] In this embodiment, the target mathematical model is a classification model or a regression model. The target mathematical model is trained using the model training method described in the above embodiments, which will not be repeated here. Furthermore, the application scenarios of the mathematical model, i.e., the data to be processed and the role of the mathematical model, will also be described in detail in the above embodiments, which will not be repeated here.

[0201] Furthermore, it should be understood that, for the sake of simplicity, the above method embodiments are described as a series of actions; however, those skilled in the art should understand that this disclosure is not limited to the order of actions described above. Secondly, those skilled in the art should also understand that the embodiments described above are preferred embodiments, and the steps involved are not necessarily essential to this disclosure.

[0202] Based on the same concept, this disclosure also provides a model training device, which can be part or all of an electronic device through software, hardware, or a combination of both. (See also...) Figure 5 The training device 500 for this model may include:

[0203] The first acquisition module 510 is used to acquire multiple training samples, each training sample including data and labels;

[0204] The first determining module 520 is used to input the data corresponding to each training sample into the initial mathematical model obtained by training according to the initial loss function, to obtain the predicted value corresponding to each training sample, and to determine the prediction error of each training sample according to the label and the predicted value.

[0205] The second determining module 530 is used to determine multiple value intervals in the numerical distribution range of the prediction error, and to determine the sample distribution density of each value interval based on the number of training samples corresponding to each value interval.

[0206] The training module 540 is used to determine a target loss function based on the initial loss function and the sample distribution density, and to train the initial mathematical model multiple times based on the multiple training samples and the target loss function to obtain a target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample.

[0207] Optionally, the plurality of value intervals are multiple intervals divided within the numerical distribution range according to a first preset value length; or,

[0208] The multiple value intervals are formed by dividing the numerical distribution range into multiple segmented intervals. The endpoint of each segmented interval is used as an anchor point, and the interval is determined with each anchor point as the center point and a second preset value length as the radius. The second preset value length is greater than half of the value length of the segmented interval.

[0209] Optionally, the second determining module 530 is further configured to use the quotient of the number of training samples corresponding to the value interval and the interval length of the value interval as the sample distribution density of the value interval.

[0210] Optionally, if there is an anchor point corresponding to the value range, the device 500 further includes:

[0211] The third determining module is used to determine the value interval corresponding to the anchor point with the smallest distance from the prediction error value of any training sample as the value interval corresponding to the training sample.

[0212] Optionally, the mathematical model is a binary classification model, and the label is used to characterize whether the training sample is a positive sample or a negative sample; the second determining module 530 is further used to determine the positive sample distribution density and negative sample distribution density of each value interval based on the number of positive samples and the number of negative samples corresponding to the prediction error distributed within each value interval; the loss value calculated by the target loss function for any positive sample is inversely correlated with the positive sample distribution density of the value interval corresponding to the positive sample, and the loss value calculated by the target loss function for any negative sample is inversely correlated with the negative sample distribution density of the value interval corresponding to the positive sample.

[0213] Optionally, the device 500 also includes:

[0214] The second acquisition module is used to acquire a target data set, which includes multiple sub-data sets, each sub-data set corresponding to multiple parameter categories and corresponding labels;

[0215] The fourth determining module is used to determine the parameter missing rate of each parameter category based on the parameter missing status of each sub-data in the target dataset.

[0216] The fifth determination module is used to determine the parameter filling order for each missing parameter category based on the parameter missing rate of each parameter category.

[0217] The filling module is used to fill in the parameter categories of each missing parameter in the target sub-data according to the parameter filling order, using a random forest regression model corresponding to the parameter category, to obtain a training sample. The output of the random forest regression model is the parameter of the parameter category to be filled in the target sub-data, and the input of the random forest regression model is the parameter of other parameter categories in the target sub-data excluding the parameter category to be filled. The target sub-data is any one of the multiple sub-data that has missing parameters.

[0218] Optionally, the device 500 also includes:

[0219] The first processing module is used to process any parameter category of the target sub-data:

[0220] If an original parameter exists in the parameter category, the original parameter corresponding to the parameter category is determined as the parameter of the parameter category; if an original parameter is missing in the parameter category and the parameter category with missing original parameters is not filled using a random forest regression model, the average of the upper limit and lower limit of the parameter value of the parameter category is determined as the parameter of the parameter category with missing original parameters; if an original parameter is missing in the parameter category and the parameter category with missing original parameters is filled using a random forest regression model, the filled parameter is determined as the parameter of the parameter category with missing original parameters.

[0221] Optionally, the target dataset includes a positive sample dataset and a negative sample dataset, and the random forest regression model corresponding to the parameter categories includes a first random forest regression model and a second random forest regression model. The first random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the positive sample dataset, and the second random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the negative sample dataset. The first random forest regression model is obtained by modeling the sub-data of the positive sample dataset that has corresponding parameter values, and the second random forest regression model is obtained by modeling the sub-data of the negative sample dataset that has corresponding parameter values.

[0222] Based on the same concept, this disclosure also provides a data processing apparatus that can be part or all of an electronic device through software, hardware, or a combination of both. (See also...) Figure 6The data processing device 600 may include:

[0223] The third acquisition module 610 is used to acquire the data to be processed.

[0224] The second processing module 620 is used to input the data to be processed into the target mathematical model and obtain the processing result output by the target mathematical model. The target mathematical model is a classification model or a regression model, and the target mathematical model is trained according to the training method of the model described in any of the foregoing embodiments.

[0225] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0226] Based on the same inventive concept, this disclosure also provides an electronic device, comprising:

[0227] A memory on which computer programs are stored;

[0228] A processor is configured to execute the computer program in the memory to implement the steps of the training method or data processing method for any of the above models.

[0229] In one possible manner, the block diagram of the electronic device can be as follows: Figure 7 As shown. (Refer to...) Figure 7 The electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output interface 704, and a communication component 705.

[0230] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the model training method or data processing method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 703 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used for outputting and / or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. Input / output interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be analog or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.

[0231] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the training method or data processing method of the model described above.

[0232] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the model training method or data processing method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the model training method or data processing method described above.

[0233] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing a training method or a data processing method of the model described above when executed by the programmable device.

[0234] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0235] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0236] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A method for training a model, characterized in that, The model is a myeloma risk prediction model, and the method includes: Multiple training samples are obtained, each training sample including data and labels; the data includes hemoglobin, creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein; the labels are represented as 1 or 0, wherein a label of 1 indicates that the patient has myeloma, and a label of 0 indicates that the patient does not have myeloma. The data corresponding to each training sample is input into the initial mathematical model obtained by training according to the initial loss function to obtain the predicted value corresponding to each training sample, and the prediction error of each training sample is determined according to the label and the predicted value. Multiple value intervals are determined within the numerical distribution range of the prediction error, and the sample distribution density of each value interval is determined based on the number of training samples corresponding to each value interval. Based on the initial loss function and the sample distribution density, a target loss function is determined, and the initial mathematical model is trained multiple times based on the multiple training samples and the target loss function to obtain the target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample.

2. The method according to claim 1, characterized in that, The multiple value intervals are obtained by dividing the numerical distribution range according to a first preset value length; or... The multiple value intervals are formed by dividing the numerical distribution range into multiple segmented intervals. The endpoint of each segmented interval is used as an anchor point, and the interval is determined with each anchor point as the center point and a second preset value length as the radius. The second preset value length is greater than half of the value length of the segmented interval.

3. The method according to claim 1, characterized in that, The step of determining the sample distribution density of each value interval based on the number of training samples corresponding to each value interval includes: The quotient of the number of training samples corresponding to the value interval and the interval length of the value interval is used as the sample distribution density of the value interval.

4. The method according to claim 1, characterized in that, When the value range corresponds to an anchor point, the method further includes: For any training sample, the range of values ​​corresponding to the anchor point that is closest to the prediction error value of that training sample is determined as the range of values ​​corresponding to that training sample.

5. The method according to any one of claims 1-4, characterized in that, The mathematical model is a binary classification model, and the label is used to characterize whether the training sample is a positive sample or a negative sample. The step of determining the sample distribution density for each value interval based on the number of training samples corresponding to the prediction error distributed within each value interval includes: Based on the number of positive and negative samples corresponding to the prediction error distributed within each value interval, the positive sample distribution density and negative sample distribution density of each value interval are determined. The loss value calculated by the target loss function for any positive sample is inversely correlated with the positive sample distribution density of the corresponding value interval of the positive sample, and the loss value calculated by the target loss function for any negative sample is inversely correlated with the negative sample distribution density of the corresponding value interval of the positive sample.

6. The method according to claim 1, characterized in that, The method further includes: Obtain a target data set, which includes multiple sub-data sets, each sub-data set corresponding to multiple parameter categories and corresponding labels; Based on the parameter missing status of each sub-data in the target dataset, determine the parameter missing rate for each parameter category; Based on the parameter missing rate of each parameter category, determine the parameter filling order for each missing parameter category; According to the parameter filling order, the random forest regression model corresponding to the parameter category is used sequentially to fill the parameter categories of each missing parameter in the target sub-data, thereby obtaining a training sample. The output of the random forest regression model is the parameter of the parameter category to be filled in the target sub-data, and the input of the random forest regression model is the parameter of other parameter categories in the target sub-data excluding the parameter category to be filled. The target sub-data is any one of the multiple sub-data that has missing parameters.

7. The method according to claim 6, characterized in that, The method further includes: For any parameter category of the target sub-data: If an original parameter exists in the parameter category, the original parameter corresponding to the parameter category shall be determined as the parameter of the parameter category; If the original parameters are missing in the parameter category and the parameter category with missing original parameters is not filled using a random forest regression model, the mean of the upper limit and lower limit of the parameter values ​​of the parameter category shall be determined as the parameter of the parameter category with missing original parameters. If the original parameter is missing in the parameter category, and the parameter category with the missing original parameter is filled using a random forest regression model, the filled parameter is determined as the parameter of the parameter category with the missing original parameter.

8. The method according to claim 6, characterized in that, The target dataset includes a positive sample dataset and a negative sample dataset. The random forest regression model corresponding to the parameter categories includes a first random forest regression model and a second random forest regression model. The first random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the positive sample dataset. The second random forest regression model is used to fill in the corresponding parameter categories of each missing parameter in the sub-data of the negative sample dataset. The first random forest regression model is obtained by modeling the sub-data of the positive sample dataset that has corresponding parameter values, and the second random forest regression model is obtained by modeling the sub-data of the negative sample dataset that has corresponding parameter values.

9. A data processing method, characterized in that, include: Obtain the data to be processed; The data to be processed is input into the target mathematical model to obtain the processing result output by the target mathematical model. The target mathematical model is a classification model or a regression model, and the target mathematical model is trained by the model training method according to any one of claims 1-8.

10. A training device for a model, characterized in that, The model is a myeloma risk prediction model, and the device includes: The first acquisition module is used to acquire multiple training samples, each training sample including data and labels; the data includes hemoglobin, creatinine, complement C1q, calcium, immunoglobulin A, immunoglobulin G, immunoglobulin M, albumin, albumin-to-globulin ratio, and total protein; the labels are represented as 1 or 0, wherein a label of 1 indicates that the patient has myeloma, and a label of 0 indicates that the patient does not have myeloma. The first determining module is used to input the data corresponding to each training sample into the initial mathematical model obtained by training according to the initial loss function, to obtain the predicted value corresponding to each training sample, and to determine the prediction error of each training sample according to the label and the predicted value. The second determining module is used to determine multiple value intervals within the numerical distribution range of the prediction error, and to determine the sample distribution density of each value interval based on the number of training samples corresponding to each value interval. The training module is used to determine a target loss function based on the initial loss function and the sample distribution density, and to train the initial mathematical model multiple times based on the multiple training samples and the target loss function to obtain a target mathematical model. The loss value calculated by the target loss function for any training sample is inversely correlated with the sample distribution density of the value interval corresponding to the training sample.

11. A data processing apparatus, characterized in that, The device includes: The third acquisition module is used to acquire the data to be processed; The second processing module is used to input the data to be processed into the target mathematical model and obtain the processing result output by the target mathematical model. The target mathematical model is a classification model or a regression model, and the target mathematical model is trained by the model training method according to any one of claims 1-8.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1-8 or the steps of the method according to claim 9.

13. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method of any one of claims 1-8 or the steps of the method of claim 9.