Optimal oversampling and neighborhood correction unbalanced data classification method
By adopting optimal oversampling and neighborhood correction methods on the unbalanced data set, synthetic samples following the original data distribution are generated, and the calibration matrix calibration classification results are used to solve the sample generation in the unbalanced data set processing in the prior art. Uncertainty and classifier optimization limitation issues improve classifier performance and consistency.
Patent Information
- Application Number
- CN202411461437.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2024-11-29
AI Technical Summary
Existing unbalanced data classification methods have sample generation uncertainty and global optimization limitations of classifiers when processing unbalanced data sets, resulting in low classification performance, especially low recognition rate for a few class samples, and the generated samples may be Change the original data distribution and affect the classification accuracy.
Using the optimal oversampling and neighborhood correction method, by obtaining the unbalanced data set, selecting the benchmark samples based on the density peak, generating synthetic samples, and using the calibration matrix to calibrate the classification results, ensuring that the newly generated samples follow the original data distribution and reduce the data Distribution changes to improve the classifier's processing ability of uncertain samples.
Effectively avoid model overfitting, improve the performance of the model on unknown data, ensure that the newly generated samples have similar statistical characteristics to the original data, improve the recognition ability of a few types of samples and the consistency of classifiers, and improve the classifier. overall performance.
Smart Images

Figure CN119046689A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of imbalanced data classification, and in particular relates to an imbalanced data classification method with optimal oversampling and neighborhood correction. Background Art
[0002] In practical applications, such as healthcare, fault diagnosis, and intrusion detection, datasets often exhibit class imbalance, that is, the number of samples in different classes varies significantly. For example, in the field of network security, the number of normal traffic (majority class) far exceeds the number of malicious intrusion traffic (minority class). This imbalance poses a challenge to model training, especially for minority class samples, which often contain key information, but traditional classification methods tend to favor the majority class, resulting in a low recognition rate for the minority class and missed detection problems.
[0003] In order to solve this problem, a variety of processing methods for imbalanced data sets have emerged in recent years. Among them, data oversampling technology is one of the commonly used preprocessing methods. By generating new samples of the minority class to balance the proportion between each class, the balanced data set after sampling can be used to train the basic classification model for classification tasks. Synthetic Minority Oversampling Technology (SMOTE) is a basic oversampling method based on data synthesis. It increases the number of minority class samples by searching for adjacent samples in the neighborhood of each minority class sample and generating artificial synthetic samples between this type of sample and its neighborhood. In recent years, in order to overcome the limitations of SMOTE and broaden its application scope, a variety of improved versions have emerged. For example, Borderline-SMOTE only oversamples minority class samples close to the class boundary; Safe-Level-SMOTE generates synthetic samples based on the security level calculation of adjacent minority class samples; CGMOS combines deterministic changes in the data set to select minority class samples; H-SMOTE uses neighboring elements and Manhattan distance to generate new samples centered on the minority class; SMOTE-kTLNN combines SMOTE for data balance enhancement, and uses a two-layer nearest neighbor classifier with iterative partitioning filters to eliminate noise samples by majority voting. These methods enhance the representativeness of minority class samples through different strategies and improve the performance of classifiers on imbalanced datasets. Although oversampling methods can improve the classification performance on imbalanced datasets to a certain extent, they also have certain shortcomings: (1) Uncertainty in sample generation: In the process of oversampling, there must be a certain difference between the generated samples and the actual samples. In this case, if the generated samples are wrong, the distribution of the original data may change, bringing ambiguous information to the classification.
[0004] (2) Global optimization limitations of the classifier: In the classification process after oversampling, inaccurate generation may lead to the generation of multiple indistinguishable uncertain samples, which are difficult to distinguish between different categories. In addition, the globally optimal classifier may not be applicable to every test sample, especially for the accurate classification of these uncertain samples.
[0005] In summary, although existing oversampling techniques have made significant progress in handling imbalanced datasets, they still have some limitations and further research is needed to address the above issues. Summary of the invention
[0006] In view of the above-mentioned deficiencies in the prior art, the present invention provides an optimal oversampling and neighborhood correction imbalanced data classification method which solves the problem of low performance of the existing oversampling method when processing imbalanced data sets.
[0007] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is: an unbalanced data classification method with optimal oversampling and neighborhood correction, comprising the following steps: S1. Obtain an unbalanced data set, divide the unbalanced data training set into a minority class subset and a majority class subset, select a benchmark sample in the minority class subset based on the density peak, and use the neighboring samples of the benchmark sample as artificial samples; S2. Generate synthetic samples based on the benchmark samples and artificial samples, and add the synthetic samples to the minority class subset, and obtain a balanced training data set based on the updated minority class subset and majority class subset; S3, training the classifier using the balanced training data set to obtain a trained classifier; S4, obtaining a test sample set, classifying the test sample set using the trained classifier, obtaining a classification result of each sample, and obtaining a determined sample set and an uncertain sample set according to the classification result of each sample; S5. For the uncertain samples in the uncertain sample set, the classification results are calibrated based on the calibration matrix to obtain the calibrated classification probability, and the classification results of the uncertain samples are determined according to the calibrated classification probability.
[0008] Furthermore, the step S1 is specifically as follows: S101. Obtain an unbalanced data training set and divide the unbalanced data training set into minority class subsets and the majority class subset ; S102. Calculate minority class subsets The local density of each sample in is:
[0009] in, For sample The local density of As a judgment indicator, if ,but ,otherwise, ; For sample With sample distance; For the minority class subset Middle samples; For the minority class subset Middle samples; is the threshold distance; S103. Determine the minority class subset The closest distance between samples in:
[0010] in, For sample The closest distance, indicating that the sample The local density in the minority class subset is greater than the sample The closest distance to other samples of the local density; For sample The local density of is the minimum value; S104, respectively, the minority class subsets The local density of each sample in is multiplied by the nearest distance to obtain the minority class subset The density peak of each sample in:
[0011] in, For sample The density peak value; S105, subset the minority class The samples in the above formula are sorted from large to small based on the density peak value, and the first T samples in the sorting are used as the benchmark samples; S106. For each benchmark sample, Perform K nearest neighbor search in , and use the obtained T×K nearest neighbor samples as artificial samples; the total number of artificial samples T×K is greater than or equal to ; The majority class subset The number of samples; For the minority class subset The number of samples.
[0012] Furthermore, the step S2 is specifically as follows: S201. Generate a synthetic sample based on the reference sample and the artificial sample corresponding to the reference sample:
[0013] in, For the The first synthetic samples; For the Benchmark samples; For the The weight of the synthetic samples; is a synthesis coefficient with a value range of [0,1]; For the The benchmark sample corresponds to Artificial samples; S202: Add the synthetic samples generated by each benchmark sample to the minority class subset , and mark the updated minority class subset as ; S203, by reducing and The distribution difference between the weight vector Optimize S204, repeating steps S201-S203 until an optimal weight vector is obtained; S205: Generate optimal synthetic samples based on the optimal weight vector according to the artificial samples corresponding to each benchmark sample and each benchmark sample, and add each optimal synthetic sample to the minority class subset. , convert the unbalanced data training set into a balanced data training set.
[0014] Furthermore, in step S203 and The expression for the distribution difference between is:
[0015] in, for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
[0016] Furthermore, the expression of the optimal weight vector in step S204 is:
[0017] in, is the optimal weight vector; To make The value of the weight vector when it is minimum; for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
[0018] Furthermore, the step S4 is specifically as follows: S401, searching for the nearest neighbor sample set of each sample in the test sample set in the balanced data training set; S402, using the trained classifier to classify each sample in each neighbor sample set, to obtain a classification result for each neighbor sample set; S403, calculating the difference between the classification result of each neighbor sample set and the true category of each neighbor sample set:
[0019]
[0020] in, Samples in the test sample set The gap between the classification results of the corresponding neighbor sample set and the true category; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for The classification results; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0; for and distance; is an exponential function with a natural constant as base; For the minority class; For the majority class; S404, using K-means clustering algorithm to cluster the samples in the test sample set Divided into the first cluster and the second cluster; S405, comparing the samples in the first cluster and the second cluster The samples corresponding to the clusters with high values are determined samples, and the samples corresponding to the clusters with low values are uncertain samples, thus obtaining the determined sample set and the uncertain sample set.
[0021] Furthermore, the step S5 is specifically as follows: S501, define the calibration matrix of each sample in the uncertain sample set:
[0022] in, For the Uncertain samples The calibration matrix of For sample Belongs to category The conditional probability depends on the sample being classified according to the result of the classifier. Classification situation; For sample Belongs to category The conditional probability depends on the sample being classified according to the result of the classifier. Classification situation; To identify the framework The number of categories in ; To identify the framework The category number in; S502, using a global objective function to reduce the difference between the predicted classification and the true classification, and obtaining an optimal calibration matrix; S503, using the optimal calibration matrix to calibrate the classification results of the samples in the uncertain sample set, and obtain the calibrated classification probability:
[0023] in, for Belongs to category Possibility of calibration; For the categories; for exist The probability of For the categories; S504: Determine the classification result of the uncertain sample according to the calibrated classification probability.
[0024] Furthermore, the expression of the optimal calibration matrix in step S502 is:
[0025] in, For the Uncertain samples The optimal calibration matrix of To make At minimum, The value of is the global objective function; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0.
[0026] The beneficial effects of the present invention are as follows: since the newly generated samples follow the distribution of the original data, the overfitting of the model to specific samples can be effectively avoided, which helps to improve the performance of the model on unknown data; by minimizing the change in data distribution, it can ensure that the newly generated samples have similar statistical characteristics to the original data, so that the information of the original data can be better preserved; by accurately sampling minority class samples, their distribution information can be captured more accurately, thereby improving the classifier's recognition ability for minority class samples, which is particularly important when dealing with unbalanced data sets; by adjusting samples that are difficult to classify correctly (usually those located near the category boundaries), the classifier can be more stable and reliable in the face of noise or outliers; the neighborhood-based calibration strategy ensures that similar samples obtain similar classification results, thereby improving the consistency of the classifier, which is very important for ensuring the interpretability and credibility of the model; by locally optimizing the classification results of each sample, the performance of the entire classifier is improved, especially when dealing with complex data sets, this method can significantly improve the overall performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0028] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0029] like Figure 1 As shown, in one embodiment of the present invention, a method for imbalanced data classification with optimal oversampling and neighborhood correction includes the following steps: S1. Obtain an unbalanced data set, divide the unbalanced data training set into a minority class subset and a majority class subset, select a benchmark sample in the minority class subset based on the density peak, and use the neighboring samples of the benchmark sample as artificial samples; S2. Generate synthetic samples based on the benchmark samples and artificial samples, and add the synthetic samples to the minority class subset, and obtain a balanced training data set based on the updated minority class subset and majority class subset; S3, training the classifier using the balanced training data set to obtain a trained classifier; S4, obtaining a test sample set, classifying the test sample set using the trained classifier, obtaining a classification result of each sample, and obtaining a determined sample set and an uncertain sample set according to the classification result of each sample; S5. For the uncertain samples in the uncertain sample set, the classification results are calibrated based on the calibration matrix to obtain the calibrated classification probability, and the classification results of the uncertain samples are determined according to the calibrated classification probability.
[0030] In this embodiment, in order to overcome the limitations of the existing oversampling method when processing unbalanced data sets, the present invention proposes an unbalanced data classification method with optimal oversampling and neighborhood correction. The method aims to solve the following technical problems: (1) Optimizing the quality of sample generation: Existing oversampling methods may deviate from the original data distribution when generating synthetic samples, resulting in data distribution distortion, which in turn affects classification accuracy. To this end, this paper defines an optimal oversampling strategy based on data distribution evaluation, which aims to minimize the change in data distribution and guide the oversampling process, thereby improving the quality of synthetic samples.
[0031] (2) Improving the classifier's ability to handle uncertain samples: In the classification process after oversampling, due to the uncertainty of the samples, even the best classifier may not be able to accurately distinguish between samples, especially when dealing with samples whose categories are difficult to determine. The present invention designs a neighborhood-based calibration strategy to quantify the local reliability of the classification results and correct difficult-to-classify samples, so that the global optimal classifier can focus on the local characteristics of each sample and improve the ability to handle uncertain samples.
[0032] The main purpose of this invention is to improve the classification performance when dealing with unbalanced data sets through an optimal oversampling strategy based on data distribution evaluation and a neighborhood-based calibration strategy. By minimizing the change in data distribution, the quality of synthetic samples is improved, and the calibration strategy is used to improve the classifier's ability to handle difficult-to-classify samples, ultimately achieving more accurate and reliable classification results.
[0033] The step S1 is specifically as follows: S101. Obtain an unbalanced data training set and divide the unbalanced data training set into minority class subsets and the majority class subset ; S102. Calculate minority class subsets The local density of each sample in is:
[0034] in, For sample The local density of As a judgment indicator, if ,but ,otherwise, ; For sample With sample distance; For the minority class subset Middle samples; For the minority class subset Middle samples; is the threshold distance; S103. Determine the minority class subset The closest distance between samples in:
[0035] in, For sample The closest distance, indicating that the sample The local density in the minority class subset is greater than the sample The closest distance to other samples of the local density; For sample The local density of is the minimum value; S104, respectively, the minority class subsets The local density of each sample in is multiplied by the nearest distance to obtain the minority class subset The density peak of each sample in:
[0036] in, For sample The density peak value; S105, subset the minority class The samples in the above formula are sorted from large to small based on the density peak value, and the first T samples in the sorting are used as the benchmark samples; S106. For each benchmark sample, Perform K nearest neighbor search in , and use the obtained T×K nearest neighbor samples as artificial samples; the total number of artificial samples T×K is greater than or equal to ; The majority class subset The number of samples; For the minority class subset The number of samples.
[0037] In this embodiment, an optimal oversampling strategy based on distribution evaluation is designed to oversample small class data, generate synthetic samples, obtain a balanced data set, and thus train a basic classifier.
[0038] Get an unbalanced dataset. Assume the test set In the classification framework In, based on Training sets in different attribute spaces Symbol and Represent the minority class and majority class in the training dataset, respectively.
[0039] Density peaks are used to select some representative samples for synthesizing new samples. It is crucial to select several samples as benchmarks for generating new samples, ensuring that these samples are diverse and accurately reflect the data distribution of minority classes. Specifically, the density peaks introduced in the Density Peaks Clustering (DPC) method aim to identify cluster centers that can model and define data distributions of different forms and dimensions, which can effectively characterize the data distribution and are representative. Therefore, density peaks are used to select a set of typical benchmark samples.
[0040] The DPC method states that the benchmark samples are located in areas with high local density and are far away from areas with sparse local density. For , its density peak consists of two key elements: local density and Objects with higher density The distance between First, the local density The method of determining is as follows:
[0041] in, represents the threshold distance, Indicates that the distance is less than The number of objects in the function. is an indicator. If ,but , in other cases, Another metric is The closest distance to other samples with higher density is .
[0042]
[0043] When a sample Has a higher density and greater distance , it can be used as a benchmark sample. For simplicity, a value is defined , ensuring that in this case . Then, according to Samples are selected from high to low as standard benchmarks. Each benchmark sample will be Search among neighbor samples to create artificial samples until the total number of samples created is Equal to the number of synthetic samples to be expanded .symbol Represents the number of reference samples required to create a synthetic sample, that is, the number of neighboring samples used to locate the synthetic sample.
[0044] The step S2 is specifically as follows: S201. Generate a synthetic sample based on the reference sample and the artificial sample corresponding to the reference sample:
[0045] in, For the The first synthetic samples; For the Benchmark samples; For the The weight of the synthetic samples; is a synthesis coefficient with a value range of [0,1]; For the The benchmark sample corresponds to Artificial samples; S202: Add the synthetic samples generated by each benchmark sample to the minority class subset , and mark the updated minority class subset as ; S203, by reducing and The distribution difference between the weight vector Optimize S204, repeating steps S201-S203 until an optimal weight vector is obtained; S205: Generate optimal synthetic samples based on the optimal weight vector according to the artificial samples corresponding to each benchmark sample and each benchmark sample, and add each optimal synthetic sample to the minority class subset. , convert the unbalanced data training set into a balanced data training set.
[0046] In this embodiment, synthetic samples and parameters to be optimized are defined. , you can create With adjacent The concatenated synthetic samples are similar to SMOTE. However, the generated samples are random, which makes the process somewhat unpredictable. The generated errors may change the distribution of the initial data. Therefore, a weight vector is established to influence neighboring elements when creating samples.
[0047] In step S203 and The expression for the distribution difference between is:
[0048] in, for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
[0049] In this embodiment, some synthetic samples are obtained and the minority class modified after oversampling is marked as By reducing the modified minority class With the original minority class The distribution difference between them is used to optimize the vector In this case, the Maximum Mean Difference (MMD) is used to measure the degree of inconsistency in the data distribution.
[0050] The expression of the optimal weight vector in step S204 is:
[0051] in, is the optimal weight vector; To make The value of the weight vector when it is minimum; for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
[0052] In this embodiment, the interior point method is used to solve the standard constrained nonlinear least squares problem, where the iteration termination condition is that the number of iterations reaches 1000.
[0053] In this embodiment, the classification model is trained with the sampled data set and the test samples are divided. After that, synthetic samples are generated. After oversampling, the modified balanced training set is used To train the base classifier to classify the test samples.
[0054] Although the change in data distribution is reduced throughout the oversampling phase, there is still a certain difference in the data distribution before and after oversampling due to the uncertainty of sampling. In this case, some uncertain samples (such as samples in the overlapping area between classes) may pose a challenge to accurate classification, and the following subsections will help adjust the results of these uncertain samples.
[0055] The step S4 is specifically as follows: S401, searching for the nearest neighbor sample set of each sample in the test sample set in the balanced data training set; S402, using the trained classifier to classify each sample in each neighbor sample set, to obtain a classification result for each neighbor sample set; S403, calculating the difference between the classification result of each neighbor sample set and the true category of each neighbor sample set:
[0056]
[0057] in, Samples in the test sample set The gap between the classification results of the corresponding neighbor sample set and the true category; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for The classification results; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0; for and distance; is an exponential function with a natural constant as base; For the minority class; For the majority class; S404, using K-means clustering algorithm to cluster the samples in the test sample set Divided into the first cluster and the second cluster; S405, comparing the samples in the first cluster and the second cluster The samples corresponding to the clusters with high values are determined samples, and the samples corresponding to the clusters with low values are uncertain samples, thus obtaining the determined sample set and the uncertain sample set.
[0058] In this embodiment, a neighborhood-based calibration strategy for uncertain sample classification results is designed. First, local reliability is defined to obtain uncertain samples, and then the classification results are calibrated using neighboring data as complementary information to obtain the final decision.
[0059] Define the local reliability of the test sample classification results and obtain uncertain samples. It has similar data configuration and distribution to its neighboring data, so the test sample is extracted Neighbor data of Used to evaluate algorithm classification results The local reliability of the classifier The efficiency of classification is increased with The reliability of classification increases. Based on the above analysis, the gap between the classification results of the nearest neighbors and the actual situation is calculated:
[0060] in, Representatives are assigned to neighbors Obviously, with and Distance The reduction of weight It will also decrease. Represents the discriminative framework, defined as . express exist The probability in . is a binary vector, representing The truth value of . express The true category of .otherwise, is zero.
[0061] It is important to note that the smaller the difference between the classified result and the true result, the higher the reliability of the classifier. The larger the value of The more reliable the classification result is, the higher the reliability is. Here, the K-means clustering algorithm is used to cluster different Divided into two categories. According to the cluster center, the test samples in one category The lower the value, the higher the reliability of these samples being correctly classified. The values are high, which means they are at a high risk of being misclassified and should be carefully considered as uncertain samples, awaiting further classification.
[0062] The step S5 is specifically as follows: S501, define the calibration matrix of each sample in the uncertain sample set:
[0063] in, For the Uncertain samples The calibration matrix of For sample Belongs to category The conditional probability depends on the sample being classified according to the result of the classifier. Classification situation; For sample Belongs to category The conditional probability depends on the sample being classified according to the result of the classifier. Classification situation; To identify the framework The number of categories in ; To identify the framework The category number in; S502, using a global objective function to reduce the difference between the predicted classification and the true classification, and obtaining an optimal calibration matrix; S503, using the optimal calibration matrix to calibrate the classification results of the samples in the uncertain sample set, and obtain the calibrated classification probability:
[0064] in, for Belongs to category Possibility of calibration; For the categories; for exist The probability of For the categories; S504: Determine the classification result of the uncertain sample according to the calibrated classification probability.
[0065] The expression of the optimal calibration matrix in step S502 is:
[0066] in, For the Uncertain samples The optimal calibration matrix of To make At minimum, The value of is the global objective function; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0.
[0067] In this embodiment, a calibration matrix is defined. Here, according to Nearest neighbor calibration results because they have similar spatial structures. The calibration matrix The definition is as follows:
[0068] in, Represents the judgment box The number of categories in . Representation sample Belongs to category The conditional probability depends on the sample being classified according to the result of the classifier. Classification situation.
[0069] To derive the calibration matrix , which can minimize the difference between the predicted value and the true value. Design a global objective function , which is characterized by:
[0070] in, express Belongs to category The probability of Indicates the number of neighbor data. express The true value of is ,otherwise, The value of is equal to zero. Indicates that the The weight of the nearest neighbor. The smaller the distance to the neighbor, the more accurate the neighbor is in calibration. The greater the role of the , the greater the weight value in this case.
[0071] The calibration matrix is obtained by optimization. It can be obtained by the following formula:
[0072] Here an interior fixed point method is used to solve a nonlinear least squares problem with normal constraints.
[0073] use Calibrated classification results Defined as:
[0074] in, for Belongs to category Then, guided by the calibration results, The category is finally determined.
Claims
1. An optimal oversampling and neighborhood correction imbalanced data classification method, characterized in that: The following steps are involved: S1. Obtain an unbalanced data set, divide the unbalanced data training set into a minority class subset and a majority class subset, select a benchmark sample in the minority class subset based on the density peak, and use the neighboring samples of the benchmark sample as artificial samples; S2. Generate synthetic samples based on the benchmark samples and artificial samples, and add the synthetic samples to the minority class subset, and obtain a balanced training data set based on the updated minority class subset and majority class subset; S3, training the classifier using the balanced training data set to obtain a trained classifier; S4, obtaining a test sample set, classifying the test sample set using the trained classifier, obtaining a classification result of each sample, and obtaining a determined sample set and an uncertain sample set according to the classification result of each sample; S5. For the uncertain samples in the uncertain sample set, the classification results are calibrated based on the calibration matrix to obtain the calibrated classification probability, and the classification results of the uncertain samples are determined according to the calibrated classification probability.
2. The imbalanced data classification method with optimal oversampling and neighborhood correction according to claim 1, characterized in that: The step S1 is specifically as follows: S101. Obtain an unbalanced data training set and divide the unbalanced data training set into minority class subsets and the majority class subset ; S102. Calculate minority class subsets The local density of each sample in is: in, For sample The local density of As a judgment indicator, if ,but ,otherwise, ; For sample With sample distance; For the minority class subset Middle samples; For the minority class subset Middle samples; is the threshold distance; S103. Determine the minority class subset The closest distance between samples in: in, For sample The closest distance, indicating that the sample The local density in the minority class subset is greater than the sample The closest distance to other samples of the local density; For sample The local density of is the minimum value; S104, respectively, the minority class subsets The local density of each sample in is multiplied by the nearest distance to obtain the minority class subset The density peak of each sample in: in, For sample The density peak value; S105, subset the minority class The samples in the above formula are sorted from large to small based on the density peak value, and the first T samples in the sorting are used as the benchmark samples; S106. For each benchmark sample, Perform K nearest neighbor search in , and use the obtained T×K nearest neighbor samples as artificial samples; the total number of artificial samples T×K is greater than or equal to ; The majority class subset The number of samples; For the minority class subset The number of samples.
3. The imbalanced data classification method with optimal oversampling and neighborhood correction according to claim 1, characterized in that: The step S2 is specifically as follows: S201. Generate a synthetic sample based on the reference sample and the artificial sample corresponding to the reference sample: in, For the The first synthetic samples; For the Benchmark samples; For the The weight of the synthetic samples; is a synthesis coefficient with a value range of [0,1]; For the The benchmark sample corresponds to Artificial samples; S202: Add the synthetic samples generated by each benchmark sample to the minority class subset , and mark the updated minority class subset as ; S203, by reducing and The distribution difference between the weight vector Optimize S204, repeating steps S201-S203 until an optimal weight vector is obtained; S205: Generate optimal synthetic samples based on the optimal weight vector according to the artificial samples corresponding to each benchmark sample and each optimal synthetic sample, and add each optimal synthetic sample to the minority class subset. , convert the unbalanced data training set into a balanced data training set.
4. The method for unbalanced data classification with optimal oversampling and neighborhood correction according to claim 3, characterized in that: In step S203 and The expression for the distribution difference between is: in, for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
5. The method for unbalanced data classification with optimal oversampling and neighborhood correction according to claim 3, characterized in that: The expression of the optimal weight vector in step S204 is: in, is the optimal weight vector; To make The value of the weight vector when it is minimum; for and The distribution differences between is the maximum mean difference function; It is the minority class subset in the imbalanced data training set; is the updated minority class subset; for The number of samples; For the general and Mapping functions that map to the same space; For the minority class subset Middle samples; For the minority class subset Middle samples.
6. The imbalanced data classification method with optimal oversampling and neighborhood correction according to claim 1, characterized in that: The step S4 is specifically as follows: S401, searching for the nearest neighbor sample set of each sample in the test sample set in the balanced data training set; S402, using the trained classifier to classify each sample in each neighbor sample set, to obtain a classification result for each neighbor sample set; S403, calculating the difference between the classification result of each neighbor sample set and the true category of each neighbor sample set: in, Samples in the test sample set The gap between the classification results of the corresponding neighbor sample set and the true category; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for The classification results; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0; for and distance; is an exponential function with a natural constant as base; For the minority class; For the majority class; S404, using K-means clustering algorithm to cluster the samples in the test sample set Divided into the first cluster and the second cluster; S405, comparing the samples in the first cluster and the second cluster The samples corresponding to the clusters with high values are determined samples, and the samples corresponding to the clusters with low values are uncertain samples, thus obtaining the determined sample set and the uncertain sample set.
7. The imbalanced data classification method with optimal oversampling and neighborhood correction according to claim 1, characterized in that: The step S5 is specifically as follows: S501, define the calibration matrix of each sample in the uncertain sample set: in, For the Uncertain samples The calibration matrix of For sample Belongs to category The conditional probability depends on the sample Classification situation; For sample Belongs to category The conditional probability depends on the sample Classification situation; To identify the framework The number of categories in ; To identify the framework The category number in; S502, using a global objective function to reduce the difference between the predicted classification and the true classification, and obtaining an optimal calibration matrix; S503, using the optimal calibration matrix to calibrate the classification results of the samples in the uncertain sample set, and obtain the calibrated classification probability: in, for Belongs to category Possibility of calibration; For the categories; for exist The probability of For the categories; S504: Determine the classification result of the uncertain sample according to the calibrated classification probability.
8. The method for unbalanced data classification with optimal oversampling and neighborhood correction according to claim 7, characterized in that: The expression of the optimal calibration matrix in step S502 is: in, For the Uncertain samples The optimal calibration matrix of To make At minimum, The value of is the global objective function; is the total number of samples in the neighbor sample set; is the first Samples The weight of To discriminate the framework; for exist The probability of is a binary function, if for The true category is 1, otherwise it is 0.
Citation Information
Cited By
Student academic early warning prediction method based on feature interaction neural tree
CN119849701A
Neighborhood-aware k-nn graph construction oversampling method for imbalanced multi-classification
CN122796521A
