scieee AI-readable full text Open interactive document viewer

Comparing the performance of oversampling techniques in combination with a clustering algorithm for imbalanced learning

Pereira, Mariana Matoso

Abstract

Imbalanced datasets in supervised learning are considered an ongoing challenging task for standard algorithms, seeing as they are designed to handle balanced class distributions and perform poorly when applied to problems of the imbalanced nature. Many methods have been developed to address this specific problem but the more general approach to achieve a balanced class distribution is data level modification, instead of algorithm modifications. Although class imbalances are responsible for significant losses of performance in standard classifiers in many different types of problems, another aspect that is important to consider is the small disjuncts problem. Therefore, it is important to consider and understand solutions that not only take into the account the between-class imbalance (the imbalance occurring between the two classes) but also the within-class imbalance (the imbalance occurring between the sub-clusters of each class) and to oversample the dataset by rectifying these two types of imbalances simultaneously. It has been shown that cluster-based oversampling is a robust solution that takes into consideration these two problems. This work sets out to study the effect and impact combining different existing oversampling methods with a clustering-based approach. Empirical results of extensive experiments show that the combinations of different oversampling techniques with the clustering algorithm k-means – K-Means Oversampling - improves upon classification results resulting solely from the oversampling techniques with no prior clustering step.

Full text

i COMPARING THE PERFORMANCE OF OVERSAMPLING TECHNIQUES IN COMBINATION WITH A CLUSTERING ALGORITHM FOR IMBALANCED LEARNING Mariana Matoso Pereira Dissertation presented as partial requirement for obtaining the Master’s degree in Statistics and Information Management i MEGI 2018 Comparing the performance of oversampling techniques in combination with a clustering algorithm for imbalanced learning Mariana Matoso Pereira MGI i ii NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa COMPARING THE PERFORMANCE OF OVERSAMPLING TECHNIQUES IN COMBINATION WITH A CLUSTERING ALGORITHM FOR IMBALANCED LEARNING by Mariana Matoso Pereira Dissertation presented as partial requirement for obtaining the Master’s degree in Information Management, with a specialization in Knowledge Management and Business Intelligence Advisor: Fernando Bação November 2018 iii ABSTRACT Imbalanced datasets in supervised learning are considered an ongoing challenging task for standard algorithms, seeing as they are designed to handle balanced class distributions and perform poorly when applied to problems of the imbalanced nature. Many methods have been developed to address this specific problem but the more general approach to achieve a balanced class distribution is data level modification, instead of algorithm modifications. Although class imbalances are responsible for significant losses of performance in standard classifiers in many different types of problems, another aspect that is important to consider is the small disjuncts problem. Therefore, it is important to consider and understand solutions that not only take into the account the between-class imbalance (the imbalance occurring between the two classes) but also the within-class imbalance (the imbalance occurring between the sub-clusters of each class) and to oversample the dataset by rectifying these two types of imbalances simultaneously. It has been shown that cluster-based oversampling is a robust solution that takes into consideration these two problems. This work sets out to study the effect and impact combining different existing oversampling methods with a clustering-based approach. Empirical results of extensive experiments show that the combinations of different oversampling techniques with the clustering algorithm k-means – K-Means Oversampling - improves upon classification results resulting solely from the oversampling techniques with no prior clustering step. KEYWORDS Imbalanced Learning; Oversampling; Clustering; Supervised Learning iv INDEX 1. Introduction.............................................................................................................. 1 2. Related Work ............................................................................................................ 3 3. Research Methodology ............................................................................................. 6 3.1. Metrics .............................................................................................................. 7 3.2. Oversamplers ..................................................................................................... 8 3.3. Classifiers ........................................................................................................... 8 3.4. Datasets ........................................................................................................... 10 3.5. Experimental Framework ................................................................................. 11 4. Experimental Results .............................................................................................. 12 4.1. Random Oversampling ..................................................................................... 13 4.2. SMOTE ............................................................................................................. 14 4.3. Borderline SMOTE............................................................................................ 15 4.4. G-SMOTE ......................................................................................................... 16 5. Conclusion .............................................................................................................. 19 6. Bibliography............................................................................................................ 20 7. Annexes .................................................................................................................. 22 v LIST OF FIGURES Figure 1 - Mean ranking results for Random Oversampling .................................................. 13 Figure 2 - Mean ranking results for SMOTE ........................................................................... 14 Figure 3 - Mean ranking results for Borderline SMOTE ......................................................... 15 Figure 4 - Mean ranking results for G-SMOTE ....................................................................... 16 vi LIST OF TABLES Table 1 - Confusion Matrix ..................................................................................................... 7 Table 2 - Description of the datasets .................................................................................... 10 Table 3 - Mean ranking results for all oversampling methods across the datasets ................ 18 Table 4 - Results for the Friedman test ................................................................................. 23 vii LIST OF ABBREVIATIONS AND ACRONYMS A-SUWO Adaptive Semi-Unsupervised Weighted Oversampling ROC AUC Area Under ROC Curve KNN K-Nearest Neighbors LR Logistic Regression DT Decision Tree SMOTE Synthetic Minority Oversampling Technique SOMO Self-Organizing Map Oversampling G-SMOTE Geometric SMOTE 7 3.1. METRICS Regarding the assessment metrics that are traditionally used to evaluate classifier performance, not all are suitable when the problem is of the imbalanced nature and the class distribution is skewed. These assessment metrics compare the class membership of each observation with the predictions made by the classifier. With the predictions, it is possible to build the confusion matrix, as seen in Table #. The most commonly used metrics for classification problems for a balanced dataset are accuracy and error rate, its inverse. !""#$%"&=()*+), *+, -$$.$(/%01=1−!""#$%"& For example, a trivial classifier that always predicts the negative class, the accuracy will be equal to the proportion of negative class observations in the data set, but it will misclassify every positive class observation. Therefore, the total accuracy will be high, suggesting an effective classifier, whereas it is pretty clear that it isn’t since no single minority instance was correctly predicted (HE & Garcia, 2010). Predicted Positives Predicted Negatives Positives True Positives (TP) False Negatives (FN) Sensitivity/Recall 4 56 6 7 Negatives False Positives (FP) True Negatives (FN) Specificity 4 58 8 7 Precision 456 667 Table 1 - Confusion Matrix Sensitivity, also referred to as recall or true positive rate, explains the prediction accuracy among minority (HE & Garcia, 2010). Precision is the rate of correct predictions among all instances predicted to belong to the minority class, indicating how many of the positive predictions are correct (HE & Garcia, 2010). As explained above, in the presence of imbalanced data, these metrics show a bias toward the majority class which makes it difficult for a classifier to perform well on the rare classes (Kotsiantis, Kanellopoulos, & Pintelas, 2006). However, metrics that are able to cope with imbalanced class distribution have been developed and coming into widespread use by being employed when total accuracy is not suitable in order to provide a comprehensive assessment of the problem. With this in mind, in order to determine a general ranking amongst oversampling method, there is no special aspect that is more important than the others, so the following unweighted metrics are chosen: F-measure, g-mean and Area Under Roc Curve (AUC). 8 The F1 score, or F-Measure metric, combines precision and recall as a measure of the effectiveness of classification in terms of a ratio of the weighted importance on either recall or precision as determined by the β coefficient set by the user (HE & Garcia, 2010). :1=( ( 1+< ) >×$1"%@@×A$1"BCB.D <(×($1"%@@+A$1"BCB.D (= ( 1+< ) × 4 )* *×)* ** 7 )* *×<+)* ** Another chosen metric is the geometric mean, or G-Mean metric, which is defined as the geometric mean of sensitivity and specificity (HE & Garcia, 2010). E−F1%D= G C1DCB0BHB0&×CA1"BIB"B0&(=( J )* *×), , Finally, the last metric to be considered is the AUC (Area Under the ROC Curve). The ROC curve is obtained by plotting the False Positive Rate (FPR) defined as i.e. the proportion of misclassified negative examples relative to the total number of negative class observations, represented in the X- axis versus the Y-axis, the True Positive Rate, defined above. Varying the classification threshold of the classifier identifies different points of the ROC curve. Since the ROC curve depends on the classification threshold, the AUC (Area Under the ROC Curve) is a useful metric for the performance of the classifier as it is independent of the decision criterion (HE & Garcia, 2010). 3.2. OVERSAMPLERS The performance of the following oversamplers was evaluated and compared against their clustering counterparts: Random Oversampling, SMOTE, Borderline and G-SMOTE. For SMOTE and its two variations, more specifically Borderline SMOTE and G-SMOTE, the optimal value of k nearest neighbors was selected as k ∈ {3, 5}. Furthermore, a hyper-parameter grid was generated for G-SMOTE including the three different selection strategies, the number of nearest neighbors k ∈ {3, 4}, the truncation factor L trunc ∈ {−1.0, 0.0, 1.0} and the deformation factor L def ∈ {0.0, 0.5, 1.0}. Regarding the K-Means Oversampling methods, while the hyper-parameters concerning the oversampling technique remain the same, the clustering algorithm adds the following hyper-parameters to the grid: § n_clusters ∈ {0.0, 0.25,0.5,0.75, 1.0}; § distances_exponent ∈ {0, 1, 2}; § filtering_threshold ∈ {0.5, 1.0}; 3.3. CLASSIFIERS When it comes to classifiers, several different classification algorithms were chosen to make sure that the results can be generalized and are not constrained to the usage of a specific one. The chosen 9 classifiers were Logistic Regression (LR), Gradient Boosting Classifier (GBC), K-Nearest Neighbors (KNN) and Decision Tree (DT). Logistic Regression (LR) is a generalization of linear regression which can be used for binary classification. Fitting the model is an optimization problem which can be solved using simple optimizers which require no hyperparameters to be tuned (McCullagh & Nelder, 1989). Because of this, results produced by LR are conveniently reproducible, and therefore, appropriate to be used as a benchmark for more sophisticated approaches. Additionally, another classification algorithm used can be referred to as k-nearest neighbors (KNN). The algorithm assigns an observation to the class most of its nearest neighbors belong to. The number of neighbors that are considered is determined by the method’s hyperparameter k (Fix and Hodges Jr., 1951). Finally, Gradient Boosting Classifier (GBC) is an ensemble technique used for classification. In the case of binary classification, one shallow decision tree is induced at each stage of the algorithm. Each tree is fitted to observations which could not be correctly classified by decision trees of previous stages. Predictions of GBC are made by majority vote of all trees. In this way, the algorithm combines several simple models (referred to as weak learners) to create one effective classifier. The number of decision trees to generate, which in binary classification is equal to the number of stages, is a hyperparameter of the algorithm (J. H. Friedman, 2001). Different combinations of hyper-parameters were used and tested for each of the classifiers mentioned above. The classifiers are used with the default parameters unless stated otherwise. More specifically, the GBC hyper-parameter grid included the combinations resulting from max depth ∈ {3, 6} and number of estimators ∈ {50, 100}. For the Decision Tree Classifier, the combinations resulting from max depth ∈ {3, 6} are tested. Additionally, for KNN, the number of neighbors ∈ {3, 5}. 10 3.4. DATASETS In order to test the performance of the different oversamplers, 13 imbalanced datasets from Machine Learning Repository UCI were used. Table 2 shows a summary of the datasets and their characteristics. Furthermore, to generate additional datasets with higher imbalance ratios, each of the aforementioned datasets was randomly undersampled to generate various other datasets. Undersampled versions of the original datasets are omitted from the table. Dataset Name # Features # Instances # Minority # Majority Imbalance Ratio Heart 13 270 120 150 1.25 Liver 6 345 145 200 1.38 Wine 13 178 71 107 1.51 Pima 8 769 268 501 1.87 Breast Tissue 9 106 36 70 1.94 Iris 4 150 50 100 2.0 Glass 9 214 70 144 2.06 Yeast 8 1484 429 1055 2.46 Haberman 3 306 81 225 2.78 Segmentation 16 2310 330 1980 6.0 Ecoli 7 336 52 284 5.46 Eucalyptus 8 642 98 544 5.55 Vehicle 18 846 199 647 3.25 Table 2 - Description of the datasets 11 3.5. EXPERIMENTAL FRAMEWORK To evaluate the different methods, all of the oversamplers, metrics, datasets, and classifiers previously discussed in this section are used. In this study, while many other clustering algorithms could have been selected, the k-means algorithm was adopted due to its simplicity and popularity. K-means works as follows: k training examples are first selected at random as representative of each cluster. The input vector of these representative examples represents the mean of each cluster. The other training examples are processed one by one. For each of these examples, the distance between it and the k cluster centers is calculated. The example is attributed to the cluster closest to it. The cluster that received the example, has its mean vector updated by averaging the input vectors of all its corresponding examples (Jo & Japkowicz, 2004). In order to evaluate the performance of the algorithms, results are obtained by applying k-fold crossvalidation with k = 3. In each dataset, every metric is computed by averaging their values across runs. In addition to the arithmetic mean, the standard deviation is calculated. Furthermore, in order to achieve optimal results for all classifiers and oversamplers, a grid search procedure is used. For this purpose, each classifier and each oversampler is used with a set of possible values for every hyperparameter. Subsequently, all possible combinations of an algorithm’s hyperparameters are generated and the algorithms are executed once for each combination. All metrics are used to score all resulting classifications, and the best value obtained for each metric is saved. Summing up, the experimental procedure was repeated three times and the implementation of the classifiers and standard oversampling algorithms was based on the Python library Scikit-Learn (Pedregosa et al., 2012). 12 4. EXPERIMENTAL RESULTS Since the main objective of the analysis is to gauge the effects of the different oversampling techniques in combination with a clustering algorithm, results are shown for each individual technique, along with the results of what occurs when there is no oversampling and just the oversampler sans the prior clustering step. Taking into consideration the recommendations for evaluating classifier performance across multiple datasets (Demšar, 2006), the obtained scores are not compared directly, but instead ordered to derive a ranking. Having said that, the goal is to compare oversamplers, hence the method being adapted to rank the oversampling techniques, instead of classification algorithms. To derive the rank order, cross-validated scores are used, assigning a ranking score to each oversampling method for every combination of the datasets, 3 metrics and the 4 classifiers. The result is a different ranking for each of the experiment repetitions, divided by dataset, metric and classifier. Keeping in mind that there are three methods being compared, rank one will be attributed to the best performing one and rank three to the worst performing one. Moreover, each method's rank is averaged across datasets and experiment repetition. A method's rank is a real number from the interval [1;3]. The mean ranking results for each combination and classifier, regarding each individual oversampling technique are shown in Figures 1-4. By testing the null hypothesis that the classifiers do not perform similarly in the mean rankings across the oversampling methods and evaluation metrics, the Friedman test (M. Friedman, 1937) determines the statistical significance of the derived mean ranking. The test is chosen to detect the differences in results across the multiple experiments because it does not assume normality of the obtained scores (Demšar, 2006). At a significance level of a = 0.05, the null hypothesis is rejected for all evaluated classifiers and evaluation metrics. Therefore, all of the rankings are assumed to be significant. The results of the application of the Friedman test for each of the oversampling methods are shown in annex in Table 4. 13 4.1. RANDOM OVERSAMPLING Considering the mean ranking results when random oversampling is applied it is possible to observe that the random oversampler when coupled with the clustering algorithm, which can be referred to as K-Means Random Oversampling, seems to outperform the other two methods (no oversampling and random oversampling) regarding all metrics and all classifiers. In all possible twelve combinations, K- Means Random Oversampling achieves a mean rank better than two. Furthermore, it is the only method with a mean ranking better than two in two particular metrics, F1 score and AUC. Additionally, in three out of nine cases, it can be seen that K-Random Oversampling boosts classification results when Random Oversampling accomplishes a rank worse than no oversampling. However, it is clear that when no oversampling is applied, the results are the worst amongst the three methods. Figure 1 - Mean ranking results for Random Oversampling 14 4.2. SMOTE Similarly, when the clustering procedure is added before applying SMOTE, thus resulting in K-Means SMOTE, it can be seen that the method frequently outperforms the remaining two, which are no oversampling and regular SMOTE. Significantly, this can be observed regardless of the metric or choice of classifier since the improvement can be seen in eleven out of twelve cases, consistently achieving a mean rank better than two. The remaining case in which the improvement does not happen is regarding the combination of G- Mean and the KNN classifier where it accomplishes a slightly inferior rank. Figure 2 - Mean ranking results for SMOTE 15 4.3. BORDERLINE SMOTE When it comes to the Borderline SMOTE oversampling technique, the evidence shows that the K- Means Borderline SMOTE algorithm outperforms the other two methods (no oversampling and Borderline SMOTE) in all metrics and regardless of the choice in classifiers. Similarly, it is possible to note that no oversampling provides the worst results. Figure 3 - Mean ranking results for Borderline SMOTE 16 4.4. G-SMOTE Contrary to what happens in the previous cases, when the oversampler that follows the K-Means algorithms is G-SMOTE the mean ranking results show that the algorithm – K-Means G-SMOTE – only outperforms the other two methods (no oversampling and G-SMOTE) in eight out of twelves cases regarding the various combinations of metrics and classifiers. This happens in contrast to the evidence previously shown, as it does not always outperform the oversampler with no clustering procedure and the imbalanced data with no oversampling. However, as previously seen, no oversampling continues to provide the worst results. Figure 4 - Mean ranking results for G-SMOTE Taking into consideration the conclusions taken from studied oversampling techniques regarding the different choices in metrics and classifiers, the mean ranking results show that the performance of the different oversampling methods is improved when in combination with a clustering procedure - the kmeans clustering algorithm – therefore making it possible to conclude that it adds value to the classification process. Generally, it can be observed that the combination frequently achieves the best 23 G-MEAN 3,70e-15 Borderline SMOTE LR ROC AUC 3,02e-14 True F1 1,02e-17 G-MEAN 1,00e-20 KNN ROC AUC 4,30e-09 F1 1,38e-13 G-MEAN 4,46e-17 DT ROC AUC 6,59e-11 F1 6,25e-11 G-MEAN 1,86e-13 GBC ROC AUC 1,96e-09 F1 7,72e-12 G-MEAN 6,56e-15 G-SMOTE LR ROC AUC 5,89e-14 True F1 9,58e-20 G-MEAN 1,06e-20 KNN ROC AUC 3,89e-15 F1 4,81e-16 G-MEAN 1,32e-20 DT ROC AUC 3,67e-19 F1 2,90e-17 G-MEAN 3,59e-20 GBC ROC AUC 6,04e-17 F1 6,51e-19 G-MEAN 8,22e-21 Table 4 - Results for the Friedman test