A method and system for predicting diabetic nephropathy risk based on machine learning

By enhancing the sample set and training model in staged manner for electronic cases of diabetic nephropathy, the sample imbalance problem is solved, the accuracy of early judgment of diabetic nephropathy is improved, and more efficient prediction effects are achieved.

CN117253610BActive Publication Date: 2024-12-03ZHENGZHOU UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202311217397.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-20
Publication Date
2024-12-03
Estimated Expiration
2043-09-20

AI Technical Summary

Technical Problem

The prior art has sample imbalance in the early judgment of diabetic nephropathy, which leads to poor machine learning prediction results, especially the small number of positive samples, which affects the accuracy of prediction.

Method used

By obtaining the electronic cases of the patient, constructing the sample set based on the keyword set, and using the weight parameters to enhance the positive sample set, the model is divided into two stages, the first stage uses the enhanced positive sample and negative sample set. The two stages use the original positive samples and negative sample sets to ensure the balance of samples and improve the fitting degree of model and prediction accuracy.

Benefits of technology

By enhancing the number of positive samples and achieving balance with the number of negative samples, the fitting degree and prediction accuracy of the prediction model of diabetic nephropathy are improved, the sample imbalance problem is solved, and the accuracy of early judgment is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117253610B_ABST
    Figure CN117253610B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of machine learning. Specifically, the present invention provides a method for predicting the risk of diabetic nephropathy based on machine learning. The sample set is divided into a positive sample set and a negative sample set according to the sample label. The weight parameter that meets the requirements is obtained according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance between each sample and the negative sample and the weight set; the positive sample set is enhanced based on the weight parameter to obtain the enhanced positive sample set; the negative sample set and the enhanced positive sample set are used to train the diabetic nephropathy prediction model in the first stage, and the positive sample set before enhancement and the first negative sample set are used to train the diabetic nephropathy prediction model in the second stage; and the trained prediction model is used to predict the disease risk of the user. The present invention avoids the imbalance of positive and negative samples and improves the model fitting degree and prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning, and in particular to a method and system for predicting diabetic nephropathy risk based on machine learning. Background Art

[0002] Diabetic nephropathy, also known as diabetic nephropathy, is a kidney disease caused by diabetes. It is a common complication of diabetes and usually occurs in diabetic patients. The stages of diabetic nephropathy are generally divided into 5 stages. In the first stage, there may be some kidney damage that is not easy to detect, but the glomerular filtration rate is normal, the kidney size will be slightly enlarged, and there are no other symptoms or the symptoms are not obvious; in the second stage, the glomerular filtration function decreases slightly and begins to leak trace albumin. Most patients have no specific symptoms before this; in the third stage, as the disease progresses, the loss of protein in the urine will increase; in the fourth stage, proteinuria is obvious, even accompanied by some blood, and the patient will show obvious symptoms such as difficulty breathing; in the fifth stage, which is the uremia stage, accompanied by renal insufficiency or end-stage renal disease, the patient may need dialysis or kidney transplantation to maintain life.

[0003] If intervention is carried out in the first stage, the possibility of reversal is the greatest, and the second stage will partially reverse. In the third stage and beyond, the condition will continue to worsen and the possibility of reversal will become lower and lower. The earlier the intervention for diabetic nephropathy, the better. Even the timely detection of diabetic nephropathy in the early stage is much better than the treatment in the later stage. However, the earlier the stage, the more difficult it is to judge diabetic nephropathy. In the past, the judgment of diabetic nephropathy was mainly based on the glomerular filtration rate (GFR) formula, but this is an empirical formula that only considers factors such as gender, weight, serum creatinine, etc., and has great limitations. Machine learning can learn rules from many features. Many universities and research institutions have tried to use machine learning to predict the risk of diabetic nephropathy, but due to the small number of samples, especially the small number of positive samples, the effect is not obvious. Summary of the invention

[0004] In order to solve the above problems, the present invention provides a method for predicting diabetic nephropathy risk based on machine learning, the method comprising the following steps:

[0005] Obtain the electronic medical records of the patient, and extract the values ​​corresponding to the keywords from the electronic medical records according to the keyword set arranged in a preset order to form a sample set, wherein the numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; set a weight set, wherein the number of weights in the weight set is the same as the number of keywords in the keyword set;

[0006] The sample set is divided into a positive sample set and a negative sample set according to the sample labels. Based on the nearest distance between each sample in the positive sample set and the positive samples, the nearest distance between each sample in the positive sample set and the negative samples, and the weight set, weight parameters that meet the requirements are obtained; the positive sample set is enhanced based on the weight parameters to obtain an enhanced positive sample set;

[0007] In the first stage, the negative sample set and the enhanced positive sample set are used to train the diabetic nephropathy prediction model. In the second stage, the positive sample set before enhancement and the first negative sample set are used to train the diabetic nephropathy prediction model;

[0008] Collect the electronic medical records of the patient to be predicted, obtain the input of the diabetic nephropathy prediction model according to the keyword set, and use the output of the diabetic nephropathy prediction model as the risk of the patient to be predicted having diabetic nephropathy.

[0009] Preferably, the obtaining of the weight parameters that meet the requirements according to the nearest distance between each sample in the positive sample set and the positive samples, the nearest distance between each sample in the positive sample set and the negative samples, and the weight set is specifically as follows:

[0010] Obtain the distance d1 between each positive sample in the positive sample set and the nearest positive sample, and the distance d2 between each positive sample in the positive sample set and the nearest negative sample. If d1 > d2, recalculate the distance d1 and / or d2 according to the weight set so that d1 < d2, and obtain a plurality of inequalities containing weights;

[0011] Take the plurality of inequalities containing weights as constraint conditions, take the value of each weight being closest to 1 as the objective function, and use a numerical optimization algorithm to obtain at least one set of weight parameters.

[0012] Preferably, the enhancing of the positive sample set based on the weight parameters to obtain an enhanced positive sample set is specifically as follows:

[0013] For each positive sample in the positive samples, multiply the value of the positive sample and the weight set at the corresponding positions to obtain an enhanced positive sample, and put the positive sample before enhancement and the enhanced positive sample into the second positive sample set;

[0014] For each positive sample in the second positive sample set, obtain the positive sample closest to the positive sample from the second positive sample set to form a sample pair;

[0015] Calculate the distance between each sample pair, obtain a plurality of enhanced samples according to the distance and the preset spacing and put them into the second positive sample set, perform a filtering operation on the second positive sample set, and use the filtered second positive sample set as the enhanced positive sample set.

[0016] Preferably, the obtaining of a plurality of enhanced samples according to the distance and the preset spacing and putting them into the second positive sample set is specifically as follows:

[0017] Starting from one sample of the sample pair, a sample point is added at a preset interval along the direction of the other sample of the sample pair, and the added sample point is put into the second positive sample set as an enhanced sample.

[0018] Preferably, the filtering operation on the second positive sample set is specifically:

[0019] Obtain the shortest distance d3 between each sample in the sample set and other samples, and determine the maximum value d4 of the distance d3 corresponding to each sample in the sample set;

[0020] Calculate the shortest distance d5 between each sample in the second positive sample set and other samples in the third sample set, and if d5>d4, delete the sample from the second positive sample set; wherein the third sample set includes the second positive sample set and the negative sample set.

[0021] Preferably, the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement.

[0022] Preferably, the samples in the first negative sample set are selected from the negative sample set according to the distances from the positive samples in the positive sample set before enhancement, specifically:

[0023] Calculate the average distance d6 between each sample in the negative sample set and the nearest N negative samples, and the average distance d7 between each sample in the negative sample set and the nearest N positive samples, sort the samples in the negative sample set in ascending order of |d6-d7|, and select negative samples with the same number of samples as in the positive sample set before enhancement from the sorted samples.

[0024] In addition, the present invention also provides a diabetic nephropathy risk prediction system based on machine learning, the system comprising the following modules:

[0025] The sample set acquisition module is used to obtain the electronic medical records of the patient, extract the values ​​corresponding to the keywords from the electronic medical records according to the keyword set arranged in a preset order, and form a sample set, wherein the numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; and set a weight set, wherein the number of weights in the weight set is the same as the number of keywords in the keyword set;

[0026] A sample set enhancement module, which is used to divide a sample set into a positive sample set and a negative sample set according to sample labels, and obtain weight parameters that meet the requirements based on the nearest distance between each sample in the positive sample set and a positive sample, the nearest distance between each sample in the positive sample set and a negative sample, and the weight set; enhance the positive sample set based on the weight parameters to obtain an enhanced positive sample set;

[0027] A training module, which is used to train a diabetic nephropathy prediction model with the negative sample set and the enhanced positive sample set in the first stage, and train the diabetic nephropathy prediction model with the positive sample set before enhancement and the first negative sample set in the second stage;

[0028] A prediction module, which is used to collect the electronic medical records of a patient to be predicted, obtain the input of the diabetic nephropathy prediction model according to the keyword set, and use the output of the diabetic nephropathy prediction model as the risk situation of the patient to be predicted having diabetic nephropathy.

[0029] Preferably, the obtaining of the weight parameters that meet the requirements based on the nearest distance between each sample in the positive sample set and a positive sample, the nearest distance between each sample in the positive sample set and a negative sample, and the weight set is specifically as follows:

[0030] Obtain the distance d1 between each positive sample in the positive sample set and the nearest positive sample, and the distance d2 between each positive sample in the positive sample set and the nearest negative sample. If d1 > d2, recalculate the distance d1 and / or d2 according to the weight set so that d1 < d2, and obtain a plurality of inequalities containing weights;

[0031] Take the plurality of inequalities containing weights as constraint conditions, take the value of each weight being closest to 1 as the objective function, and use a numerical optimization algorithm to obtain at least one set of weight parameters.

[0032] Preferably, the enhancing of the positive sample set based on the weight parameters to obtain an enhanced positive sample set is specifically as follows:

[0033] For each positive sample in the positive samples, multiply the value of the positive sample and the weight set at the corresponding positions to obtain an enhanced positive sample, and put the positive sample before enhancement and the enhanced positive sample into the second positive sample set;

[0034] For each positive sample in the second positive sample set, obtain the positive sample closest to the positive sample from the second positive sample set to form a sample pair;

[0035] Calculate the distance of each sample pair, obtain a plurality of enhanced samples according to the distance and a preset spacing, put the enhanced samples into the second positive sample set, perform a filtering operation on the second positive sample set, and use the filtered second positive sample set as the enhanced positive sample set.

[0036] Preferably, the acquiring of a plurality of enhanced samples according to the distance and the preset interval and putting them into the second positive sample set is specifically:

[0037] Starting from one sample of the sample pair, a sample point is added at a preset interval along the direction of the other sample of the sample pair, and the added sample point is put into the second positive sample set as an enhanced sample.

[0038] Preferably, the filtering operation on the second positive sample set is specifically:

[0039] Obtain the shortest distance d3 between each sample in the sample set and other samples, and determine the maximum value d4 of the distance d3 corresponding to each sample in the sample set;

[0040] Calculate the shortest distance d5 between each sample in the second positive sample set and other samples in the third sample set, and if d5>d4, delete the sample from the second positive sample set; wherein the third sample set includes the second positive sample set and the negative sample set.

[0041] Preferably, the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement.

[0042] Preferably, the samples in the first negative sample set are selected from the negative sample set according to the distances from the positive samples in the positive sample set before enhancement, specifically:

[0043] Calculate the average distance d6 between each sample in the negative sample set and the nearest N negative samples, and the average distance d7 between each sample in the negative sample set and the nearest N positive samples, sort the samples in the negative sample set in ascending order of |d6-d7|, and select negative samples with the same number of samples as in the positive sample set before enhancement from the sorted samples.

[0044] Finally, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described above is implemented.

[0045] In view of the problem that when machine learning is used to predict the risk of diabetic nephropathy, the number of samples is small, especially the number of positive samples is small, and the sample imbalance occurs, which affects the prediction effect, the present invention divides the sample set into a positive sample set and a negative sample set according to the sample label, and obtains the weight parameter that meets the requirements according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance to the negative sample, and the weight set; based on the weight parameter, the positive sample set is enhanced to obtain the enhanced positive sample set; in the first stage, the negative sample set and the enhanced positive sample set are used to train the diabetic nephropathy prediction model, and in the second stage, the positive sample set before enhancement and the first negative sample set are used to train the diabetic nephropathy prediction model. Through the above process, the number of positive samples is enhanced, so that the number of positive samples and negative samples is balanced; and during training, the enhanced positive samples are first used for training, and then the original positive samples are used for training, so as to improve the fitting degree of the model and the accuracy of the final prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 This is a flow chart of Embodiment 1;

[0048] Figure 2 This is a schematic diagram of sample distribution in an ideal state;

[0049] Figure 3 is a flow chart of a specific embodiment;

[0050] Figure 4 A schematic diagram of adding positive samples between positive sample pairs;

[0051] Figure 5 This is a structural diagram of the second embodiment. DETAILED DESCRIPTION

[0052] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] Embodiment 1, the present invention provides a method for predicting diabetic nephropathy risk based on machine learning, the method comprising the following steps:

[0055] S11, obtaining the electronic medical records of the patient, and extracting the values ​​corresponding to the keywords from the electronic medical records according to the keyword set arranged in a preset order to form a sample set, wherein the numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; and setting a weight set, wherein the number of weights in the weight set is the same as the number of keywords in the keyword set;

[0056] Electronic Health Record (EHR) contains a lot of information about patients, such as personal identity information, past medical history, family medical history, treatment records, etc. Data related to diabetic nephropathy, such as total protein, urine protein, blood sugar, blood creatinine, etc., can be obtained from electronic medical records. Before processing the electronic medical records, a number of keywords are preset to form a keyword set, and then the values ​​corresponding to the keywords are extracted from the electronic medical records. For example, if the keyword is weight, the patient's weight obtained from the electronic medical records is 70KG. In a specific embodiment, if the electronic medical record includes multiple values ​​corresponding to the keyword, the value closest to the current time is taken. It should be noted that if personal information is involved in the electronic medical record, it will be desensitized.

[0057] Assume that the keyword set is <weight, gender, serum creatinine, fasting blood glucose>, and the corresponding value extracted from an electronic medical record is <70, 1, 1.4, 120>. A sample in the sample set is <70, 1, 1.4, 120>. Of course, in order to distinguish different samples, a unique identifier such as ID can be added to the sample set, then the first sample is <1, 70, 1, 1.4, 120>. The numerical value of the sample corresponds to the keyword set, that is, if the first keyword in the keyword set is weight, the first numerical value of the sample is 70KG. In another embodiment, after obtaining the sample, the sample is normalized, that is, the first element of all samples is normalized to (0, 1), the second element of all samples is also normalized to (0, 1), and so on.

[0058] At the same time, a weight set is also set, and the size of the weight set is the same as the size of the keyword set. For example, if the keyword set has 5 keywords, there are 5 weights in the weight set.

[0059] S12, dividing the sample set into a positive sample set and a negative sample set according to the sample labels, obtaining weight parameters that meet the requirements according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance between each sample and the negative sample, and the weight set; enhancing the positive sample set based on the weight parameters to obtain an enhanced positive sample set;

[0060] After obtaining the sample set, the samples are labeled. If a patient eventually develops diabetic nephropathy, it is labeled as a positive sample or a positive sample. Otherwise, it is a negative sample or a negative sample.

[0061] In an ideal sample set, the number of positive samples and negative samples is similar, and there is an easy-to-obtain dividing line between the two, such as Figure 2 As shown. However, in actual environments, in the risk prediction of diabetic nephropathy, sample imbalance will occur. The so-called sample imbalance means that the number of positive samples is much smaller than the number of negative samples. Too much use of negative samples to train the model will lead to a good fit for negative samples and a poor fit for positive samples. The prediction of diabetic nephropathy in the present invention is mainly used to predict positivity or the possibility of disease. Based on this, it is necessary to enhance the positive samples. In a specific embodiment of the present invention, the enhancement of positive samples includes two steps. The first is to calculate the weight, calculate a weight for each value of the sample, and then artificially increase the positive samples according to the weight. Specifically, Figure 3 As shown:

[0062] Step 1, that is, obtaining weight parameters that meet the requirements according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance between each sample and the negative sample, is specifically:

[0063] Obtain the distance d1 between each positive sample in the positive sample set and the nearest positive sample, as well as the distance d2 between the positive sample and the nearest negative sample. If d1 > d2, then recalculate d1 and / or d2 according to the weight set so that d1 < d2, obtaining multiple inequalities containing weights.

[0064] If d1 > d2, it indicates that this positive sample data is closer to the negative sample and the two are not easily distinguishable. Enhancing this positive sample makes it easier for the model to learn its features. By making d1 < d2, weights can be obtained to make the enhanced sample closer to the positive sample, that is, the enhanced positive sample is closer to other positive samples rather than negative samples, thus avoiding errors caused by the enhanced sample (data that does not actually exist) being closer to the negative sample. For example, the nearest positive sample to positive sample 1 is positive sample 5, and the distance between them is d1 = 7. The nearest negative sample to positive sample 1 is negative sample 8, and the distance between them is d2 = 3. Since d1 > d2, multiply the weight set and the sample according to the corresponding positions, and then recalculate the distance d1 between positive sample 1 and positive sample 5, as well as the distance d2 between positive sample 1 and negative sample 8, so that d1 < d2.

[0065] The following is illustrated with an example. Assume that positive sample 1 is <70, 1, 1.4, 120>, and after normalization, it is <0.9, 0.8, 0.8, 0.6>. For the convenience of explanation, the following examples will use the normalized values. Positive sample 5 is <0.8, 0.9, 0.9, 0.7>, and negative sample 8 is <0.9, 0.9, 0.8, 0.7>. Calculate according to the Euclidean distance formula Similarly, calculate to get d2 = 0.141.

[0066] Since the sample has 4 elements, the weight set has 4 elements. Assume they are <k1, k2, k3, k4> respectively. After multiplying the weight set and the sample values correspondingly, positive sample 1 is <0.9k1, 0.8k2, 0.8k3, 0.6k4>, and positive sample 5 is <0.8k1, 0.9k2, 0.9k3, 0.7k4>. According to the Euclidean distance formula, a new d1 is obtained, and it is required that d1 < d2, then an inequality about k1, k2, k3, k4 will be obtained. If there are ten positive samples, 5 inequalities will be obtained.

[0067] Take the multiple inequalities containing weights as constraint conditions, and take the value of each weight being closest to 1 as the objective function, and use a numerical optimization algorithm to obtain at least one set of weight parameters.

[0068] After obtaining multiple inequalities about weights, these inequalities are used as constraints, and the value of each weight is closest to 1 as the objective function. The reason for taking the value of each weight closest to 1 as the objective function is to prevent a certain variable of the sample from being overly increased or reduced, resulting in unreasonable data. Taking the value of each weight closest to 1 as the objective function, in the specific implementation, the objective function Z can be minimized, Z = (k1-1) 2 +(k2-1) 2 +(k3-1) 2 +(k4-1) 2 Then, a numerical optimization algorithm is used to obtain at least one set of weight parameters, that is, to obtain at least one<k1,k2,k3,k4> Regarding the method of evaluating the constraint conditions and the objective function, in addition to the numerical optimization algorithm, other methods may also be used, and the present invention does not specifically limit this.

[0069] Step 2, that is, enhancing the positive sample set based on the weight parameter to obtain the enhanced positive sample set, is specifically:

[0070] For each positive sample in the positive samples, multiply the value of the positive sample and the weight set at the corresponding position to obtain an enhanced positive sample, and put the positive sample before enhancement and the positive sample after enhancement into a second positive sample set;

[0071] The distance between the enhanced positive sample and the original positive sample is relatively close, which avoids the situation that the enhanced positive sample is too close to the negative sample, resulting in an error in the enhanced positive sample. The second positive sample set includes the original positive sample set and the samples after each positive sample in the positive sample set is enhanced.

[0072] In order to destroy the linear relationship between the enhanced positive sample and the original sample, in a specific embodiment, at least one parameter is randomly selected from the enhanced positive sample, and the at least one parameter is recalculated according to the perturbation factor corresponding to the preset parameter; the perturbation factor is a very small number. For example, the maximum weight in the sample set is 90KG and the minimum is 40KG, then the perturbation factor corresponding to the set weight is 1KG or 2KG. If it is a normalized sample, you only need to normalize the perturbation factor.

[0073] For each positive sample in the second positive sample set, obtaining a positive sample closest to the positive sample from the second positive sample set to form a sample pair;

[0074] The distance of each sample pair is calculated, and a plurality of enhanced samples are obtained according to the distance and a preset spacing and put into the second positive sample set, and a filtering operation is performed on the second positive sample set, and the filtered second positive sample set is used as the enhanced positive sample set.

[0075] Assume that the second positive sample set includes 4 positive samples, and the two closest sample pairs are <sample 1, sample 3> and <sample 2, sample 4>. For example, for the sample pair <sample 1, sample 3>, a number of sample points are added on the straight line from sample 1 to sample 3. In a specific embodiment, starting from one sample of the sample pair, a sample point is added at a preset interval along the direction of the other sample of the sample pair, such as Figure 4 As shown, the added sample points are put into the second positive sample set as enhanced samples.

[0076] In order to prevent obvious abnormal data from appearing in the second positive sample set, in one embodiment, it is also necessary to filter the positive samples in the second positive sample set. In a specific embodiment,

[0077] Get the maximum and minimum values ​​of each element of the positive sample in the sample set, and for each sample in the second positive sample set, determine whether each element is within the corresponding range of the element. If so, keep it, otherwise delete it from the second positive sample set; the corresponding range refers to the interval formed by the minimum value and the maximum value. For example, the maximum value of weight in the positive sample set is 90KG, and the minimum value is 40KG. If a sample with a weight of 95KG appears in the second positive sample set, delete it from the second positive sample set. This can avoid errors introduced by enhanced samples and try to keep the enhanced samples close to the original positive samples.

[0078] In another embodiment, the filtering operation on the second positive sample set is specifically:

[0079] Obtain the shortest distance d3 between each sample in the sample set and other samples, and determine the maximum value d4 of the distance d3 corresponding to each sample in the sample set;

[0080] Calculate the shortest distance d5 between each sample in the second positive sample set and other samples in the third sample set, and if d5>d4, delete the sample from the second positive sample set; wherein the third sample set includes the second positive sample set and the negative sample set.

[0081] S13, in the first stage, the negative sample set and the enhanced positive sample set are used to train the diabetic nephropathy prediction model, and in the second stage, the positive sample set before enhancement and the first negative sample set are used to train the diabetic nephropathy prediction model;

[0082] After obtaining the enhanced positive sample set, the present invention adopts a two-stage training method to predict diabetic nephropathy. Among them, the diabetic nephropathy prediction model is preferably a deep neural network model or a multilayer perceptron (MLP), and the present invention does not specifically limit the specific structure of the diabetic nephropathy prediction model.

[0083] In the first training stage, negative sample sets and enhanced positive sample sets are used. This stage allows the model to regress quickly. In the second training stage, the positive sample set before enhancement and the first negative sample set are used. This stage mainly fine-tunes the parameters of the model. Among them, the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement. Specifically: calculate the average distance d6 of each sample in the negative sample set to the nearest N negative samples, and the average distance d7 to the nearest N positive samples, sort the samples in the negative sample set in the order of |d6-d7| from small to large, and select negative samples with the same number of samples as in the positive sample set before enhancement from the sorted samples.

[0084] S14, collecting electronic medical records of the patient to be predicted, obtaining the input of the diabetic nephropathy prediction model according to the keyword set, and using the output of the diabetic nephropathy prediction model as the risk of the patient to be predicted to develop diabetic nephropathy.

[0085] When making a prediction, you only need to obtain the electronic medical records of the patient to be predicted. The system can automatically obtain the input of the diabetic nephropathy prediction model based on the keyword set, and then use the output as the result. In a more specific embodiment, the output result is a probability value, that is, the risk probability of diabetic nephropathy.

[0086] Embodiment 2, the present invention also provides a diabetic nephropathy risk prediction system based on machine learning, the system comprising the following modules:

[0087] The sample set acquisition module is used to obtain the electronic medical records of the patient, extract the values ​​corresponding to the keywords from the electronic medical records according to the keyword set arranged in a preset order, and form a sample set, wherein the numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; and set a weight set, wherein the number of weights in the weight set is the same as the number of keywords in the keyword set;

[0088] A sample set enhancement module is used to divide the sample set into a positive sample set and a negative sample set according to the sample label, and obtain a weight parameter that meets the requirements according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance between each sample and the negative sample, and the weight set; based on the weight parameter, the positive sample set is enhanced to obtain an enhanced positive sample set;

[0089] A training module, used for training the diabetic nephropathy prediction model using the negative sample set and the enhanced positive sample set in the first stage, and for training the diabetic nephropathy prediction model using the positive sample set before enhancement and the first negative sample set in the second stage;

[0090] A prediction module, configured to collect the electronic medical records of the patient to be predicted, obtain the input of the diabetic nephropathy prediction model according to the keyword set, and use the output of the diabetic nephropathy prediction model as the risk situation of the patient to be predicted having diabetic nephropathy.

[0091] Preferably, obtaining the weight parameters that meet the requirements according to the closest distance between each sample in the positive sample set and the positive sample, the closest distance to the negative sample, and the weight set, specifically:

[0092] Obtain the distance d1 between each positive sample in the positive sample set and the closest positive sample, and the distance d2 from the closest negative sample. If d1 > d2, recalculate the distance d1 and / or d2 according to the weight set to make d1 < d2, and obtain multiple inequalities with weights.

[0093] Use the multiple inequalities with weights as constraint conditions, and use the value of each weight being closest to 1 as the objective function, and adopt a numerical optimization algorithm to obtain at least one set of weight parameters.

[0094] Preferably, enhancing the positive sample set based on the weight parameters to obtain an enhanced positive sample set, specifically:

[0095] For each positive sample in the positive samples, multiply the value of the positive sample and the weight set at the corresponding positions to obtain an enhanced positive sample, and put the positive sample before enhancement and the enhanced positive sample into the second positive sample set.

[0096] For each positive sample in the second positive sample set, obtain the positive sample closest to the positive sample from the second positive sample set to form a sample pair.

[0097] Calculate the distance of each sample pair, obtain multiple enhanced samples according to the distance and a preset spacing and put them into the second positive sample set, perform a filtering operation on the second positive sample set, and use the filtered second positive sample set as the enhanced positive sample set.

[0098] Preferably, obtaining multiple enhanced samples according to the distance and a preset spacing and putting them into the second positive sample set, specifically:

[0099] Starting from one sample of the sample pair, add a sample point at a preset spacing along the direction of the other sample of the sample pair, and use the added sample point as an enhanced sample and put it into the second positive sample set.

[0100] Preferably, performing a filtering operation on the second positive sample set, specifically:

[0101] Obtain the shortest distance d3 between each sample in the sample set and other samples, and determine the maximum value d4 of the distance d3 corresponding to each sample in the sample set;

[0102] Calculate the shortest distance d5 between each sample in the second positive sample set and other samples in the third sample set, and if d5>d4, delete the sample from the second positive sample set; wherein the third sample set includes the second positive sample set and the negative sample set.

[0103] Preferably, the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement.

[0104] Preferably, the samples in the first negative sample set are selected from the negative sample set according to the distances from the positive samples in the positive sample set before enhancement, specifically:

[0105] Calculate the average distance d6 between each sample in the negative sample set and the nearest N negative samples, and the average distance d7 between each sample in the negative sample set and the nearest N positive samples, sort the samples in the negative sample set in ascending order of |d6-d7|, and select negative samples with the same number of samples as in the positive sample set before enhancement from the sorted samples.

[0106] Embodiment 3, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computer, the method described in Embodiment 1 is implemented.

[0107] In a fourth embodiment, the present invention further provides a device, which includes at least a processor and a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the method described in the first embodiment is implemented.

[0108] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding the necessary general hardware platform, and of course can also be implemented by a combination of hardware and software. Based on this understanding, the above technical solution can essentially or contribute to the prior art in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. In addition, if the samples and other data mentioned in the present invention involve patient or personal information, desensitization operations will be uniformly performed, or other methods that can remove personal information will be used; if there are situations that require the patient or user to know or agree, the patient or user’s consent will be obtained.

[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for predicting diabetic nephropathy risk based on machine learning, characterized in that: The method includes the following steps: Obtain the electronic medical record of the patient, and extract the values corresponding to the keywords from the electronic medical record according to the keyword set arranged in a preset order to form a sample set. The numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; set a weight set, and the number of weights in the weight set is the same as the number of keywords in the keyword set; Divide the sample set into a positive sample set and a negative sample set according to the sample labels, and obtain the weight parameters that meet the requirements according to the nearest distance between each sample in the positive sample set and the positive samples, the nearest distance between each sample in the positive sample set and the negative samples, and the weight set; enhance the positive sample set based on the weight parameters to obtain an enhanced positive sample set; In the first stage, use the negative sample set and the enhanced positive sample set to train the diabetic nephropathy prediction model. In the second stage, use the positive sample set before enhancement and the first negative sample set to train the diabetic nephropathy prediction model; the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement; Collect the electronic medical record of the patient to be predicted, obtain the input of the diabetic nephropathy prediction model according to the keyword set, and use the output of the diabetic nephropathy prediction model as the risk situation of the patient to be predicted having diabetic nephropathy; The obtaining of the weight parameters that meet the requirements according to the nearest distance between each sample in the positive sample set and the positive samples, the nearest distance between each sample in the positive sample set and the negative samples, and the weight set is specifically as follows: Obtain the distance d1 between each positive sample in the positive sample set and the nearest positive sample, and the distance d2 between each positive sample in the positive sample set and the nearest negative sample. If d1>d2, then multiply the weight set and the samples according to the corresponding positions as the values of the samples, and recalculate the distance d1 and / or d2 to make d1<d2, obtaining multiple weighted inequalities; Use the multiple weighted inequalities as constraint conditions, and use the value of each weight being closest to 1 as the objective function, and use a numerical optimization algorithm to obtain at least one set of weight parameters; The enhancing of the positive sample set based on the weight parameters to obtain an enhanced positive sample set is specifically as follows: For each positive sample in the positive sample set, multiply the value of the positive sample and the weight set according to the corresponding positions to obtain an enhanced positive sample, and put the positive sample before enhancement and the enhanced positive sample into the second positive sample set; For each positive sample in the second positive sample set, obtain the positive sample closest to the positive sample from the second positive sample set to form a sample pair; Calculate the distance between each sample pair, obtain multiple enhanced samples according to the distance between the sample pairs and a preset spacing, and put them into the second positive sample set, and perform a filtering operation on the second positive sample set, and use the filtered second positive sample set as the enhanced positive sample set; The obtaining of multiple enhanced samples according to the distance between the sample pairs and a preset spacing and putting them into the second positive sample set is specifically as follows: Starting from one sample of the sample pair, a sample point is added at a preset interval along the direction of the other sample of the sample pair, and the added sample point is put into the second positive sample set as an enhanced sample; The filtering operation on the second positive sample set is specifically: Obtain the shortest distance d3 between each sample in the second positive sample set and other samples, and determine the maximum value d4 of the distance d3 corresponding to each sample in the second positive sample set; Calculate the shortest distance d5 between each sample in the second positive sample set and other samples in the third sample set, and if d5>d4, delete the sample from the second positive sample set; wherein the third sample set includes the second positive sample set and the negative sample set; The samples in the first negative sample set are selected from the negative sample set according to the distances from the positive samples in the positive sample set before enhancement, specifically: Calculate the average distance d6 between each sample in the negative sample set and the nearest N negative samples, and the average distance d7 between each sample in the negative sample set and the nearest N positive samples, sort the samples in the negative sample set in ascending order of |d6-d7|, and select negative samples with the same number of samples as in the positive sample set before enhancement from the sorted samples.

2. A diabetic nephropathy risk prediction system based on machine learning, characterized in that: The system includes the following modules: The sample set acquisition module is used to acquire the electronic medical records of the patient, and extract the values ​​corresponding to the keywords from the electronic medical records according to the keyword set arranged in a preset order to form a sample set, wherein the numerical arrangement order of the samples corresponds to the order of the keywords in the keyword set; Set a weight set, the number of weights in the weight set is the same as the number of keywords in the keyword set; A sample set enhancement module is used to divide the sample set into a positive sample set and a negative sample set according to the sample label, and obtain a weight parameter that meets the requirements according to the closest distance between each sample in the positive sample set and the positive sample and the closest distance between each sample and the negative sample and the weight set; Enhance the positive sample set based on the weight parameter to obtain an enhanced positive sample set; A training module, used for training the diabetic nephropathy prediction model using a negative sample set and an enhanced positive sample set in a first stage, and training the diabetic nephropathy prediction model using a positive sample set before enhancement and a first negative sample set in a second stage; the number of samples in the first negative sample set is the same as the number of samples in the positive sample set before enhancement; and the samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement; A prediction module, used for collecting electronic medical records of patients to be predicted, obtaining input of a diabetic nephropathy prediction model according to the keyword set, and using output of the diabetic nephropathy prediction model as the risk of diabetic nephropathy in patients to be predicted; The weight parameters that meet the requirements are obtained according to the closest distance between each sample in the positive sample set and the positive sample, and the closest distance between each sample and the negative sample, and the weight set, specifically: Obtain the distance d1 between each positive sample in the positive sample set and the nearest positive sample, and the distance d2 between the positive sample and the nearest negative sample. If d1 > d2, multiply the weight set and the sample according to the corresponding positions as the value of the sample, and recalculate the distance d1 and / or d2 to make d1 < d2, obtaining multiple inequalities containing weights; Take the multiple inequalities containing weights as constraint conditions, and take the value of each weight being closest to 1 as the objective function, and use a numerical optimization algorithm to obtain at least one set of weight parameters; Enhancing the positive sample set based on the weight parameters to obtain an enhanced positive sample set, specifically: For each positive sample in the positive sample set, multiply the value of the positive sample and the weight set according to the corresponding positions to obtain an enhanced positive sample, and put the positive sample before enhancement and the enhanced positive sample into the second positive sample set; For each positive sample in the second positive sample set, obtain the positive sample closest to the positive sample from the second positive sample set to form a sample pair; Calculate the distance of each sample pair, obtain multiple enhanced samples according to the distance of the sample pair and a preset spacing, and put them into the second positive sample set, perform a filtering operation on the second positive sample set, and take the filtered second positive sample set as the enhanced positive sample set; The obtaining multiple enhanced samples according to the distance of the sample pair and a preset spacing and putting them into the second positive sample set, specifically: Starting from one sample of the sample pair, add a sample point at intervals of the preset spacing along the direction of the other sample of the sample pair, and put the added sample point into the second positive sample set as an enhanced sample; The performing a filtering operation on the second positive sample set, specifically: Obtain the nearest spacing d3 between each sample in the second positive sample set and other samples, and determine the maximum value d4 of the spacing d3 corresponding to each sample in the second positive sample set; Calculate the nearest distance d5 between each sample in the second positive sample set and other samples in the third sample set. If d5 > d4, delete the sample from the second positive sample set; where the third sample set includes the second positive sample set and the negative sample set; The samples in the first negative sample set are selected from the negative sample set according to the distance from the positive samples in the positive sample set before enhancement, specifically: Calculate the average distance d6 between each sample in the negative sample set and the nearest N negative samples, and the average distance d7 between the sample and the nearest N positive samples, sort the samples in the negative sample set in ascending order of |d6 - d7|, and select the same number of negative samples as the samples in the positive sample set before enhancement from the sorted samples.

Citation Information

Patent Citations

  • Model training and sample balancing method and device, and personal credit scoring system

    CN106909981A

  • Oversampling method for balanced generation of positive and negative samples for malicious traffic detection

    CN112235293A

  • Diabetic nephropathy prediction method, system and device based on machine learning

    CN113470816A

  • End-stage nephropathy complication risk prediction system based on comparative learning

    CN114913982A

  • Model training method and device, equipment and storage medium

    CN116756577A