Hierarchical Bayesian trial and error learning classification method for unbalanced data
By employing a hierarchical Bayesian trial-and-error learning method, features, classifiers, and sampling strategies are selected layer by layer, optimizing the selection process. This addresses the problem of feature and classifier selection in imbalanced data and improves classification accuracy.
Patent Information
- Application Number
- CN202511126097.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-12-19
AI Technical Summary
Existing technologies struggle to select suitable features, classifiers, and sampling strategies when dealing with imbalanced data, resulting in insufficient ability of the model to identify minority classes and affecting classification accuracy.
A hierarchical Bayesian trial-and-error learning method is adopted. A Beta distribution is constructed through Bayesian inference, and features, classifiers and sampling strategies are selected layer by layer. Combined with exploration strategies and weighted evaluation indicators, the selection actions are optimized and the rewards are updated to select the optimal configuration.
It effectively improved the classification accuracy of minority classes and significantly enhanced the performance of the evaluation metrics BACC, MAUC, and G-means.
Smart Images

Figure CN121167461A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning and data mining technology, specifically to a hierarchical Bayesian trial-and-error learning classification method for imbalanced data. Background Technology
[0002] In practical applications of machine learning and data mining, class imbalance refers to a situation where the number of samples from certain classes is significantly less than that of other classes, causing the model to favor the majority class during the learning process and reducing its ability to identify the minority class. This imbalance in data distribution can severely impact model performance and generalization. Accurate identification of minority class samples is particularly crucial in critical tasks such as financial fraud detection, early disease diagnosis, and industrial fault identification.
[0003] For classifying imbalanced data, current research methods can be broadly categorized into two types: data-level methods and algorithm-level methods. Data-level methods primarily alleviate imbalance by altering the proportion of samples from each class in the training set, mainly including undersampling and oversampling. Oversampling increases the number of minority class samples by duplicating or generating them, while undersampling achieves class balance by reducing the number of majority class samples. However, oversampling methods may lead to the model overfitting to the minority class samples, especially when the generated samples lack diversity; while undersampling may result in information loss due to discarding a large number of majority class samples, thus affecting the overall performance of the model.
[0004] Algorithm-level approaches focus on optimizing the learning strategies of existing machine learning algorithms. For example, they might assign different loss weights to different classes or optimize features to make the model pay more attention to the minority class during training; or they might employ ensemble learning strategies to integrate multiple base classifiers to improve the model's ability to identify the minority class. While these methods can mitigate the impact of class imbalance to some extent, they lack a universal framework for selecting features, sampling strategies, and classifiers suitable for the current classification task. Summary of the Invention
[0005] The purpose of this invention is to provide a hierarchical Bayesian trial-and-error learning classification method for imbalanced data. It aims to improve classification accuracy by selecting the optimal features, classifier, and sampling strategy and applying them to the classification task, thereby adaptively selecting the optimal configuration based on the current data and task.
[0006] To achieve the above objectives, this invention provides a hierarchical Bayesian trial-and-error learning classification method for imbalanced data, comprising the following steps:
[0007] Step 1: Establish a hierarchical Bayesian trial-and-error learning model;
[0008] Step 2: Based on the established model, hierarchically select actions collaboratively;
[0009] Step 3: Introduce diverse action choices through exploration strategies;
[0010] Step 4: Calculate the reward based on the selected action, and update the success and failure counts of the selected action based on the reward;
[0011] Step 5: Apply the optimal action to the imbalanced classification task.
[0012] Optionally, during the modeling process in step 1, the set of features, classifiers, and samplers is taken as the state. The agent makes selection actions layer by layer according to the state. After each layer is selected, the reward for the selection action is calculated, and the success and failure counts of the corresponding action are updated according to the reward. That is, the Beta distribution constructed by Bayesian inference at each layer is updated. Then, the combination of selections is explored in a variety of ways to select the optimal selection configuration.
[0013] Optionally, the execution process of step 2 includes the following steps:
[0014] Step 2.1: Establish a Beta distribution for each layer and ensure that the action of the current layer is influenced by the state of the previous layer;
[0015] Step 2.2: First, perform feature selection and pass the result of feature selection to the classifier selection of the next layer; after completing the classifier selection, select the corresponding sampling strategy based on the selected features and classifier;
[0016] Step 2.3: Calculate the reward for the selected configuration and provide feedback for the subsequent learning process.
[0017] Optionally, in step 3, an exploration strategy is introduced to diversify the selection of actions. There are two methods for selecting actions:
[0018] Randomly select an action;
[0019] Based on the scores from the Beta distribution in Bayesian inference, the action with the highest score is selected. The score is calculated using the following formula:
[0020]
[0021] To select the number of times the action was successful, This represents the number of failures.
[0022] Optionally, in step 4, a weighted evaluation metric is used to measure the reward value of the action;
[0023] Step 4.1: Calculate the weight corresponding to each evaluation indicator based on the current data distribution;
[0024] The weights of BACC are adjusted based on the imbalance rate of the data, and the calculation formula is as follows:
[0025]
[0026] in, The function maps the result to The interval, IR, represents the imbalance rate, which can be calculated by dividing the number of samples in the most frequent class by the number of samples in the least frequent class.
[0027] G-mean is positively correlated with category entropy, which is expressed as follows:
[0028]
[0029] Where H represents category entropy, and c is the number of categories. It is the probability of the k-th class, calculated by dividing the number of samples in the k-th class by the total number of samples;
[0030] The formula for calculating the G-mean weights is as follows:
[0031]
[0032] The MAUC weights are adjusted based on the MAUC weights, and the calculation formula is as follows:
[0033]
[0034] Step 4.2: Normalize all weights by dividing each weight by the sum of all weights to ensure that the sum of weights is 1;
[0035] Step 4.3: Calculate the evaluation metric using the selected features, classifier, and sampling strategy, and then calculate the reward by multiplying the weights by the corresponding evaluation metric.
[0036] Optionally, in step 5, the reward is calculated based on the configuration selected for each decision, and the configuration with the highest reward is updated and retained, and finally the configuration is applied to the test data.
[0037] This invention provides a hierarchical Bayesian trial-and-error learning classification method for imbalanced data. First, a hierarchical Bayesian trial-and-error learning classification model is constructed, in which the agent makes corresponding choices layer by layer based on the input state, calculates rewards based on the chosen actions, and optimizes the choices through continuous trial and error learning to obtain the optimal configuration. Second, each layer's selection is constructed using a Beta distribution based on Bayesian inference to achieve hierarchical and collaborative selection of features, classifiers, and sampling strategies, and a reward update strategy is designed using a weighted evaluation index. Furthermore, an exploration strategy is introduced to randomly select actions or select the action with the highest score to diversify the selection configuration. Finally, the selection configuration with the highest reward is applied to the current classification task. Compared with most existing imbalanced data classification methods based on data and algorithm levels, this invention can select features, classifiers, and sampling strategies suitable for the current task and effectively improve the classification accuracy of the minority class. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a schematic diagram illustrating the process principle of a hierarchical Bayesian trial-and-error learning classification method for imbalanced data according to the present invention.
[0040] Figure 2 This is a schematic diagram of the hierarchical Bayesian trial-and-error learning model structure of the hierarchical Bayesian trial-and-error learning classification method for imbalanced data according to the present invention.
[0041] Figure 3 This is a schematic diagram illustrating the balanced accuracy results of a specific embodiment of the present invention on a structured dataset compared to other baseline methods.
[0042] Figure 4 This is a schematic diagram of the area under the curve (AUC) results for multiple classes on a structured dataset compared with other baseline methods, based on a specific embodiment of the present invention.
[0043] Figure 5 This is a schematic diagram of the geometric mean results of a specific embodiment of the present invention compared with other baseline methods on a structured dataset. Detailed Implementation
[0044] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0045] This invention provides a hierarchical Bayesian trial-and-error learning classification method for imbalanced data, comprising the following steps:
[0046] Step 1: Establish a hierarchical Bayesian trial-and-error learning model;
[0047] Step 2: Based on the established model, hierarchically select actions collaboratively;
[0048] Step 3: Introduce diverse action choices through exploration strategies;
[0049] Step 4: Calculate the reward based on the selected action, and update the success and failure counts of the selected action based on the reward;
[0050] Step 5: Apply the optimal action to the imbalanced classification task.
[0051] The specific execution process is as follows: Figure 1 As shown, the following provides further explanation in conjunction with the implementation steps:
[0052] Step 1: Establish a hierarchical Bayesian trial-and-error learning model, such as Figure 2 As shown:
[0053] The model consists of the following parts:
[0054] State: refers to the candidate set of features, classifiers, and sampling strategies;
[0055] The feature candidate set includes features corresponding to the Wine, Blobs, Isolet, and Yeast datasets;
[0056] The classifier candidate set includes Support Vector Machine (SVM), Random Forest (RF), Linear Regression (LR), Multilayer Perceptron (MLP), LightGBM (LGBM), K Nearest Neighbor (KNN) and Adaptive Boosting (Adaboost).
[0057] The candidate set of sampling strategies includes oversampling and undersampling methods;
[0058] Hierarchical structure: Each layer is constructed using a Beta distribution inferred from Bayesian inference, which includes the number of successful and unsuccessful action selections;
[0059] Action: refers to the set of all possible actions that an agent can choose in a given state;
[0060] Reward: Measures the outcome of the chosen action;
[0061] Step 2: Based on the established model, hierarchically select actions collaboratively;
[0062] Step 2 includes the following processes:
[0063] First, by establishing a Beta distribution for each layer using Bayesian inference, we ensure that the actions of the current layer are influenced by the state of the previous layer.
[0064] Secondly, the selection is carried out layer by layer according to features, classifiers, and sampling strategies. The current layer makes decisions based on the input of the previous layer, thereby cooperating and selecting configurations layer by layer.
[0065] Finally, the reward for the selected configuration (features, classifier, and sampling strategy) is calculated, and the selection strategy is updated based on the reward.
[0066] Step 3: Introduce diverse action choices through exploration strategies;
[0067] Specifically: First, initialize the exploration rate and decay factor;
[0068] Secondly, a random number is generated and compared with the current exploration rate. If the exploration rate is higher than the current number, an action is randomly selected to diversify the configuration; if the exploration rate is lower than the current number, the action with the highest score is selected based on the Beta distribution score in Bayesian inference. The score is calculated as the ratio of the number of successful action selections to the total number of successful and failed action selections.
[0069] Finally, the exploration rate is updated by a decay factor to achieve diversified exploration strategies in the early stage, and the learned selection strategies are gradually utilized in the later stage.
[0070] Step 4: Calculate the reward based on the selected action, and update the success and failure counts of the selected action based on the reward;
[0071] Step 4 includes the following processes:
[0072] First, calculate the weights of the evaluation metrics BACC, G-mean, and MAUC based on the current data distribution;
[0073] Secondly, normalize the ownership to ensure that the total weight is 1;
[0074] Finally, the reward is calculated using a weighted evaluation metric based on the selected features, classifier, and sampling strategy. The reward calculation is as follows:
[0075] Step 5: Apply the optimal selection actions (features, classifier, sampling strategy) to the imbalanced classification task.
[0076] First, filter the features in the dataset and retain the selected features;
[0077] Then, the feature data is resampled using the selected sampling strategy;
[0078] Finally, the resampled data is classified using the selected classifier.
[0079] The following description, in conjunction with specific embodiments, compares the methods with other baseline methods:
[0080] Please see Figure 3 and Figure 4 and Figure 5 In specific embodiments, this invention compares different datasets with existing baseline methods (FEHC, MFLS, DES, SPE, and MDO). The following is a schematic diagram showing the comparison results of datasets such as Wine with other baseline methods:
[0081] Figure 3 This is a schematic diagram of the BACC results in a specific embodiment of the present invention on datasets such as Wine, compared with other baseline methods.
[0082] Figure 4 This is a schematic diagram of the MAUC results of a specific embodiment of the present invention on datasets such as Wine, compared with other baseline methods.
[0083] Figure 5 This is a schematic diagram illustrating the results of G-means in a specific embodiment of the present invention on datasets such as Wine, compared with other baseline methods.
[0084] Therefore, the figure shows that the proposed method can select the optimal features, classifiers, and sampling strategies to solve the imbalanced classification problem under different datasets, and has significant improvements in the evaluation metrics of BACC, MAUC, and G-means.
[0085] In summary, this invention effectively selects features, classifiers, and sampling strategies for use in classification tasks. Compared with most existing imbalanced data classification methods based on data level and algorithm level, this invention can effectively improve the classification accuracy of minority classes.
[0086] The above description discloses only one or more preferred embodiments of the present invention, and should not be construed as limiting the scope of the present invention. Those skilled in the art will understand that all or part of the processes of the above embodiments can be implemented, and equivalent changes made in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A hierarchical Bayesian trial-and-error learning classification method for unbalanced data, characterized by, It comprises the following steps: Step 1: Establish a hierarchical Bayesian trial and error learning model; Step 2: Hierarchical and collaborative selection of actions according to the established model; Step 3: Introduce exploration strategy to diversify the selection of actions; Step 4: Calculate the reward according to the selected action, and update the success and failure times of the selected action according to the reward; Step 5: Apply the optimal selection action to the unbalanced classification task.
2. The hierarchical Bayesian trial and error learning classification method for unbalanced data according to claim 1, wherein During the modeling process of step 1, the features, classifiers, and samplers are collected as states, and the agent makes selection actions according to the states layer by layer. After completing the selection of each layer, the reward of the selection action is calculated, and the success and failure times of the corresponding action of the selection configuration are updated according to the reward, that is, the Beta distribution constructed by Bayesian inference is updated, and then the combination of the exploration selection is continued to be diversified, so as to select the optimal selection configuration.
3. The hierarchical Bayesian trial and error learning classification method for unbalanced data according to claim 2, wherein The execution process of step 2 comprises the following steps: Step 2.1: Establish a Beta distribution for each layer, and ensure that the action of the current layer is affected by the state of the previous layer; Step 2.2: First, select the features, and pass the results of the feature selection to the classifier selection of the next layer; after completing the classifier selection, select the corresponding sampling strategy according to the selected features and classifiers; Step 2.3: Calculate the reward of the selected configuration and provide feedback information for the subsequent learning process.
4. The hierarchical Bayesian trial and error learning classification method for unbalanced data according to claim 3, wherein In step 3, an exploration strategy is introduced to diversify the selection of actions. There are two ways to select actions: Randomly select an action; According to the score of the Beta distribution in Bayesian inference, select the action with the highest score. The calculation formula of the score is as follows: ; for the number of successes of the selected action, for the number of failures.
5. The hierarchical Bayesian trial and error learning classification method for unbalanced data according to claim 4, wherein In step 4, the reward value of the action is measured by a weighted evaluation index; Step 4.1: Calculate the weight of each evaluation index according to the current data distribution; The weight of BACC is adjusted according to the imbalance rate of the data, and the calculation formula is as follows: ; wherein, The function maps the result in The interval, IR, represents the imbalance rate, which is calculated by dividing the number of samples in the largest class by the number of samples in the smallest class. G-mean is positively correlated with class entropy, and the expression of class entropy is as follows: ; where H denotes the class entropy, c is the number of classes, is the probability of the kth class, calculated as the number of samples of the kth class divided by the total number of samples. The calculation formula of G-mean weight is as follows: ; The weight of MAUC is adjusted according to the weight of MAUC, and the calculation formula is as follows: ; Step 4.2: Normalize all weights by dividing each weight by the sum of all weights to ensure that the sum of weights is 1; Step 4.3: Calculate the evaluation index through the selected features, classifiers, and sampling strategies, and then calculate the reward by multiplying the weight and the corresponding evaluation index.
6. The hierarchical Bayesian trial and error learning classification method for unbalanced data according to claim 5, wherein In step 5, the reward is calculated through the configuration selected by each decision, and the configuration with the maximum reward is updated and retained, and finally the configuration is applied to the test data.