# Increasing Minority Recall Support Vector Machine Model for Imbalanced Data Classification

Authors: Chunye Wu; Nan Wang; Yu Wang
Journal: Discrete Dynamics in Nature and Society
 (2021)

---

## Abstract

Imbalanced data classification is gaining importance in data mining and machine learning. The minority class recall rate requires special treatment in fields such as medical diagnosis, information security, industry, and computer vision. This paper proposes a new strategy and algorithm based on a cost-sensitive support vector machine to improve the minority class recall rate to 1 because the misclassification of even a few samples can cause serious losses in some physical problems. In the proposed method, the modification employs a margin compensation to make the margin lopsided, enabling decision boundary drift. When the boundary reaches a certain position, the minority class samples will be more generalized to achieve the requirement of a recall rate of 1. In the experiments, the effects of different parameters on the performance of the algorithm were analyzed, and the optimal parameters for a recall rate of 1 were determined. The experimental results reveal that, for the imbalanced data classification problem, the traditional definite cost classification scheme and the models classified using the area under the receiver operating characteristic curve criterion rarely produce results such as a recall rate of 1. The new strategy can yield a minority recall of 1 for imbalanced data as the loss of the majority class is acceptable; moreover, it improves theg-means index. The proposed algorithm provides superior performance in minority recall compared to the conventional methods. The proposed method has important practical significance in credit card fraud, medical diagnosis, and other areas.


---

## Body

## 1. Introduction

Imbalanced data classification is gaining importance in data mining and machine learning [1–3]. An imbalance in a particular dataset occurs when the number of instances in one class (the minority class) is significantly smaller than that in the other class (the majority class). The minority class is generally of interest in data classification; hence, it is considered a positive (+) class, whereas the majority class is considered a negative (−) class [4, 5]. For instance, in the medical field, as there is more interest in the disease samples than in the health samples, the disease samples comprise the minority class. Traditional machine learning models mainly consider the accuracy of the two categories as equally important, i.e., they do not consider the accuracy of some categories to be more important than that of other categories, particularly when the sample size of the minority category is small [6, 7]. Although these models have been successfully applied to various balanced data classification problems, their performance decreases substantially when applied to imbalanced datasets [8–10] owing to the lack of sufficient training data in the positive class, which are required to perform an accurate classification of its instances. To address this issue, the positive class of a dataset has attracted increased attention [11], and traditional classifiers have undergone numerous improvements in order to be able to handle imbalanced data applications.In certain applications, the tolerance to errors in the positive class is extremely low. For instance, in the case of industrial system fault diagnosis [12], the classifier must deal with an imbalanced dataset, i.e., the number of available healthy class instances outnumbers the faulty class ones. Accordingly, it is necessary to develop a classifier that accounts for this type of imbalanced data distribution and warns of all possible failures, even if there may be many false-warning occurrences. Credit card fraud detection is a well-known classification problem [13]. In order to target a specific customer segment, banks use data mining algorithms to classify customers as buyers and nonbuyers. In this context, if a model correctly detects a potential customer for a campaign, there will be a particular profit related to gaining that customer; if a potential buyer is not identified, the profits that would be gained from him/her might be lost. However, if a potential nonbuyer is identified as a buyer, credit card fraud would occur, causing the bank potential massive losses. Similarly, a 100% recall model reduces some of the profits but does not risk credit card fraud occurrences. Furthermore, failing to diagnose a cancerous lesion is unacceptable and can have devastating effects on a patient, although this situation rarely occurs [14]. In general, the classifier is only used as an aid to manual diagnosis, which means that the classifier can only diagnose patients at risk of cancer and provide an artificial judgment. There are disastrous consequences if the classifier misses any patient who may have cancer. In this study, we developed a cost-sensitive support vector machine (SVM) model to increase the recall of a positive sample from an actual background to 100%. Based on this model, we proposed a medium algorithm strategy to increase the positive-class recall rate to 1. We introduced different penalty factors, namely, C+ and C−, for each of the positive and negative SVM slack variables during the training process and adjusted the classification boundary by altering the positive-class margin. This approach ensured that the positive-class samples would be more generalized to achieve the target recall rate of 1 when the boundary reached a certain position. For parameter selection, we employed the grid search approach and selected a model with a recall of 100% and a higher specificity for the negative class. The SVM model was adopted to address the data imbalance and exhibited an acceptable performance [15–21].Our study makes a significant contribution to the field because we were able to confirm that (1) increasing the recall rate to 100% is a feasible classification indicator; (2) the decision boundary could be altered successfully by correcting the positive margin; and (3) theg-means increases when the recall rate is increased to 1 in some datasets. The experimental results demonstrated that these advantages improve the positive-class classification performance to a greater extent than those achieved in previous studies.The remainder of this paper is organized as follows. In Section2, the cost-sensitive SVM model is briefly reviewed. In Section 3, the proposed cost-sensitive model is introduced to improve the recall rate of the positive classes. Section 4 describes the tests performed using the new method on actual data. Finally, Section 5 discusses and summarizes the advantages and disadvantages of the proposed method and suggests future research directions.


## 2. Related Work

In this section, we will briefly discuss different imbalanced dataset classification problems. The existing classification methods for imbalanced data can be roughly divided into two categories [22, 23]: data-level and algorithm-level methods [24–27]. We will first discuss the most effective approaches and then discuss the advantages and limitation of these proposed approaches.Data-level approaches, which are also known as sampling methods [28], typically involve data preprocessing. These approaches rebalance highly skewed class distributions using various resampling methods, such as oversampling of the positive instances and undersampling of the negative instances, and at times, both methods are combined as well [29]. The simplest way to balance a dataset is by undersampling (randomly or selectively) the majority class, while keeping the original data of the minority class. However, this method results in loss of information of the majority class [30]. Another approach that can be used is oversampling in which the minority class instances are randomly duplicated to rebalance class distribution. Although oversampling does not result in loss of information of the majority class, it can cause overfitting. To solve this issue, Chawla et al. [31] proposed a method called Synthetic Minority Oversampling Technique (SMOTE) to generate new instances by linear interpolation between closely lying minority class samples. SMOTE generates new minority samples by interpolating between k-nearest minority class neighbors and has a better classification effect than random oversampling. However, the samples generated through this method may cause an overlap between the two categories.In contrast, using algorithm-level approaches [32, 33], researchers have been able to introduce cost-sensitive learning to reduce the degree of imbalance by assigning a higher learning cost to positive-class samples [34–36]. Algorithm-level approaches directly modify the learning procedure to improve the sensitivity of the classifier toward minority classes. One such crucial approach to class-imbalanced learning was proposed by Veropoulos et al. [37], who used different penalty constants for different classes to assign higher costs to errors in classifying positive-class instances than those in classifying negative-class instances. However, this method does not consider the distance between the two types of samples and the classification hyperplane.Some studies successfully applied the aforementioned methods in several different fields such as cancer diagnosis [38], sentiment analysis, and text classification [39]. In this study, we improved Veropoulos’s method, modified the distance between the positive samples and the classification hyperplane, and developed an SVM classification algorithm with special classification purposes.


## 3. Cost-Sensitive Support Vector Machine

The goal of classification is to map feature vectorsx ∈ X to class labels Y=−1,1 [40]. As in previous studies [41, 42], a training set x1,y1,x2,y2,…,xN,yN is given, where xi is an instance with an n-tuple of attribute values that belong to a certain instance space X and yi∈Y=−1,1 is a label.A standard classification problem of a linear SVM can be expressed as(1)argminw,ξ12w2+C∑i=1Nξi,subject to(2)yiwt⋅x+b≥1−ξi,ξi≥0,i=1,2,…,N,where C > 0 is the penalty parameter.The standard SVM model for the design of classification algorithms minimizes the probability of error, assuming that all misclassifications have the same cost. To control the classification recall, the penalty-regularized model proposed by Veropoulos et al. [37] was closely inspected. The key idea of this model is to introduce uneven loss functions to reweight the penalties of the samples in the imbalanced classes [7] and reduce the bias of the classification boundary toward the negative class. By predetermining the class labels,(3)I+=i|yi=+1,i=1,2,…,N,I−=i|yi=−1,i=1,2,…,N,where I+ and I− denote the index set for the positive and negative classes, respectively. When I+ and I− are categorized, different costs are assigned to the two classes. The standard SVM can be expanded to(4)argminw,b,ξ12w2+C+∑i∈I+ξi+C−∑i∈I−ξi,subject to(5)yiwt⋅x+b≥1−ξi,ξi≥0,I=1,2,…,N,where C+ is the cost of a false negative and C− is the cost of a false positive. ξi are slack variables.In the regularization model proposed by Veropoulos et al. [37], the weight vector, w, is a d-dimensional transposed vector normal to the decision boundary; the bias, b, is a scalar for offsetting the decision boundary; and the slack variables, ξi, measuring the losses are used to urge samples to satisfy the boundary constraints in the optimization. Thus, the cost value for the positive class is typically higher than that for the negative class. The dual problem of the primal model is written using Lagrange multipliers as follows:(6)argmaxα∑iαi−12∑i∑jαiαjyiyjkxi,xj,subject to(7)∑αi+=∑αi−,0≤αi+≤C+,0≤αi−≤C−.


## 4. Increasing Minority Recall Model

The key objective of this study was to identify a misclassification cost value with a special purpose using a specific method, assuming that the costs of all types of misclassifications are not equal and that the true costs of misclassification cannot be determined. The goals are to increase the recall rate of the positive class of all datasets to 100% for physical problems and to improve the accuracy of the negative class as much as possible. When positive recall is increased to 1, the accuracy of the negative class may be affected but does not decrease significantly and is within an acceptable range.


### 4.1. Strategies to Improve Recall Rates for Minority Samples

Presently, in cost-sensitive learning, the cost-sensitive factor is often determined by a random interval or by using the sample number ratio between categories as the misclassification cost [43]. However, we developed a class of imbalanced datasets whose data structure enables us to search for misclassification costs with a “special purpose,” which is increasing the positive recall rate to 1 because misclassification of positive samples can cause massive losses in physical problems. Modifying the loss function forces the classification algorithms to be biased toward the positive classes, and the classification boundary leans toward the negative class. The key idea is to adjust the margin of the positive class to cause the classification boundary to shift. Because the theoretical threshold of 0 is used as the judgment threshold of the sign function, as long as the 0 point is on the left side of the classification boundary, as many positive classes as possible will be included. Using the grid search method, the theoretical threshold and classification boundary are adjusted, resulting in a recall rate of 1.When the data distribution is as shown in Figure1, the use of this method will be limited because there is too much overlap between classes. The interface adjusted by us can classify positive-class samples in the imbalanced dataset not only correctly but also simultaneously. In addition, it can divide the samples of the negative classes in the overlapping area into samples of positive classes.Figure 1
Limitations of the data distributions of various methods.


### 4.2. Proposed Support Vector Machine Model

The SVM uses minimization hinge loss functionLyf=1−yf+, where x+=xx>00x≤0.Veropoulos et al. [37] extended the loss function in the biased support vector machine (B-SVM) classification as follows:(8)L+yf=C+1−yf+,(9)L−yf=C−1−yf+.Equations8 and (9) assign different cost values to instances in the positive and negative classes, respectively. The misclassification costs from samples in the negative class are generally exploited to outweigh those in the positive class. As our objective was to increase the recall rate of the positive-class samples to 1, we put a constraint on the positive-class margin and extended the loss function as follows:(10)L+yf=C+1−kyf+,(11)L−yf=C−1−yf+.In Figure2, C+·controls the slope of the positive class, k controls the intersection of the abscissa axis, and the intersection is 1/k. C− controls the negative slope, and the intersection is 1. If the loss is 0, the classification confidence of the loss function must be sufficiently high. For the positive class, the loss is 0 when the degree of confidence is greater than 1/k.Figure 2
Loss function.
(a)(b)By replacing the original loss with the loss functions shown in (10) and (11), the original SVM can be extended to(12)argminw,b,ξ12w2+kC+∑i∈I+ξi+C−∑i∈I−ξi,subject to(13)yiwt⋅xi+b≥1k−ξi+,i∈I+,yiwt⋅xi+b≥1−ξi−,i∈I−,ξi≥0,i=1,2,…,N.Here,C+ and C− are two types of costs, and the positive margin can be changed by adjusting the value of k. In addition to the adjustable penalty, the motivation of this study is to provide the loss function of the imbalanced classes a different hinge point. A biased decision boundary caused by imbalanced classes can be recovered with the help of a scalable margin. Herein, we develop the cost-sensitive model for solving the SVM class-imbalanced problem that has both an adjustable penalty and a scalable margin.To solve the newly created problem, the Lagrangian function is introduced. The dual problem of the primal model can be written using Lagrange multipliers as follows:(14)L=12w2+kC+∑i∈I+ξi+C−∑i∈I−ξi−∑i∈I+αiyiwt⋅xi+b−1k+ξi−∑i∈I+ξiμi−∑i∈I−αiyiwt⋅xi+b−1+ξi−∑i∈I−ξiμi,where αi ≥ 0 and μi ≥ 0.(15)∂L∂w⟹w=∑iαiyixi,∂L∂b⟹∑Iαiyi=0,∂L∂ξi⟹kC+−αi−μi=0,i∈I+⟹0≤αi≤kC+,C−−αi−μi=0,i∈I−⟹0≤αi≤C−.Therefore, the dual optimization model of (12) is defined as(16)argmaxα−12∑i∑jαiαjyiyjKxi,xj+∑iαiyi+12k−yi−12,subject to(17)∑αi+=∑αi−,(18)0≤αi≤kC+,i∈I+,(19)0≤αi≤C−,i∈I−.Our objective is to solve the dual problem (Algorithm1).Algorithm 1: Algorithm to increase the recall rate to 1.
Algorithm:Positive margin adjustment using SVM.Given: a sequence of N examples XTrain and XValidationOutput:G #Output combination classifierVariables:α #Karush–Kuhn–Tucker conditions (KKT) initial alphaρ #G-means valueCp, Cn, k #Positive cost, Negative cost, Positive margin calibration variableT #the selected running iterationsFunction:S #classifier modelR∗G-means (G) #Obtain the Recall ∗G-means values from GBeginInitializeα0 = 0ρ0 = 0T = 1Set the 3D grid search range ofCp, Cn, k:(a)
Select optimization variablesα1n and α2n and solve the optimization problem using the sequential minimal optimization (SMO) algorithm to obtain α1n+1 and α2n+1, and update α to α1n+1.(b)
If the KKT conditions in (16)–(19) are satisfied within the allowable range of precision, ε, the KKT condition can be used for the next step; otherwise, continue with process (b).(c)
Getα∗=αn+1.(d)
Finally,α∗=α1∗,α2∗,…,αN∗T is obtained, and w∗ and b∗ are calculated as follows:w∗=∑i=1Nαi∗yixi,b∗=yj−∑i=1Nαi∗yixi,xj.nstruct a classifier modelS = S=w∗x+b(e)
G = sign (S)(f)
ρn=R∗G-means (G(XValidation)) at a condition recall of 1(g)
Ifρn>ρbest, then ρbest=ρnReturnGtEnd


### 4.3. Experiment

#### 4.3.1. Performance Evaluation

In a classification problem, evaluation measures play a key role in assessing the performance of the classification model. The overall prediction accuracy is used to evaluate the classification of a balanced dataset; however, it is not an effective metric for an imbalanced dataset because it does not consider the prediction accuracy of either class. This lack of consideration is mainly due to the fact that the negative sample size is sometimes much larger than the positive sample size. In such cases, with an imbalance of 99 to 1, a classifier that classifies everything as negative will be 99% accurate, but it will be completely useless as a classifier. Therefore, more attention should be paid to the positive class. The current classification indicators are based on the confusion matrix presented in Table1.Table 1
Confusion matrix.
Predicted as the positive classPredicted as the negative classTrue positive classTPFNTrue negative classFPTNIn the confusion matrix, true positive (TP) is the number of positive-class instances that have been correctly classified, true negative (TN) is the number of negative-class instances that have been correctly classified, false positive (FP) is the number of negative instances that have been incorrectly classified as positive, and false negative (FN) is the number of positive instances that have been incorrectly classified as negative.To select the classification index of the positive class, we directly selected the recall (recall = TP/(TP + FN)) and specificity (specificity = TN/(TN + FP)), ensuring both a recall rate of 1 and high specificity.To balance the effects of recall and specificity on the classification results, an evaluation index,g-means, can be constructed using the geometric mean of equilibrium recall and specificity:(20)g−means=recall∗specificity.Although the number of positive samples may be very few, the omission and misjudgment of positive samples will be considered sufficient. Even if the classification accuracy rates for all the samples are excellent, theg-means value may be very low. The g-means indicator is effective for the classification evaluation of imbalanced data; however, it attaches equal importance to recall and specificity. As more attention was paid to recall in the present study, g-means was extended to recall ∗g-means, which increases the emphasis on recall. Ultimately, the proposed method performed the best with more emphasis on recall.


#### 4.3.2. Experiments

We used ten class-imbalanced datasets with various positive ratios and compared our algorithm with the B-SVM [37], cost-sensitive support vector machine (CS-SVM) [44], and BP neural network algorithms [45], as well as two special classification costs. These experiments proved that it is feasible to adjust the positive-class margin to achieve a positive recall rate of 1.


#### 4.3.3. Open Dataset

As shown in Table2, we compared the classification differences between the proposed method and other methods under different classification standards. We selected ten real-world imbalanced datasets from the UCI machine learning data repository [46]. Among them, ecoli1, ecoli2, glass6, car1v3, car1v4, glass5, segment1, and glass6 were constructed using a multiclassification problem.Table 2
Descriptions of the experimental datasets.
NameExampleDimensionRate of imbalanceNo. of classesBreast cancer o699101.92Breast cancer d569321.9332Ecoli133673.362Ecoli233675.462Glass621496.382Car1v31279617.542Car1v41275618.622Glass5214922.782Yeast51484832.732Segment123101962


#### 4.3.4. Experimental Design

We compared the proposed method with several SVM-based methods and neural network, including the B-SVM, CS-SVM, and BP approaches, as well as two special classification costs (no cost and prorated cost). For the prorated cost, we set the misclassification cost based on the following equation:(21)misclassificationcostpositiveclassmisclassificationcostnegativeclass=total number of negative instancestotal number of positive instances.The RBF Gaussian kernelKx,z=exp−x−z2/2σ2 is used for all SVM algorithms, where σ is the bandwidth parameter that must be predetermined. We attempted to select the best σ value through a grid search of the σ range between 0.01 and 20. For different datasets, while searching for parameters such as C and k, different grid widths were selected to accelerate parameter selection. For both positive and negative class costs, the range of [0.01, 100] was selected, and the search range of K was fixed at [0.01, 10]. Logistic was selected as the activation function. The learning rate was selected within the range of [0.000001, 1], the number of hidden layers was selected from [1–3], and the search range of the number of neurons in each hidden layer was [2, 1000]. Five-fold cross-validation was used in each set of parameter experiments to determine the set of parameters with the best generalization performance. We chose the recall, specificity, g-means, and area under the receiver operating characteristic curve (AuROC) instead of global evaluation indicators to evaluate the performance of the classification method for imbalanced datasets. No cost and prorated cost were classified using a judgment threshold of 0, whereas the B-SVM, CS-SVM, and BP approaches used AuROC as the classification standard for the recall, specificity, and g-means.


## 4.1. Strategies to Improve Recall Rates for Minority Samples

Presently, in cost-sensitive learning, the cost-sensitive factor is often determined by a random interval or by using the sample number ratio between categories as the misclassification cost [43]. However, we developed a class of imbalanced datasets whose data structure enables us to search for misclassification costs with a “special purpose,” which is increasing the positive recall rate to 1 because misclassification of positive samples can cause massive losses in physical problems. Modifying the loss function forces the classification algorithms to be biased toward the positive classes, and the classification boundary leans toward the negative class. The key idea is to adjust the margin of the positive class to cause the classification boundary to shift. Because the theoretical threshold of 0 is used as the judgment threshold of the sign function, as long as the 0 point is on the left side of the classification boundary, as many positive classes as possible will be included. Using the grid search method, the theoretical threshold and classification boundary are adjusted, resulting in a recall rate of 1.When the data distribution is as shown in Figure1, the use of this method will be limited because there is too much overlap between classes. The interface adjusted by us can classify positive-class samples in the imbalanced dataset not only correctly but also simultaneously. In addition, it can divide the samples of the negative classes in the overlapping area into samples of positive classes.Figure 1
Limitations of the data distributions of various methods.


## 4.2. Proposed Support Vector Machine Model

The SVM uses minimization hinge loss functionLyf=1−yf+, where x+=xx>00x≤0.Veropoulos et al. [37] extended the loss function in the biased support vector machine (B-SVM) classification as follows:(8)L+yf=C+1−yf+,(9)L−yf=C−1−yf+.Equations8 and (9) assign different cost values to instances in the positive and negative classes, respectively. The misclassification costs from samples in the negative class are generally exploited to outweigh those in the positive class. As our objective was to increase the recall rate of the positive-class samples to 1, we put a constraint on the positive-class margin and extended the loss function as follows:(10)L+yf=C+1−kyf+,(11)L−yf=C−1−yf+.In Figure2, C+·controls the slope of the positive class, k controls the intersection of the abscissa axis, and the intersection is 1/k. C− controls the negative slope, and the intersection is 1. If the loss is 0, the classification confidence of the loss function must be sufficiently high. For the positive class, the loss is 0 when the degree of confidence is greater than 1/k.Figure 2
Loss function.
(a)(b)By replacing the original loss with the loss functions shown in (10) and (11), the original SVM can be extended to(12)argminw,b,ξ12w2+kC+∑i∈I+ξi+C−∑i∈I−ξi,subject to(13)yiwt⋅xi+b≥1k−ξi+,i∈I+,yiwt⋅xi+b≥1−ξi−,i∈I−,ξi≥0,i=1,2,…,N.Here,C+ and C− are two types of costs, and the positive margin can be changed by adjusting the value of k. In addition to the adjustable penalty, the motivation of this study is to provide the loss function of the imbalanced classes a different hinge point. A biased decision boundary caused by imbalanced classes can be recovered with the help of a scalable margin. Herein, we develop the cost-sensitive model for solving the SVM class-imbalanced problem that has both an adjustable penalty and a scalable margin.To solve the newly created problem, the Lagrangian function is introduced. The dual problem of the primal model can be written using Lagrange multipliers as follows:(14)L=12w2+kC+∑i∈I+ξi+C−∑i∈I−ξi−∑i∈I+αiyiwt⋅xi+b−1k+ξi−∑i∈I+ξiμi−∑i∈I−αiyiwt⋅xi+b−1+ξi−∑i∈I−ξiμi,where αi ≥ 0 and μi ≥ 0.(15)∂L∂w⟹w=∑iαiyixi,∂L∂b⟹∑Iαiyi=0,∂L∂ξi⟹kC+−αi−μi=0,i∈I+⟹0≤αi≤kC+,C−−αi−μi=0,i∈I−⟹0≤αi≤C−.Therefore, the dual optimization model of (12) is defined as(16)argmaxα−12∑i∑jαiαjyiyjKxi,xj+∑iαiyi+12k−yi−12,subject to(17)∑αi+=∑αi−,(18)0≤αi≤kC+,i∈I+,(19)0≤αi≤C−,i∈I−.Our objective is to solve the dual problem (Algorithm1).Algorithm 1: Algorithm to increase the recall rate to 1.
Algorithm:Positive margin adjustment using SVM.Given: a sequence of N examples XTrain and XValidationOutput:G #Output combination classifierVariables:α #Karush–Kuhn–Tucker conditions (KKT) initial alphaρ #G-means valueCp, Cn, k #Positive cost, Negative cost, Positive margin calibration variableT #the selected running iterationsFunction:S #classifier modelR∗G-means (G) #Obtain the Recall ∗G-means values from GBeginInitializeα0 = 0ρ0 = 0T = 1Set the 3D grid search range ofCp, Cn, k:(a)
Select optimization variablesα1n and α2n and solve the optimization problem using the sequential minimal optimization (SMO) algorithm to obtain α1n+1 and α2n+1, and update α to α1n+1.(b)
If the KKT conditions in (16)–(19) are satisfied within the allowable range of precision, ε, the KKT condition can be used for the next step; otherwise, continue with process (b).(c)
Getα∗=αn+1.(d)
Finally,α∗=α1∗,α2∗,…,αN∗T is obtained, and w∗ and b∗ are calculated as follows:w∗=∑i=1Nαi∗yixi,b∗=yj−∑i=1Nαi∗yixi,xj.nstruct a classifier modelS = S=w∗x+b(e)
G = sign (S)(f)
ρn=R∗G-means (G(XValidation)) at a condition recall of 1(g)
Ifρn>ρbest, then ρbest=ρnReturnGtEnd


## 4.3. Experiment

### 4.3.1. Performance Evaluation

In a classification problem, evaluation measures play a key role in assessing the performance of the classification model. The overall prediction accuracy is used to evaluate the classification of a balanced dataset; however, it is not an effective metric for an imbalanced dataset because it does not consider the prediction accuracy of either class. This lack of consideration is mainly due to the fact that the negative sample size is sometimes much larger than the positive sample size. In such cases, with an imbalance of 99 to 1, a classifier that classifies everything as negative will be 99% accurate, but it will be completely useless as a classifier. Therefore, more attention should be paid to the positive class. The current classification indicators are based on the confusion matrix presented in Table1.Table 1
Confusion matrix.
Predicted as the positive classPredicted as the negative classTrue positive classTPFNTrue negative classFPTNIn the confusion matrix, true positive (TP) is the number of positive-class instances that have been correctly classified, true negative (TN) is the number of negative-class instances that have been correctly classified, false positive (FP) is the number of negative instances that have been incorrectly classified as positive, and false negative (FN) is the number of positive instances that have been incorrectly classified as negative.To select the classification index of the positive class, we directly selected the recall (recall = TP/(TP + FN)) and specificity (specificity = TN/(TN + FP)), ensuring both a recall rate of 1 and high specificity.To balance the effects of recall and specificity on the classification results, an evaluation index,g-means, can be constructed using the geometric mean of equilibrium recall and specificity:(20)g−means=recall∗specificity.Although the number of positive samples may be very few, the omission and misjudgment of positive samples will be considered sufficient. Even if the classification accuracy rates for all the samples are excellent, theg-means value may be very low. The g-means indicator is effective for the classification evaluation of imbalanced data; however, it attaches equal importance to recall and specificity. As more attention was paid to recall in the present study, g-means was extended to recall ∗g-means, which increases the emphasis on recall. Ultimately, the proposed method performed the best with more emphasis on recall.


### 4.3.2. Experiments

We used ten class-imbalanced datasets with various positive ratios and compared our algorithm with the B-SVM [37], cost-sensitive support vector machine (CS-SVM) [44], and BP neural network algorithms [45], as well as two special classification costs. These experiments proved that it is feasible to adjust the positive-class margin to achieve a positive recall rate of 1.


### 4.3.3. Open Dataset

As shown in Table2, we compared the classification differences between the proposed method and other methods under different classification standards. We selected ten real-world imbalanced datasets from the UCI machine learning data repository [46]. Among them, ecoli1, ecoli2, glass6, car1v3, car1v4, glass5, segment1, and glass6 were constructed using a multiclassification problem.Table 2
Descriptions of the experimental datasets.
NameExampleDimensionRate of imbalanceNo. of classesBreast cancer o699101.92Breast cancer d569321.9332Ecoli133673.362Ecoli233675.462Glass621496.382Car1v31279617.542Car1v41275618.622Glass5214922.782Yeast51484832.732Segment123101962


### 4.3.4. Experimental Design

We compared the proposed method with several SVM-based methods and neural network, including the B-SVM, CS-SVM, and BP approaches, as well as two special classification costs (no cost and prorated cost). For the prorated cost, we set the misclassification cost based on the following equation:(21)misclassificationcostpositiveclassmisclassificationcostnegativeclass=total number of negative instancestotal number of positive instances.The RBF Gaussian kernelKx,z=exp−x−z2/2σ2 is used for all SVM algorithms, where σ is the bandwidth parameter that must be predetermined. We attempted to select the best σ value through a grid search of the σ range between 0.01 and 20. For different datasets, while searching for parameters such as C and k, different grid widths were selected to accelerate parameter selection. For both positive and negative class costs, the range of [0.01, 100] was selected, and the search range of K was fixed at [0.01, 10]. Logistic was selected as the activation function. The learning rate was selected within the range of [0.000001, 1], the number of hidden layers was selected from [1–3], and the search range of the number of neurons in each hidden layer was [2, 1000]. Five-fold cross-validation was used in each set of parameter experiments to determine the set of parameters with the best generalization performance. We chose the recall, specificity, g-means, and area under the receiver operating characteristic curve (AuROC) instead of global evaluation indicators to evaluate the performance of the classification method for imbalanced datasets. No cost and prorated cost were classified using a judgment threshold of 0, whereas the B-SVM, CS-SVM, and BP approaches used AuROC as the classification standard for the recall, specificity, and g-means.


## 4.3.1. Performance Evaluation

In a classification problem, evaluation measures play a key role in assessing the performance of the classification model. The overall prediction accuracy is used to evaluate the classification of a balanced dataset; however, it is not an effective metric for an imbalanced dataset because it does not consider the prediction accuracy of either class. This lack of consideration is mainly due to the fact that the negative sample size is sometimes much larger than the positive sample size. In such cases, with an imbalance of 99 to 1, a classifier that classifies everything as negative will be 99% accurate, but it will be completely useless as a classifier. Therefore, more attention should be paid to the positive class. The current classification indicators are based on the confusion matrix presented in Table1.Table 1
Confusion matrix.
Predicted as the positive classPredicted as the negative classTrue positive classTPFNTrue negative classFPTNIn the confusion matrix, true positive (TP) is the number of positive-class instances that have been correctly classified, true negative (TN) is the number of negative-class instances that have been correctly classified, false positive (FP) is the number of negative instances that have been incorrectly classified as positive, and false negative (FN) is the number of positive instances that have been incorrectly classified as negative.To select the classification index of the positive class, we directly selected the recall (recall = TP/(TP + FN)) and specificity (specificity = TN/(TN + FP)), ensuring both a recall rate of 1 and high specificity.To balance the effects of recall and specificity on the classification results, an evaluation index,g-means, can be constructed using the geometric mean of equilibrium recall and specificity:(20)g−means=recall∗specificity.Although the number of positive samples may be very few, the omission and misjudgment of positive samples will be considered sufficient. Even if the classification accuracy rates for all the samples are excellent, theg-means value may be very low. The g-means indicator is effective for the classification evaluation of imbalanced data; however, it attaches equal importance to recall and specificity. As more attention was paid to recall in the present study, g-means was extended to recall ∗g-means, which increases the emphasis on recall. Ultimately, the proposed method performed the best with more emphasis on recall.


## 4.3.2. Experiments

We used ten class-imbalanced datasets with various positive ratios and compared our algorithm with the B-SVM [37], cost-sensitive support vector machine (CS-SVM) [44], and BP neural network algorithms [45], as well as two special classification costs. These experiments proved that it is feasible to adjust the positive-class margin to achieve a positive recall rate of 1.


## 4.3.3. Open Dataset

As shown in Table2, we compared the classification differences between the proposed method and other methods under different classification standards. We selected ten real-world imbalanced datasets from the UCI machine learning data repository [46]. Among them, ecoli1, ecoli2, glass6, car1v3, car1v4, glass5, segment1, and glass6 were constructed using a multiclassification problem.Table 2
Descriptions of the experimental datasets.
NameExampleDimensionRate of imbalanceNo. of classesBreast cancer o699101.92Breast cancer d569321.9332Ecoli133673.362Ecoli233675.462Glass621496.382Car1v31279617.542Car1v41275618.622Glass5214922.782Yeast51484832.732Segment123101962


## 4.3.4. Experimental Design

We compared the proposed method with several SVM-based methods and neural network, including the B-SVM, CS-SVM, and BP approaches, as well as two special classification costs (no cost and prorated cost). For the prorated cost, we set the misclassification cost based on the following equation:(21)misclassificationcostpositiveclassmisclassificationcostnegativeclass=total number of negative instancestotal number of positive instances.The RBF Gaussian kernelKx,z=exp−x−z2/2σ2 is used for all SVM algorithms, where σ is the bandwidth parameter that must be predetermined. We attempted to select the best σ value through a grid search of the σ range between 0.01 and 20. For different datasets, while searching for parameters such as C and k, different grid widths were selected to accelerate parameter selection. For both positive and negative class costs, the range of [0.01, 100] was selected, and the search range of K was fixed at [0.01, 10]. Logistic was selected as the activation function. The learning rate was selected within the range of [0.000001, 1], the number of hidden layers was selected from [1–3], and the search range of the number of neurons in each hidden layer was [2, 1000]. Five-fold cross-validation was used in each set of parameter experiments to determine the set of parameters with the best generalization performance. We chose the recall, specificity, g-means, and area under the receiver operating characteristic curve (AuROC) instead of global evaluation indicators to evaluate the performance of the classification method for imbalanced datasets. No cost and prorated cost were classified using a judgment threshold of 0, whereas the B-SVM, CS-SVM, and BP approaches used AuROC as the classification standard for the recall, specificity, and g-means.


## 5. Results and Discussion

To demonstrate the ability of the proposed method to adjust the classification boundary visually, we select two sets of data (yeast5 and breast cancer d) and projected them into a two-dimensional space for visualization. Firstly, to demonstrate the influence of the value ofk on the change in the decision boundary under the two sets of data, we used different k values, as shown in Figure 3. In Figure 3, from left to right, the values of k are as follows: k = 1, k = 3, k = 2.416, k = 1, k = 3, and k = 2. The values were selected after a broad survey, and the recall of the adjusted k value of both datasets is 1. For the breast cancer d dataset, it is obvious that the classification effect of the adjusted k value is better than the k value that is randomly selected by the other two groups; hence, we will not explain this dataset in detail. However, for the yeast5 dataset, the other two kinds of k will also reach a recall of 1. The preliminary observation is that the classification effect when k = 1 is similar to that when k = 2; therefore, we compared their respective g-means. When k = 1, g-means = 0.936; when k = 3, g-means = 0.900; and when k = 2, g-means = 0.964. The comparison revealed that the adjusted k value not only increased the recall to 1 but also did not reduce the g-means value. Therefore, changing the margin of the positive class can adjust the position of the classification boundary so that the positive classes can be properly classified by the boundary.Figure 3
Comparative observation of the decision boundaries with variousk values. The decision boundaries are represented by the black lines and the margins by the gray lines. (a) k = 1. (b) k = 3. (c) k = 2.416. (d) k = 1. (e) k = 3. (f) k = 2.
(a)(b)(c)(d)(e)(f)In addition, the receiver operating characteristic (ROC), through which the threshold is determined, is a widely used evaluation index for classification problems. For the classification problem, we obtained a set of predicted values and classified the data by traversing the predicted values and used the predicted values as thresholds. Predicted values less than the threshold are classified as negative, and predicted values greater than the threshold are classified as positive. Therefore, for each set of predicted values, we can determine a unique set of TPR and FPR. The threshold determination criterion of the ROC curve is maximum (true positive rate (TPR)-false positive rate (FPR)) when the TPR-FPR is the largest, and the corresponding threshold is the threshold of the ROC curve.Frequently, the classification threshold under the ROC criterion cannot increase the recall to 1, such as in the experiments on four datasets whose results are presented in Figure4. The experiments prove that the threshold converges to a certain value as k increases. As shown in Figure 4, the classification ROC threshold of the four datasets decreases gradually with increasing k and exhibits an obvious trend of asymptotic stability. Based on the experimental results, an appropriate threshold can be chosen to ensure that the requirement of 1 can be achieved again by adjusting k. We completed five cross-validation experiments to reduce randomness, and the results indicate that our scheme is universal and widely applicable.Figure 4
Influence ofk on the ROC threshold.
(a)(b)(c)(d)Table3 summarizes the recall and specificity obtained with different methods. In Tables 4–6, the best results are highlighted (bold font). To examine the significance of the positive examples in the imbalanced datasets, we studied the recall of the positive examples, as presented in Table 4. In the datasets shown, the average recall rate of the proposed method is the largest, effectively increasing the recall rate to 1 in each case. The g-means index is shown in Table 5. It can be observed from Table 5 that although the average g-means value of our method is not the highest, this value is not reduced much compared to that in the other three ideal classification cases. Moreover, the g-means value of our proposed method is higher than that of the other five cases for some datasets. It can be observed that when the recall rate of the positive class reaches 1, the accuracy of the negative class does not decrease significantly and is within the acceptable range. These results demonstrate that the proposed method outperforms the other methods for the positive class of imbalanced datasets and that there may be a certain degree of improvement in the g-means index.Table 3
Recall and specificity (represented byr and s, respectively).
DatasetNo costProrated costB-SVMCS-SVMBPProposed methodrsrsrsrsrsrsBreast cancer o0.9830.9210.7490.8910.9750.9580.9880.9580.9880.96910.930Breast cancer d0.3900.9390.8720.8610.9200.9360.9200.9270.9250.96410.701Ecoli10.8110.7960.7750.2500.8980.9270.9100.8730.9750.82910.807Ecoli20.9820.2300.7420.7320.8650.9320.9420.9370.7930.83510.823Glass60.8670.8160.3330.7950.9000.9780.9330.9620.8930.98410.919Car1v30.8320.8301.0000.9561.0000.9901.0000.9971.0000.93510.997Car1v40.9081.0000.9541.0001.0001.0001.0001.0001.0000.95511.000Glass50.1001.0000.4000.9901.0000.9371.0000.9321.0000.62410.922Yeast50.8810.9031.0000.2831.0000.9381.0000.9560.7280.66710.905Segment10.1881.0000.1881.0000.9920.9970.9940.9971.0000.99510.994Average0.6940.8440.7010.7760.9550.9590.9690.9540.9300.87610.900Table 4
Recall.
DatasetNo costProrated costB-SVMCS-SVMBPProposed methodBreast cancer o0.9830.7490.9750.9880.9881.000Breast cancer d0.3900.8720.9200.9200.9251.000Ecoli10.8110.7750.8980.9100.9751.000Ecoli20.9820.7420.8650.9420.7931.000Glass60.8670.3330.9000.9330.8931.000Car1v30.8321.0001.0001.0001.0001.000Car1v40.9080.9541.0001.0001.0001.000Glass50.1000.4001.0001.0001.0001.000Yeast50.8811.0001.0001.0000.7281.000Segment10.1880.1880.9920.9941.0001.000Average0.6940.7010.9550.9690.9301.000Table 5
g-means index.
DatasetNo costProrated costB-SVMCS-SVMBPProposed methodBreast cancer o0.9510.8170.9660.9730.9780.964Breast cancer d0.6050.8660.9280.9230.9440.837Ecoli10.8030.4400.9120.8910.8990.898Ecoli20.4750.7370.8980.9390.8140.907Glass60.8410.5150.9380.9470.9370.959Car1v30.8310.9780.9950.9980.9670.998Car1v40.9530.9771.0001.0000.9771.000Glass50.3160.6290.9680.9650.7900.960Yeast50.8920.5320.9690.9780.6970.951Segment10.4340.4340.9940.9950.9970.997Average0.7100.6930.9570.9570.9000.947Table 6
Recall∗∗g-means.
DatasetNo costProrated costB-SVMCS-SVMBPProposed methodBreast cancer o0.9350.6120.9420.9610.9660.964Breast cancer d0.2360.7550.8540.8490.8730.837Ecoli10.6510.3410.8190.8110.8770.898Ecoli20.4660.5470.7770.8850.6460.907Glass60.7290.1710.8440.8840.8370.959Car1v30.6910.9780.9950.9980.9670.998Car1v40.8650.9321.0001.0000.9771.000Glass50.0320.2520.9680.9650.7900.960Yeast50.7860.5320.9690.9780.5070.951Segment10.0820.0820.9860.9890.9970.997Average0.5470.5200.9150.9320.8400.952Figure5 shows the combined g-means indicators obtained using several methods. Because we consider the recall rate to be extremely important, g-means multiplied by recall is n, used as the new indicator, which improves the weight of recall in g-means, so that the new indicator weighted emphasis on the recall. The g-means indices that attach more importance to recall are presented in Table 6. When the new indicator is adopted, our proposed method has the highest average value.Figure 5
Comparisons of the classification results’g-means indices.Figure6 clearly depicts the recall ∗g-means evaluation indicator under the comprehensive influence of the classification effects of the positive and negative classes. These results verify that the proposed method performs well on all the datasets.Figure 6
Comparisons of the recall∗g-means indices of the classification results.For the statistical analysis, we implement Studentʼst-test to verify whether significant differences exist between the proposed method and other methods in the experiment. The t-value in Studentʼs t-test is calculated as follows:(23)t=x¯σ2/n,where x¯represents the example mean of the data; σ is the standard variance of the data; and n is the sample size. In this case, the sample size is set to 10. As a case study, we compare the proposed method with other methods. We calculate the t-value using recall and g-means data listed in Tables 4 and 5. The null hypothesis should be H0:x¯1=x¯2, and the alternative hypothesis should be H1:x¯1≠x¯2. Let x1 be the sample mean obtained by the proposed method and x2 be the sample mean of the other three methods considered for the comparison. The same is true for the g-means test. Three t-tests were conducted for the three models listed in Table 4, and the results were compared. For the recall of BP, CS-SVM, and B-SVM models, the t-value obtained is 2.258, 2.631, and 2.671, respectively. We found that the t-value is 1.813 with the probability threshold of 0.05 using Student’s t-distribution table. The calculated t-values 2.258, 2.631, and 2.671 are all greater than the t-value 1.813; thus, at the 0.05 level of significance, the null hypothesis is rejected in favor of the alternative hypothesis. The recall value obtained by the proposed method is greater than that of other methods. For the t-test of the g-means of BP, CS-SVM, and B-SVM models, the t-value obtained is 1.320, −0.689, and −0.483, respectively. The calculated t-values 1.320, −0.689, and −0.483 are all lower than the t-value 1.813; thus, the null hypothesis cannot be rejected. Therefore, at the 0.05 level of significance, we believe that no significant difference exists in the g-means indicators obtained by several models.Based on the above conclusions, at the 0.05 level of significance, the recall of the proposed method is significantly greater than that of other methods, and no significant difference exists in theg-means.


## 6. Conclusions

In this paper, a cost-sensitive SVM algorithm based on an imbalanced margin was proposed for the classification of imbalanced data. This method was based on the theory proposed by Veropoulos et al. [37], and its feasibility was verified using both theoretical and experimental results. The recall rate of small classes was improved by adjusting the SVM positive classification margin. The proposed method was also compared with other traditional methods. The experimental results demonstrate that a small-class recall rate of 1 can be achieved using the proposed method. However, the proposed approach still has some disadvantages. Specifically, the accuracy of positive classes is lost in some datasets, but in many cases, the performance improves compared with that of the traditional methods. When the classification evaluation criteria are changed (i.e., more emphasis is placed on the positive classes), the average evaluation index of the proposed method is the highest. Such classification results are of great significance in the fields of finance, medicine, engineering, and astronomy, to name some. In future work, we will test the experimental setup employed in this study using different machine learning models and attempt to apply this method to practical problems. Additionally, we will extend the proposed method to multiclass classification problems by adopting a one-versus-all approach.



---

*Source: 6647557-2021-05-05.xml*