Unbalanced data classification method for adaptively optimizing oversampling ratio
By adaptively optimizing the oversampling ratio and decision optimization method, the poor performance problem caused by a fixed oversampling ratio in imbalanced data classification is solved, and more stable classifier performance and higher classification accuracy are achieved.
Patent Information
- Application Number
- CN202510967402.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-10-17
AI Technical Summary
In existing imbalanced data classification methods, the oversampling ratio is fixed at 1:1, resulting in poor classifier performance and a deviation between the generated data and the real data, affecting the classification accuracy.
By adaptively optimizing the oversampling ratio, using step size iteration to generate the optimal ratio, combining DS evidence theory and KL divergence analysis, the classifier decision is optimized to generate the final prediction result.
It achieves data category balance, maintains the original data structure, improves the stability and accuracy of the classifier, reduces the false detection and missed detection rates, and enhances the ability to identify minority classes.
Smart Images

Figure CN120804945A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of unbalanced data processing, and particularly relates to an unbalanced data classification method for adaptively optimizing an oversampling ratio. BACKGROUND
[0002] In many practical applications, such as medical diagnosis, fraud detection and fault prediction, the data set often has a class imbalance. Imbalance refers to a significant difference in the number of samples of different classes in a data set. For example, in medical diagnosis, the proportion of people with cancer is very small; in credit card transactions, fraudulent transactions are also a small part. This imbalance poses a serious challenge to machine learning classifiers. Traditional classification methods often favor the class with more samples, resulting in poor prediction of the minority class. However, in practical applications, minority class samples often contain more valuable information. In medical diagnosis, missed detection of sick patients will directly lead to missed treatment for patients; in financial risk control scenarios, misjudgment of fraudulent transactions may cause significant economic losses. Therefore, how to improve the classification accuracy of classifiers for unbalanced data is a hot research topic.
[0003] To solve the problem of unbalanced data classification, common methods include data-level methods, algorithm-level methods, and ensemble learning methods. Data-level methods, especially oversampling methods, can effectively improve the recognition ability of classifiers for minority classes by directly acting on data distribution and increasing the number of minority classes without losing information of majority classes, and are widely used in unbalanced data classification tasks. For example, random oversampling method balances the class distribution by randomly duplicating minority class samples; synthetic minority over-sampling technique (SMOTE) generates new samples by interpolating minority class samples to expand the number of minority class samples.
[0004] At present, most oversampling methods usually adjust the ratio of the number of minority class samples to the number of majority class samples to 1:1 in order to achieve complete balance of class distribution. However, the classification effect of the classifier is not necessarily optimal when the ratio of the number of small class data to the number of large class data after oversampling (oversampling ratio) is 1:1. In addition, there is inevitably some deviation between the generated data after oversampling and the real data. This uncertainty of generated data will to some extent destroy the original data distribution and bring some negative effects to the classifier training, thus leading to incorrect classification of test data. SUMMARY
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides an imbalanced data classification method with adaptively optimized oversampling ratio, which is used to solve the problems of data classification errors and low data classification performance in the existing imbalanced data classification methods.
[0006] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is: A method for imbalanced data classification with adaptively optimized oversampling ratio comprises the following steps: S1. Obtain the original training set, test set, and validation set, count the ratio of large-category to small-category data in the original training set, calculate the oversampling ratio sequence, and obtain the optimal oversampling ratio through step size iteration; S2. Oversampling the original training set using the optimal oversampling ratio, and using the oversampled training set to train a classifier. After generating the optimal classifier, the original test set is input for prediction and classification, and preliminary classification results for each test data in the test set are obtained. S3, according to the Euclidean distance of each test data to each validation data in the original validation set in its neighborhood, filter each test data K The nearest neighbor validation data is used to calculate the classification prediction probability of each nearest neighbor validation data and the true label KL Divergence, to generate weighted KL Divergence, and through index mapping, it is used as the reliability score of the preliminary classification results of each test data; S4. Calculate the basic confidence value of each test data belonging to different data categories under the oversampled training data based on the reliability score of the preliminary classification result of each test data; S5. Statistical analysis of each test data under the original data set and K The number of nearest neighbor verification data or training data belonging to the same data category, and combined with the reliability score of the preliminary classification result of each test data, calculate the basic confidence value of each test data belonging to different data categories under the original data set; S6. Based on the DS evidence theory, the basic trust values of each test data belonging to different data categories under the oversampled training data are fused with the basic trust values of each test data belonging to different data categories under the original data set to obtain the optimized classification results of each test data, which are the final predicted data categories.
[0007] The present invention has the following beneficial effects: 1. The proposed imbalanced data classification method with adaptive oversampling ratio optimization not only achieves relative balance of data categories, but also maximizes the preservation of the structural information of the original data. Furthermore, by optimizing the decision-making of the preliminary classification results, the data classification performance is improved. 2. By dynamically generating the oversampling ratio sequence, the optimal oversampling ratio is obtained, which not only finds a compromise between reducing the degree of class imbalance and maintaining the original structure of the data, but also avoids the under-sampling or over-synthesis problem caused by the traditional fixed 1:1 sampling ratio, and improves the accuracy of the classifier and the classification performance of the data; 3. The application samples in a step-by-step trial manner, which can select appropriate sampling amount under the premise of minimizing data distribution deviation, compared with the traditional method of directly expanding the minority class data to the same amount as the majority class data, thereby reducing the interference of synthesized samples on the original feature space, and significantly reducing the negative impact of data noise introduced by sampling on the training of the classifier; 4. The reliability score and performance evaluation of each sampling ratio on the validation data effectively reduces the accidental deviation caused by a single sampling scheme, makes the recognition ability of the classifier to the minority class more stable, improves the generalization ability in the test stage, and realizes stable classifier performance; 5. The confidence analysis based on the divergence is introduced, KL The real label statistics of the neighborhood are used for compensation, so that the final classification result is more stable when facing noise or sample deviation, and the real information of the minority class data is supplemented by the neighborhood compensation evidence, the recognition ability of the minority class data is enhanced, the false rejection and missed detection rates are effectively reduced, and the classification accuracy is improved. On this basis, the basic trust distribution corresponding to the preliminary classification result is fused with the compensatory evidence, the predicted classification result is optimized, and the data classification performance and accuracy are improved. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 It is a flowchart of an adaptive and optimized oversampling ratio imbalance data classification method. DETAILED DESCRIPTION
[0009] The specific embodiments of the application are described below to facilitate those skilled in the art to understand the application, but it should be clear that the application is not limited to the scope of the specific embodiments, and for those skilled in the art, it is obvious that various changes are within the spirit and scope of the application defined and determined by the appended claims, and all applications utilizing the concept of the application are within the scope of protection.
[0010] As shown in the figure, an adaptive and optimized oversampling ratio imbalance data classification method includes the following steps S1-S6: Figure 1 S1, obtain the original training set, test set and validation set, count the proportion of large class and small class data in the original training set, calculate the oversampling ratio sequence, and obtain the optimal oversampling ratio through step iteration. S1, obtain the original training set, test set and validation set, count the proportion of large class and small class data in the original training set, calculate the oversampling ratio sequence, and obtain the optimal oversampling ratio through step iteration.
[0011] In this embodiment, an optimal oversampling method based on step-size iteration is used to obtain the optimal oversampling ratio through step-size iteration, so that a relatively balanced training set can be obtained in the subsequent steps, and then the classifier can be trained. The classifier selected in the present invention is a Gaussian naive Bayes classifier; and this step is the process of dynamically generating a sequence of oversampling ratios. That is, the present invention does not adopt the fixed 1:1 sampling ratio proposed by traditional methods. Instead, based on the initial ratio of the number of majority class and minority class samples in the training set, a series of candidate oversampling ratios are generated in sequence using step-size iteration, thereby constructing a variety of sampling schemes covering the range from the original ratio to complete balance (ratio = 1.0). The operation process for obtaining the optimal oversampling ratio is as follows: Specifically, step S1 includes S11-S15: S11. Get the original training set, test set, and validation set, namely:
[0012]
[0013]
[0014] in, represents the original training set, 、 、 、 Respectively represent the first, second, and , training data, represents the original validation set, 、 、 、 Respectively represent the first, second, and , Verification data, represents the original test set, 、 、 、 Respectively represent the first, second, and , Test data.
[0015] S12. Count the ratio of large-category data to small-category data in the original training set, and use 1 to represent large-category data and 0 to represent small-category data. The data category set is ,Right now: .
[0016] S13, according to the proportion of large class data and small class data in the original training set, the over-sampling ratio sequence is calculated, that is:
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023] wherein, represents the over-sampling ratio sequence, , , , , , respectively represent the first, the second, the third, the fourth, the fifth, the sixth over-sampling ratio in the over-sampling ratio sequence, represents the rounding operation, represents the value interval, respectively represent the small class data amount and the large class data amount in the original training set.
[0024] In this embodiment, the starting over-sampling ratio is determined by the ratio of the large class data amount and the small class data amount in the original training set, and then the value is taken according to the value interval until the terminal over-sampling ratio is 1.0. Wherein, the value is 0.1. In addition, in the formula , the integer 10 has no physical meaning, and it is only used to express the calculation of the over-sampling ratio value into a mathematical formula. Because the starting over-sampling ratio of the over-sampling value sequence should be greater than the value of the ratio of the small class data and the large class data in the data set, otherwise over-sampling cannot be performed to ensure that there is no case of
[0025] S14, calculate the Matthew correlation coefficient value corresponding to each oversampling ratio in the oversampling ratio sequence, specifically: S141, according to each oversampling ratio, use the oversampling method of synthesizing the minority class to oversample each training data in the original training set, and obtain the oversampled training set, that is:
[0026] wherein, represents the training set oversampled by the i-th oversampling ratio,
[0027] In this embodiment, the method is used for oversampling, which can also increase the number of original training data, so as to obtain appropriate training samples, thereby improving the performance of the classifier in subsequent training.
[0028] S142, use the oversampled training set to train the Gaussian naive Bayes classifier, and obtain the trained Gaussian naive Bayes classifier, that is:
[0029] wherein, represents the trained Gaussian naive Bayes classifier using the i-th oversampling ratio oversampled training set, represents the Gaussian naive Bayes classifier training function.
[0030] S143, input the original verification set into the trained Gaussian naive Bayes classifier, and obtain the Matthew correlation coefficient value corresponding to each oversampling ratio, that is:
[0031] wherein, represents the Matthew correlation coefficient value corresponding to the i-th oversampling ratio, represents the evaluation calculation function of the classifier prediction result.
[0032] S15, compare the Matthew correlation coefficient value corresponding to each oversampling ratio, and obtain the optimal oversampling ratio, that is:
[0033] wherein, represents the optimal oversampling ratio, denotes the argument of the maximum of the function.
[0034] In this embodiment, the performance is evaluated in steps S14-S15 in proportion in turn, that is, for each candidate oversampling ratio, a synthetic minority over-sampling technique (SMOTE) is used to generate synthetic minority class samples on the original training set, and a Gaussian naive Bayes classifier is used to verify the validation set, and the corresponding evaluation index Matthew correlation coefficient value (MCC) is calculated, and the optimal sampling ratio is gradually screened out based on this.
[0035] In summary, the technical effect realized by this step is: 1) Adaptive balance data distribution: through a series of candidate ratio attempts and evaluations, a compromise between reducing class imbalance and maintaining the original structure of the data can be found, avoiding the oversampling or excessive synthesis problems that may be caused by traditional fixed 1:1 sampling; 2) Improve the stability of the classifier performance: the reliability score and performance evaluation of each sampling ratio on the validation set can effectively reduce the accidental deviation caused by a single sampling scheme, making the classifier's recognition ability of the minority class more stable, and thus improving the generalization ability in the test phase; 3) Reduce the risk of distribution deviation: compared with directly expanding the minority class to the same amount as the majority class, the step-by-step trial method of the present application can select the appropriate sampling amount under the premise of minimizing the data distribution deviation, thereby reducing the interference of synthetic samples on the original feature space, and significantly reducing the negative impact of data noise introduced by sampling on the training of the classifier.
[0036] S2, oversample the original training set using the optimal oversampling ratio to train the classifier using the oversampled training set, and after generating the optimal classifier, input the original test set for prediction classification to obtain the preliminary classification result of each test data in the test set.
[0037] In this embodiment, the optimal oversampling ratio obtained is used to oversample the original training set, and then the Gaussian naive Bayes classifier is trained using the oversampled training set, and the test set is classified to obtain the preliminary classification result.
[0038] Since the deviation between the data generated by sampling and the real data may cause the decision boundary of the classifier to deviate, affecting the accuracy of the prediction result of the classifier. Therefore, a decision optimization method is further proposed, that is, the preliminary classification result is corrected in steps S3-S6 to obtain the optimized prediction data class of each test data.
[0039] The principle of the decision optimization method is as follows: calculate the reliability of the preliminary classification results of each test data to quantify the local classification performance of the classifier for each test sample; then find the nearest neighbors of the test sample in the original data set to construct compensation evidence, and combine the DS evidence theory to correct the preliminary classification results to achieve decision optimization. The specific operation process is as follows: S3, according to the Euclidean distance of each test data to each validation data in the original validation set in its neighborhood, filter each test data K The nearest neighbor validation data is used to calculate the classification prediction probability of each nearest neighbor validation data and the true label KL Divergence, to generate weighted KL The divergence is calculated and mapped to the index to be the reliability score of the preliminary classification results of each test data.
[0040] In this embodiment, the predicted probability of the verification data of each nearest neighbor is calculated to be proportional to the actual label. KL Divergence is used as the reliability of the test set. Its purpose is to measure the reliability of each test data with this local information to facilitate the next step of correction.
[0041] Specifically, step S3 includes S31-S36: S31. Calculate the Euclidean distance between each test data in the original test set and each validation data in the original validation set in its neighborhood, that is:
[0042] in, Represents test data Validation data in its neighborhood The Euclidean distance, represents the total number of features of the data, 、 Represents test data , verify data In the The value of a feature.
[0043] S32, according to the Euclidean distance between each test data in the original test set and each validation data in the original validation set in its neighborhood, filter the data closest to each test data Verification data, get each test data Nearest neighbor validation data.
[0044] S33, calculate the classification prediction probability of the verification data of each nearest neighbor and the difference between each classification prediction probability and the true label Divergence, that is:
[0045]
[0046]
[0047] wherein, denotes the classification prediction probability of the th nearest neighbor validation data , , denotes the classification prediction probability of the th nearest neighbor validation data belongs to the macro data 1 and the micro data 0, denotes the classification prediction probability of the th nearest neighbor validation data belongs to the data category , denotes the category type quantity, denotes the one-hot encoding of the real label of the th nearest neighbor validation data , denotes the one-hot encoding of the real label of the th nearest neighbor validation data belongs to the data category , denotes the logarithmic function, denotes the divergence between the classification prediction probability and the real label of the th nearest neighbor validation data .
[0048] In this embodiment, KL divergence can convert the difference between the prediction probability distribution of the validation sample and the distribution of its real label (represented by one-hot encoding) into a non-negative scalar value, and the larger the value, the more serious the deviation of the prediction distribution from the real distribution; the smaller the value, the closer the prediction to the real; therefore, KL the calculation of KL divergence is equivalent to providing a unified and measurable “error” measure, and preparing for the next step of weighted and nonlinear mapping. Specifically, KL divergence is a measure of the difference between the prediction result and the real result, such as two data whose real labels are (1, 0), but the prediction results are (0.51, 0.49) and (0.99, 0.01) respectively, and both prediction results are correct, but KL divergence calculates the first value to be higher, and the second result value to be lower, so divergence can more finely depict the uncertainty.
[0049] S34, according to each nearest neighbor validation data of each test data and its corresponding Euclidean distance, the weight of each nearest neighbor validation data is calculated, namely:
[0050] wherein, the weight of the first nearest neighbor validation data , the Euclidean distance between the test data and the first nearest neighbor validation data .
[0051] In this embodiment, the weight calculation principle is: using the Euclidean distance between the test data and the nearest neighbor validation data, the weight of each nearest neighbor validation data is set, that is, the validation data closer to the test data has a larger weight; Because the validation data closer to the test data often has more similar attributes and distribution characteristics, by giving the neighbor a higher weight, the reliability score obtained can better reflect the classifier prediction performance of the test data in its true local area; On the contrary, giving the far neighbor a lower weight can effectively reduce the influence of noise samples on the final reliability score and improve the overall robustness.
[0052] S35, according to the weight of each nearest neighbor validation data, the weighted divergence of each test data and nearest neighbor validation data is calculated, that is:
[0053] wherein, the weighted divergence of the test data and nearest neighbor validation data.
[0054] S36, according to the weighted divergence of each test data and nearest neighbor validation data, the reliability score of the preliminary classification result of each test data is obtained through exponential mapping, that is:
[0055] wherein, the reliability score of the preliminary classification result of the test data , the exponential function.
[0056] In this embodiment, the comprehensive metric is converted into a "reliability score" in the interval (0, 1) through exponential mapping, which is not only easy to interpret and threshold, but also flexible to use in subsequent fusion or correction; further improving the stability and robustness of the preliminary reliability evaluation based on weighted KL divergence. Specifically, since the smaller the weighted KL divergence is, the higher the reliability of the test data is, therefore, after obtaining the preliminary classification results of the test set data, firstly, the weighted KL divergence between each test data and its several nearest neighbor points in the validation set is calculated, and then the reliability score of the preliminary classification result of each test data is obtained based on the exponential mapping of the weighted KL divergence, that is, through the local reliability metric, to quantify the reliability of the preliminary classification result of each test data.
[0057] S4, according to the reliability score of the preliminary classification result of each test data, calculate the basic trust value of each test data belonging to different data categories under the oversampled training data, that is:
[0058]
[0059]
[0060]
[0061] wherein, represents the basic trust value set of the test data belonging to different data categories under the oversampled training data, , , respectively represent the basic trust value of the test data belonging to the small class data 0, the large class data 1, and the uncertain data category under the oversampled training data, represents the classification prediction probability of the preliminary classification result of the test data , , respectively represent the classification prediction probability of the preliminary classification result of the test data belonging to the small class data 0 and the large class data 1, represents the basic trust value of the test data belonging to the data category under the oversampled training data, represents the classification prediction probability of the preliminary classification result of the test data belonging to the data category .
[0062] In this embodiment, the basic trust value assignment process of the reliability score of the preliminary classification result of each test data in the oversampled training set (the basic trust assignment corresponding to the preliminary classification result) is constructed, that is, the basic trust value set E1 (also referred to as evidence) is constructed by combining the reliability score and the preliminary classification result of the test data obtained in the above steps, so as to retain the preliminary classification result with high reliability score and weaken the preliminary classification result with low reliability score; at the same time, the prediction class and the prediction confidence are combined into one, and by means of the D-S evidence theory, the expression of the uncertain belonging class is retained, and a quantifiable, interpretable and controllable foundation is laid for the subsequent fusion decision of multiple evidence sources.
[0063] S5, the number of the test data in the original data set and the nearest neighbor verification data or training data belonging to the same data class is counted, and the reliability score of the preliminary classification result of each test data is combined to calculate the basic trust value of each test data in the original data set belonging to different data classes, that is: K
[0064]
[0065]
[0066] wherein, represents the test data in the original data set and the nearest neighbor verification data or training data belonging to the data class , represents the basic trust value set of the test data in the original data set belonging to different data classes, , , , respectively represent the basic trust value of the test data in the original data set belonging to the small class data 0, the large class data 1 and the uncertain data class , represents the basic trust value of the test data in the original data set belonging to the data class .
[0067] In this embodiment, the process is the construction process of the supplementary evidence (i.e. the construction of the compensatory evidence corresponding to the preliminary classification result) to correct the preliminary classification result with low reliability, that is, for the low-reliability sample, the supplementary evidence item is constructed in combination with the distribution information of the original data. Specifically, the frequency of the test data belonging to each same category in a number of nearest neighbors in the original training set and test set is counted, so as to convert the information combined with the reliability into the basic belief assignment (BBA) about the category to which the sample belongs, specifically: the test data with a low reliability score is corrected by combining the data distribution information in the original data set; when most of the neighbors belong to a certain category, it is indicated that the test data is more likely to really belong to the category; otherwise, it is reminded that there is a potential classification error.
[0068] S6, based on the D-S evidence theory, the basic belief values of each test data belonging to different data categories under the oversampled training data and the basic belief values of each test data belonging to different data categories under the original data set are fused to obtain the optimized classification result of each test data, that is, the final predicted data category.
[0069] In this embodiment, the D-S evidence theory is a mathematical theoretical framework for handling uncertainty problems, which can effectively integrate multi-source information and improve the accuracy and robustness of decision-making; therefore, the fusion rule of the D-S evidence theory is adopted in this embodiment, the basic belief values of each test data belonging to different data categories under the oversampled training data and the basic belief values of each test data belonging to different data categories under the original data set are fused, so as to fuse the basic belief assignment corresponding to the preliminary classification result and the compensatory evidence, superimpose the information of the two by the D-S evidence combination rule, obtain a new belief assignment, and thus obtain the final optimized prediction category; the advantages of such implementation are: because the output probability of the classifier or only the local consistency is simply relied on, each has its own limitations, the former may be unreliable when the distribution is shifted, and the latter may be misled by noisy neighbors; therefore, by fusing the two types of information sources of each test data in the same test set, a more robust and reliable result can be obtained.
[0070] Specifically, based on the D-S evidence theory, the formula for fusing the basic belief values of each test data belonging to different data categories under the oversampled training data and the basic belief values of each test data belonging to different data categories under the original data set is:
[0071] wherein, represents the basic belief value of a certain test data belonging to the data category after fusion by the D-S evidence theory, represents the basic belief value of a certain test data belonging to the data category in the basic belief value set a basic trust value of each test data, a basic trust value of each test data, a basic trust value of each test data, a basic trust value of each test data, , , a basic trust value of each test data, a basic trust value of each test data.
[0072] Specifically, the classification results of each test data are optimized as follows:
[0073] wherein, a basic trust value of each test data, , a basic trust value of each test data.
[0074] In summary, the imbalance data classification method for adaptive optimization of oversampling ratio provided by the application firstly realizes the relative balance of data categories, maximizes the preservation of the structure information of original data, and improves the data classification performance through decision optimization of the preliminary classification results; secondly, by dynamically generating an oversampling ratio sequence, the optimal sampling ratio is obtained, and the classification performance of the classifier is improved, that is, the method discards the traditional fixed 1:1 sampling ratio, generates a series of candidate oversampling ratios according to the initial proportion of the majority class data and the minority class data in the training set, and constructs a plurality of sampling schemes covering from the original proportion to complete balance (ratio = 1.0), which can find a compromise between reducing the imbalance degree of categories and preserving the original structure of data, avoid the under-sampling or excessive synthesis problem caused by the traditional fixed 1:1 sampling, and improve the classification performance and accuracy of the classifier by generating the optimal sampling ratio; moreover, compared with directly expanding the minority class data to the same amount as the majority class data, the application can select the appropriate sampling amount under the premise of minimizing the data distribution deviation, and also reduces the interference of the synthesized samples on the original feature space, significantly reduces the negative influence of the data noise introduced by sampling on the training of the classifier; and the reliability score and performance evaluation of each sampling ratio are performed on the validation data, which effectively reduces the accidental deviation caused by a single sampling scheme, makes the recognition ability of the classifier to the minority class more stable, and further improves the generalization ability in the test stage, realizes stable classifier performance; in addition, the application introduces the KL KL KLThe confidence analysis of divergence is compensated by using the real label statistics of the neighborhood, so that the final classification result is more stable when facing noise or sample deviation, that is, the real information of the minority class is supplemented by neighborhood compensation evidence, the identification ability of the minority class is enhanced, the false detection and missed detection rates are effectively reduced, and the classification accuracy is improved; finally, the basic trust distribution corresponding to the preliminary classification result is fused with the compensatory evidence, the predicted data category is optimized, and the classification performance and accuracy are improved.
[0075] The principles and implementation manners of the present application are described by using specific embodiments in the present application, and the above embodiment descriptions are only used to help understand the method of the present application and its core idea; meanwhile, for the ordinary skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges can be changed, and the above descriptions should not be understood as the limitation of the present application.
[0076] The person skilled in the art will understand that the embodiments described herein are used to help the reader understand the principles of the present application and should be understood as the protection scope of the present application not being limited to such specific descriptions and embodiments. The person skilled in the art can make various other specific modifications and combinations according to the technical inspirations disclosed in the present application without departing from the essence of the present application, and these modifications and combinations are still within the protection scope of the present application.
Claims
1. A method for imbalanced data classification with adaptive oversampling ratio optimization, characterized in that: The following steps are involved: S1. Obtain the original training set, test set, and validation set, count the ratio of large-category to small-category data in the original training set, calculate the oversampling ratio sequence, and obtain the optimal oversampling ratio through step size iteration; S2. Oversampling the original training set using the optimal oversampling ratio, and using the oversampled training set to train a classifier. After generating the optimal classifier, the original test set is input for prediction and classification, and preliminary classification results for each test data in the test set are obtained. S3, according to the Euclidean distance of each test data to each validation data in the original validation set in its neighborhood, filter each test data K The nearest neighbor validation data is used to calculate the classification prediction probability of each nearest neighbor validation data and the true label KL Divergence, to generate weighted KL Divergence, and through index mapping, it is used as the reliability score of the preliminary classification results of each test data; S4. Calculate the basic confidence value of each test data belonging to different data categories under the oversampled training data based on the reliability score of the preliminary classification result of each test data; S5. Statistical analysis of each test data under the original data set and K The number of nearest neighbor verification data or training data belonging to the same data category, and combined with the reliability score of the preliminary classification result of each test data, calculate the basic confidence value of each test data belonging to different data categories under the original data set; S6. Based on the DS evidence theory, the basic trust values of each test data belonging to different data categories under the oversampled training data are fused with the basic trust values of each test data belonging to different data categories under the original data set to obtain the optimized classification results of each test data, which are the final predicted data categories.
2. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 1, characterized in that: Step S1 specifically includes: S11. Get the original training set, test set, and validation set, namely: in, represents the original training set, 、 、 、 Respectively represent the first, second, and , training data, represents the original validation set, 、 、 、 Respectively represent the first, second, and , Verification data, represents the original test set, 、 、 、 Respectively represent the first, second, and , Test data; S12. Count the ratio of large-category data to small-category data in the original training set, and use 1 to represent large-category data and 0 to represent small-category data. The data category set is ,Right now: ; S13. Calculate the oversampling ratio sequence based on the ratio of large-category data to small-category data in the original training set; S14, calculating the Matthews correlation coefficient value corresponding to each oversampling ratio in the oversampling ratio sequence; S15. Compare the Matthews correlation coefficient values corresponding to each oversampling ratio to obtain the optimal oversampling ratio.
3. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 2, characterized in that: The formula for calculating the oversampling ratio sequence is: in, represents the oversampling ratio sequence, 、 、 、 、 、 Represents the first, second, and third oversampling ratios in the sequence. , , , Oversampling ratio, Indicates rounding operation, Indicates the value interval, 、 They represent the amount of small-category data and large-category data in the original training set respectively.
4. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 3, characterized in that: Step S14 specifically includes: S141. According to each oversampling ratio, the training data in the original training set are oversampled using the oversampling method of the synthetic minority class to obtain an oversampled training set, that is: in, Indicates the use of The training set is oversampled by an oversampling ratio of 、 、 、 Respectively indicate the use of The first, second, and third , training data; S142. Use the oversampled training set to train a Gaussian Naive Bayes classifier to obtain a trained Gaussian Naive Bayes classifier, namely: in, Indicates the use of The Gaussian Naive Bayes classifier trained on the training set with an oversampling ratio of represents the Gaussian Naive Bayes classifier training function; S143. Input the original validation set into the trained Gaussian Naive Bayes classifier to obtain the Matthews correlation coefficient value corresponding to each oversampling ratio, that is: in, Indicates the The Matthews correlation coefficient value corresponding to the oversampling ratio is Represents the evaluation calculation function of the classifier prediction result.
5. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 4, characterized in that: Compare the Matthews correlation coefficient values corresponding to each oversampling ratio and obtain the formula for the optimal oversampling ratio: in, represents the optimal oversampling ratio, Indicates the independent variable at which the function reaches its maximum value.
6. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 1, characterized in that: Step S3 specifically includes: S31. Calculate the Euclidean distance between each test data in the original test set and each validation data in the original validation set in its neighborhood, that is: in, Represents test data and validation data in its neighborhood The Euclidean distance, represents the total number of features of the data, 、 Represents test data , verify data In the The value of a feature; S32, according to the Euclidean distance between each test data in the original test set and each validation data in the original validation set in its neighborhood, filter the data closest to each test data Verification data, get each test data Validation data of the nearest neighbors; S33, calculate the classification prediction probability of the verification data of each nearest neighbor and the difference between each classification prediction probability and the true label Divergence, that is: in, Indicates the Nearest neighbor validation data The classification prediction probability of 、 Respectively represent Nearest neighbor validation data The classification prediction probability of belonging to the large category data 1 and the small category data 0, Indicates the Nearest neighbor validation data Belongs to the data category The classification prediction probability of Represents the category type quantity, Indicates the Nearest neighbor validation data The one-hot encoding of the true label, Indicates the Nearest neighbor validation data Belongs to the data category The one-hot encoding of the true label, represents the logarithmic function, Indicates the Nearest neighbor validation data The difference between the classification prediction probability and the true label Divergence; S34. Calculate the weight of each nearest neighbor's verification data based on the Euclidean distance between each test data and its corresponding nearest neighbor's verification data, that is: in, Indicates the Nearest neighbor validation data The weight of Represents test data With the Nearest neighbor validation data The Euclidean distance of S35, calculate the weight of each test data and the verification data of each nearest neighbor The weighted validation data of the nearest neighbors Divergence, that is: in, Represents test data and The weighted validation data of the nearest neighbors Divergence; S36, according to the test data and The weighted validation data of the nearest neighbors Divergence, through exponential mapping, the reliability score of the preliminary classification results of each test data is obtained, that is: in, Represents test data The reliability score of the preliminary classification results, Represents the exponential function.
7. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 6, characterized in that: The formula for calculating the basic confidence value of each test data belonging to different data categories under the oversampled training data is: in, Represents test data The basic trust value set belonging to different data categories under oversampled training data, 、 、 Represents test data Under oversampled training data, it belongs to small category data 0, large category data 1, and uncertain data category The basic trust value of Represents test data The classification prediction probability of the preliminary classification result, 、 Represents test data The classification prediction probability of the preliminary classification results belonging to small category data 0 and large category data 1, Represents test data Belongs to the data category under oversampled training data The basic trust value of Represents test data The preliminary classification results belong to the data category The classification prediction probability of .
8. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 7, characterized in that: The formula for calculating the basic trust value of each test data belonging to different data categories in the original data set is: in, Represents test data In the original data set The validation data or training data of the nearest neighbors belongs to the data category the number of Represents test data The basic trust value set belonging to different data categories in the original data set, 、 、 Represents test data In the original data set, it belongs to small category data 0, large category data 1, and uncertain data category The basic trust value of Represents test data In the original data set, it belongs to the data category Basic trust value.
9. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 8, characterized in that: Based on the DS evidence theory, the formula for data fusion is to combine the basic trust values of each test data belonging to different data categories under the oversampled training data with the basic trust values of each test data belonging to different data categories under the original data set: in, Indicates that a test data belongs to the data category after DS evidence theory fusion The basic trust value of Indicated in the basic trust value set A test data belongs to the data category The basic trust value of Indicated in the basic trust value set A test data belongs to the data category The basic trust value of 、 、 Both represent data categories. Represents the empty set.
10. The imbalanced data classification method with adaptive oversampling ratio optimization according to claim 9, characterized in that: The classification results of each test data optimization are: in, Indicates the classification result of a certain test data optimization, that is, the final predicted data category, 、 They respectively represent the basic confidence values of a test data belonging to small category data 0 and large category data 1 after fusion.