Next Article in Journal
CPU-GPU-Memory DVFS for Power-Efficient MPSoC in Mobile Cyber Physical Systems
Next Article in Special Issue
A Multi-Service Adaptive Semi-Persistent LTE Uplink Scheduler for Low Power M2M Devices
Previous Article in Journal
A Survey on Intrusion Detection Systems for Fog and Cloud Computing
Previous Article in Special Issue
Time Optimization of Unmanned Aerial Vehicles Using an Augmented Path
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Density-Based Random Forest for Imbalanced Data Classification

1
School of Computer Engineering & Science, Shanghai University, 99 Shangda Rd., Shanghai 200444, China
2
Materials Genome Institute, Shanghai University, 99 Shangda Rd., Shanghai 200444, China
3
Zhejiang Laboratory, Hangzhou 311100, China
*
Author to whom correspondence should be addressed.
Future Internet 2022, 14(3), 90; https://doi.org/10.3390/fi14030090
Submission received: 31 January 2022 / Revised: 8 March 2022 / Accepted: 9 March 2022 / Published: 14 March 2022
(This article belongs to the Special Issue AI, Machine Learning and Data Analytics for Wireless Communications)

Abstract

:
Many machine learning problem domains, such as the detection of fraud, spam, outliers, and anomalies, tend to involve inherently imbalanced class distributions of samples. However, most classification algorithms assume equivalent sample sizes for each class. Therefore, imbalanced classification datasets pose a significant challenge in prediction modeling. Herein, we propose a density-based random forest algorithm (DBRF) to improve the prediction performance, especially for minority classes. DBRF is designed to recognize boundary samples as the most difficult to classify and then use a density-based method to augment them. Subsequently, two different random forest classifiers were constructed to model the augmented boundary samples and the original dataset dependently, and the final output was determined using a bagging technique. A real-world material classification dataset and 33 open public imbalanced datasets were used to evaluate the performance of DBRF. On the 34 datasets, DBRF could achieve improvements of 2–15% over random forest in terms of the F1-measure and G-mean. The experimental results proved the ability of DBRF to solve the problem of classifying objects located on the class boundary, including objects of minority classes, by taking into account the density of objects in space.

Graphical Abstract

1. Introduction

Real-world datasets generally exhibit notable imbalances between different data classes, and the effectiveness of computational classification methods is typically limited by this uneven distribution. For example, in medical cancer detection from testing data [1], relatively few samples may be expected to be detected as cancer patients, whereas most samples are normal. Similar examples have been noted in the fields of intrusion detection [2], fraud identification [3], and credit loans [4], among others. Most classification algorithms are proposed based on balanced data, and their performance is reduced when processing imbalanced data. Samples are primarily divided into majority and minority types in imbalanced datasets, according to the number of samples. Given that most classification algorithms focus on overall accuracy as their key evaluation metric, they tend to perform better when classifying samples as belonging to the majority class and heavily neglect the minority class. However, the negative effect of majority classes misclassification is less important than that of minority classes in some real application scenarios. Therefore, the development of new or improved methods to reduce the misclassification of minority classes is required.
The primary motivation of this work is to improve the prediction on minority samples in imbalanced datasets. The main idea of our proposed method is to integrate the ideas of data density with random forest classifiers to address the imbalance problem. This increases the training opportunity for minority class sets and boundary samples to reduce the misclassification of minority classes in imbalanced data. Specifically, we propose the density-based random forest (DBRF) integration method. The DBRF classifier model constructs a density domain in the sample datasets, defined as the collection of all minority and boundary samples. The poor performance of prior models is not caused by the number of categories, but rather the potential ambiguity of the decision boundary between categories. Therefore, we used ensemble learning, i.e., a random forest algorithm, to perform additional training for boundary and minority samples to improve the prediction accuracy of the model on minority samples. First, we define boundary and density domains. Then, the original dataset and these two domains are used to build the DBRF model. While improving on the sample diversity of prior models, the proposed approach is also biased toward minority samples. The contributions of this study are summarized below:
(1)
We used a method to identify the boundary minority samples and remove noise minority samples. The method determines whether a minority sample is a boundary minority sample or a noise sample based on the number of majority samples in its nearest neighbor samples;
(2)
We applied a density-based method to identify the boundary samples by boundary minority samples. The density-based method identifies the class boundary samples by taking into account the density of objects in space, as is done when solving the clustering problem with the DBSCAN algorithm;
(3)
A density-based random forest (DBRF) is proposed to deal with the imbalanced data problem. There are two types of classifiers in DBRF. One is built from the original dataset, and the other is constructed with boundary class samples identified by the density method, including minority class samples;
(4)
The performance of DBRF was evaluated based on the public binary-class-imbalanced datasets. We also compared DBRF with other common algorithms.
The remainder of this paper is organized as follows. Section 2 briefly reviews the relevant problems in this area and some related state-of-the-art approaches. Section 3 describes the improved DBRF method. Section 4 provides the experimental results and analyzes the differences between DBRF and other methods. Section 6 concludes the work and discusses some possible directions for future research.

2. Related Work

Conventional machine learning algorithms are predominantly based on balanced data; when the input data are imbalanced between classes, they cannot perform well. Generally, methods for processing imbalanced data may be divided into two categories: methods that operate at the data processing level and methods that operate at the algorithm framework level.

2.1. Data-Level Imbalanced Data Processing

At the data level, oversampling and undersampling are the main categories of methods used to process imbalanced data [5]. Oversampling balances the number of classes by duplicating the minority class samples, but this may lead to overfitting. Undersampling involves balancing the training sets by deleting some majority class samples. However, some useful information may be lost in this process, leading to underfitting.
The synthetic minority oversampling technique (SMOTE) [6] is common in practical applications. It is designed to use the nearest neighbor algorithm to select randomly N samples from the k nearest neighbors for linear interpolation, which can balance the categories in the original dataset by adding new minority class samples. Many novel methods have been proposed to further improve on this idea [7,8,9].
In classification, boundary samples are typically more likely to be misclassified. Therefore, the borderline SMOTE algorithm [10] was proposed based on the SMOTE algorithm. In contrast to other oversampling methods, the algorithm uses only relatively few class samples from the boundary samples to construct new samples.
The ADASYN algorithm [11] extends each minority class sample according to the density distribution of the training set with different weights to balance the training set. In contrast, DBRF uses the density method to find all the samples at the boundary without re-synthesizing new data points.
The compressed nearest neighbor rule (CNNR) [12] was developed to remove redundant information by undersampling the majority samples using the one-nearest neighbor algorithm and removing the majority samples far from the decision boundary. Then, a reduced dataset E is obtained from the original dataset D ( E D ) . Because the CNNR method selects samples randomly, it causes unnecessary samples, such as noise, to remain in E.
The TomekLinks algorithm [13] is an undersampling algorithm for removing noise and boundary samples. Given two samples x i and x j from different classes, d i s t ( x i , x j ) represents the distance between the two samples. If no sample x meets the conditions that d i s t ( x i , x ) < d i s t ( x i , x j ) or d i s t ( x j , x ) < d i s t ( x i , x j ) , the sample pair ( x i , x j ) constitutes a TomekLink. Either one of the two samples in TomekLink is noise or both are on the boundary of the two types. Using this property, the method can delete the noise and redundant samples by constituting the TomekLinks.
The one-sided selection algorithm (OSS) [14] attempts intelligent undersampling of most classes by removing redundant data or artificial noise.
The edited nearest neighbor (ENN) algorithm  [15] reduces majority samples through a 3NN method. First, the ENN finds three samples that have the nearest distances to a certain sample x. Then, if two or more of them have a different class than the sample x, the sample x is deleted. Because most samples are often surrounded by majority classes, relatively few majority samples are deleted by the ENN algorithm. Therefore, the neighborhood cleaning rule [16] was modified from the ENN. If the sample is a majority sample, it will do the same as the ENN. Majority samples are removed if the sample is a minority sample and more than two of three samples chosen by the 3NN are majority samples.

2.2. Algorithm-Level Methods for Imbalanced Data

Three approaches for imbalanced datasets at the algorithmic level are predominantly used: cost-sensitive learning [17], ensemble learning [18], and single-class classification [19]. Cost-sensitive learning methods apply various misclassification costs to classification decision-making. The goal is to minimize the overall misclassification cost rather than reduce the error rate. When the amount of data between categories is severely imbalanced, the classifier tends to predict all testing data as belonging to a majority category. To solve this problem, a classification method based on distinction is no longer applicable; therefore, a method based on learning recognition and single-class learning is proposed herein. The single-class learning method is designed to learn only the samples of the target class of interest, that is to train only the samples of majority classes and to fully learn their features. The goal is to identify the majority class sample from the test sample instead of distinguishing whether a sample belongs to the minority or majority class. A new sample is distinguished by comparing the similarities between the sample and the target class.
In ensemble learning, multiple basic learners are combined to obtain better generalization performance than a single classifier [18]. Three approaches have been explored for ensemble-learning-based imbalanced data processing: data resampling combined with ensemble learning, cost-sensitive learning combined with ensemble learning, and increasing the diversity of classifiers in ensemble learning. SMOTEBoost [20] is a combination of SMOTE and AdaBoost [21]. First, the SMOTE algorithm is used to generate new minority samples in each iteration. Then, the minority samples receive more attention in the next iteration. Because each base classifier is constructed using different training sets, this method improves the decision domain after the vote integration. Chen et al. [22] developed a method that combines oversampling and undersampling and is effective for highly imbalanced data. First, it balances the sample set with undersampling and then optimizes the basic properties of the dataset, such as the data distribution and diversity, by oversampling.
The AdaCost algorithm [23] improves the recall rate and accuracy of the boosting algorithm [24] by introducing the misclassification cost of each training sample during the weight update of the boosting algorithm. In AdaCost, the weight update rule is as follows: (1) if the weak classifier misclassifies the samples with higher misclassification cost, its weight is increased; (2) if it classifies correctly, its weight is decreased.
Chen et al. [25] proposed the random forest variants balanced random forest (BRF) and weighted random forest (WRF). BRF performs the random replication of the minority class when constructing the training subset. WRF integrates the idea of cost-sensitive learning with random forest classifiers, that is increasing the weight of minority classes. Meanwhile, during voting, the weight multiplied by the number of votes is used as the final result. The weight is updated using the out-of-bag error data. These methods improve the data prediction of the algorithm.
The imbalance problem involves other factors in addition to class bias, such as class overlap, decision boundaries, and sample distribution. Choudhary and Shukla [26] proposed an algorithm that decomposes the complex imbalance problem into simpler sub-problems by a fuzzy clustering method and then assigns weights to each sub-classifier for voting classification.
Biased random forest (BRAF) [27] reduces the prediction error rate of minority classes by increasing the diversity of ensemble learning. First, undersampling is used to construct the critical areas on the original dataset. Then, the critical areas are used to train the subtree. Finally, the trained subtree is merged with the standard random forest. A new method based on an information granule (IGRF) [28] applied the idea of BRAF to crime detection. The IGRF process combines information granularity and the series of crime pairs in k neighbors to form the critical areas. Then, the same procedure as BRAF is used to construct the model.
With the widespread use of deep learning, some scholars have studied the class-balanced loss function, distinct block processing of images, data augmentation techniques, etc. Olusola et al. [29] proposed a novel data augmentation technique based on covariate synthesis minority oversampling (SMOTE) to address data scarcity and category imbalance. Jeyaprakash et al. [30] proposed an efficient malware detection system based on deep learning to address imbalances in malware datasets. Oyewola et al. [31] proposed a novel deep residual convolutional neural network (DRNN) for cassava mosaic disease detection in cassava leaf images. Inzamam et al. [32] proposed a new data augmentation technique that uses the secondary dataset RVL-CDIP to normalize imbalanced datasets.
To sum up, on the data level, oversampling methods (SMOTE, ADASYN, etc.) balance the dataset for classification by adding minority samples. If there are too many noise samples in the minority samples, the distribution of the original dataset will change after the sample expansion. Undersampling methods (ENN, etc.) balance the dataset by reducing the number of majority samples. For highly imbalanced datasets, deleting too many valid samples makes it impossible to fully train the dataset. On the algorithm level, BRAF finds the k-nearest majority neighbors for each minority sample. Then, it merges the k-nearest majority neighbors with the minority samples directly to construct critical areas. The method used in BRAF cannot identify boundary samples accurately and introduces noise and redundant samples. It also impacts the subsequent classifications. To solve this problem, we propose a DBRF algorithm. DBRF obtains a random forest using the density distribution method to build the density domain based on BRAF. DBRF constructs the density domain based on the boundary minority samples. The aim of the study was to locate samples lacking a clear decision boundary and enhance the ability to identify them.

3. Methods

Inspired by the borderline SMOTE [10], DBSCAN [33], and BRAF [27] algorithms, we herein propose DBRF to solve the problem of insufficient prediction accuracy for minority classes in imbalanced datasets. The DBRF algorithm has two main purposes. (1) Additional training is performed on boundary samples. In the imbalanced dataset, the main factor resulting in the poor performance of prior models is not the balance of the number of categories between classes, but the ambiguity of the decision boundaries between the categories. Therefore, additional training can be performed on the boundary samples to reduce the prediction error rate of the minority class by increasing the diversity of the model. (2) The additional training samples are constructed to meet the minority sample distribution as much as possible through the density method, aiming to accurately locate samples with unclear decision boundaries, referred to as boundary samples.
Therefore, our objective was to locate boundary samples as accurately as possible. We define two domains: boundary and density domains. These domains are constructed to locate the boundary samples more accurately for additional training. The boundary domain functions to determine the boundary minority samples. We aimed to find the boundary minorities to determine the final dataset for additional training because it is mainly used to improve the prediction of minority classes. The density domain functions to locate the boundary samples, that is the final dataset, for additional training. The density domain serves to determine the majority class samples by density, that is the majority class samples according to the distribution of the boundary minority class samples. Figure 1 shows an imbalanced dataset. In Figure 1, the green, gray, and red points represent the samples used for additional training.

3.1. Definition

3.1.1. Boundary Domain

This is a set of minority samples and requires that the number of majority samples in the m-nearest neighbors of the minority samples be greater than the number of minority samples.
B o u n d a r y D o m a i n = { x i m 2 N ( d i s t ( x i , D ) ) < m , x i D , i = 1 , 2 , , s }
In Equation (1), x i represents the i-th sample in minority class D , s represents the total number of minority samples, m represents the number of neighboring samples to be selected, D represents the original dataset, d i s t ( x i , D ) represents the Euclidean distance from sample x i to all samples in the original dataset D, and N ( d i s t ( x i , D ) ) represents the number of samples of the majority class in the first m samples near the sample x i .

3.1.2. Direct Density-Reachability and Density-Reachability

Before introducing the density domain, we introduce two core concepts defined in DBSCAN: direct density-reachability and density-reachability. These two concepts are used when defining the density domain:
-
Direct density-reachability: If d i s t ( x i , x j ) η , and D η ( x i ) ω , then sample x j is directly-reachable by the density of x i , where x i B o u n d a r y D o m a i n , x j ( D B o u n d a r y ) . Here, D represents the set of majority class samples, d i s t ( x i , x j ) represents the distance between samples x i and x j , η represents the maximum distance that x i can reach, D η ( x i ) represents a set of majority samples whose distance from sample x i is less than or equal to η , and D η ( x i ) represents the total number of sets. ω represents the minimum number of sets whose distances between the samples in the set and sample x i are less than or equal to η ;
-
Density-reachability: For samples x j and x i , if there are sample sequences p 1 , p 2 , , p n where p 1 = x j , p n = x i , and p i + 1 is directly density-reachable by p i , then it is said that x i is density-reachable by x j .

3.1.3. Density Domain

This is a set consisting of the majority class samples around the boundary domain and the minority class samples in the original dataset. More specifically,
D e n s i t y D o m a i n = D Z
In Equation (2), D represents the minority class set, and Z represents all sample sets whose density can be reached by the boundary domain samples. Therefore, Z can be defined by Equation (3), where D is the set of majority class samples.
Z = { x j x j is density - reachable by x i , x j ( D B o u n d a r y D o m a i n ) , x i B o u n d a r y D o m a i n }
Figure 2 shows an example of direct density-reachability and density-reachability.
The most notable aspect of the proposed approach is the integration of oversampling and undersampling. However, the distinction between the process of DBRF and undersampling and oversampling is that DBRF uses the characteristics of ensemble learning to improve the results at the algorithmic model level, rather than at the data processing level.

3.2. DBRF Algorithm

An overview of the entire DBRF procedure is shown in Figure 3, divided into four steps: data splitting, boundary domain construction, density domain construction, and model merging.The details of the algorithm are presented in Algorithm 1.
For data splitting, the original dataset was divided into majority and minority sets. The details of the algorithm are presented in Algorithm 2. The boundary domain construction first counts m , which is the number of majority classes in m neighbors of a single minority sample in the original dataset. Then, if m 2 m < m , the sample is added to the boundary domain. This is shown by the gray triangles in Figure 1. The details of the algorithm are presented in Algorithm  3.
Density domain construction determines the majority class samples based on the distribution of the boundary minority class samples. DBRF uses the clustering method to identify the boundary samples from boundary minority samples, as is done when solving the clustering problem with the DBSCAN algorithm. Then, it merges them with the minority class D to build the density domain. The green, gray, and red sample points in Figure 1 represent the density domain. The details of the algorithm are presented in Algorithm  4.
Algorithm 1Density-based random forest (DBRF).
Require: 
Training set D = { x 1 , x 2 , , x n } , L a b e l m a j : majority class, L a b e l m i n : minority class, η : domain maximum distance, ω : minimum number of majority class samples in the neighbors, n: number of nearest neighbors, s i z e : total number of trees, p: allocation ratio;
Ensure: 
Merged classifier
1:
D , D = D a t a S p l i t ( D , L a b e l m a j , L a b e l m i n )  ▹ Data splitting
2:
B o u n d a r y = B o u n d a r y C o n s t r u c t i o n ( D , D ) ,  ▹ Boundary domain construction
3:
D e n s i t y = D e n s i t y C o n s t r u c t i o n ( B o u n d a r y , D , η , ω ) ,  ▹ Density domain construction
4:
R F 1 = B u i l d F o r e s t ( D , s i z e × ( 1 p ) ) ,  ▹ Train random forest R F 1 with original data.
5:
R F 2 = B u i l d F o r e s t ( D e n s i t y , s i z e × p ) ,  ▹ Train random forest R F 2 with the density areas.
6:
R F = R F 1 + R F 2 ,  ▹ Merging two random forests
Algorithm 2Data splitting.
Require: 
Training set D = { x 1 , x 2 , , x n } , L a b e l m a j : majority class, L a b e l m i n : minority class
Ensure: 
Majority set D , minority set D
1:
for each x i D  do
2:
    if  l a b e l ( x i ) L a b e l m a j  then
3:
         D = D { x i }
4:
    else
5:
         D = D { x i }
6:
    end if
7:
end for
Algorithm 3Boundary domain construction.
Require: 
Training set D = { x 1 , x 2 , , x n } , minority set D
Ensure: 
Boundary minority sample set B o u n d a r y
1:
B o u n d a r y = { }
2:
for each x i D  do
3:
    Compute the m nearest neighbors of x i from the dataset D;
4:
     m = Number of m nearest neighbors that are majority class samples;
5:
    if  m 2 m < m  then
6:
         B o u n d a r y = B o u n d a r y { x i } ;
7:
    end if
8:
end for
Algorithm 4Density domain construction.
Require: 
Boundary minority sample set B o u n d a r y = { x 1 , x 2 , , x n } , majority set: D , domain maximum distance: η , minimum number of majority class samples in the neighborhood: ω
Ensure: 
Density domain: D e n s i t y
  1:
m e r g e S e t = D B o u n d a r y  ▹ Merge the majority class and boundary
  2:
D e n s i t y = { }
  3:
while B o u n d a r y do
  4:
    Record the current set of unvisited samples: D a t a O l d = m e r g e S e t
  5:
    Randomly select a sample from B o u n d a r y and initialize the Q u e u e
  6:
     m e r g e S e t = m e r g e S e t Q u e u e
  7:
    while  Q u e u e  do
  8:
        Fetch the first sample x i of the Q u e u e
  9:
         D η ( x i ) = the number of samples whose distance from x i is no greater than η in D a t a O l d
10:
        if  D η ( x i ) ω  then
11:
            t e m p = D η ( x i ) m e r g e S e t
12:
            Q u e u e = Q u e u e t e m p
13:
            D e n s i t y = D e n s i t y t e m p
14:
            m e r g e S e t = m e r g e S e t t e m p
15:
        end if
16:
         Q u e u e = Q u e u e { x i }
17:
    end while
18:
     B o u n d a r y = B o u n d a r y ( D e n s i t y B o u n d a r y )
19:
end while
20:
D e n s i t y = D e n s i t y D  ▹ Combine minority class samples with the found majority class samples

4. Experimental Setup and Results’ Analysis

4.1. Experimental Dataset

In this study, imbalanced datasets from different areas were used to evaluate the DBRF algorithm with three categories of data. Dataset (A) contained metal glass, vehicle evaluation, and Haberman’s survival. The metal glass data were obtained from [34]. The vehicle evaluation and Haberman’s survival data were obtained from the UCI open database [35]. Dataset (B) contained a combination of 19 real datasets. Dataset (C) contained 12 synthetic datasets. The 19 real datasets and 12 synthetic datasets were obtained from the Keel database [36].
For Dataset (A), vehicle assessment and Haberman’s survival were classified into two categories. The metal glass data were classified into three categories—crystalline alloy (CRA), ribbon metallic glass (RMG), and bulk metallic glass (BMG)—in a ratio of 6:3:1. BMG has excellent material properties, whereas the others do not, such as wear resistance and high yield strength [34,37,38,39]. Therefore, we focused more on BMGs.
For Dataset (B), each of the 19 real datasets was a two-category dataset, and the imbalance ratio was distributed from 1.82 to 25.58. For each of the datasets, the number of samples ranged from 173 to 5472.
For Dataset (C), the 12 synthetic datasets were divided into three categories: clover, paw, and subclus. To increase the classification difficulty, the degree of confusion in the minority and majority classes in each category was increased by 30%, 50%, and 70%, respectively. Each dataset was a two-category dataset with 800 samples, and the imbalance ratio was 1:7. The detailed information of the datasets is shown in Table 1, including the imbalance ratio, sample size, number of minority classes, dataset names, number of features, and number of majority classes.
The experimental environment was Windows 10, 64 bit edition, with Python 3.7.7, sklearn 0.23.2, pandas 1.0.5, and imblearn 0.7.0.

4.2. Algorithm Evaluation Indicators

The performance metrics compared in this study were principally the overall accuracy rate (accuracy), recall, precision, F1-measure (F1), and G-mean (GM). Ten-fold cross evaluation was performed for each dataset. F1 is based on the harmonic average of recall and precision. GM attempts to maximize the accuracy of each class while maintaining a balance of accuracy. For imbalanced data, it is typically inadvisable to evaluate the performance of classifier models in terms of accuracy. In Equation (8), m represents the total number of categories. F1 and GM are unbiased evaluation indicators for imbalanced classification. In imbalanced classification tasks, F1 and GM can better evaluate model performance compared to accuracy, recall, and precision; therefore, we mainly compared F1 and GM. Table 2 shows the confusion matrix used in the two-class classification in this experiment [40]. True positive (TP) indicates the number of samples in which the original class and predicted class are both minority classes. False positive (FP) indicates the number of samples in which the original class is a majority class, whereas the predicted class is a minority class. True negative (TN) indicates the number of samples in which the original class and the predicted class are both majority classes. False negative (FN) indicates the number of samples in which original class is the minority class, whereas the predicted class is the majority.
A c c u r a c y = T P + T N T P + T N + F P + F N
P r e c i s i o n = T P T P + F P
R e c a l l = T P T P + F N
F 1 = 2 × P r e c i s i o n × R e c a l l P r e c i s i o n + R e c a l l
G M = i = 1 m r e c a l l i m

4.3. Experimental Results and Analysis

4.3.1. Parameter Setting on η and p

We compared the random forest and DBRF algorithms on the metal glass, vehicle evaluation, and Haberman’s survival data. To make the experimental results more comparable, the relevant parameters involved in the models were consistent. The RF model only involves the number of trees s i z e = 100 . The DBRF model involves neighborhood distance η , minimum number of samples in the domain ω = 10 , allocation ratio of trees p, and number of trees s i z e = 100 .
In DBRF, owing to the different datasets, the neighborhood distance η correspondingly differed. First, η was set as the average of the nearest neighbor distances of 20 majority class samples of a certain minority sample. Then, we adjusted the parameter based on η . Figure 4 shows the trend of the density domain as η changes. Figure 4 indicates that as η increases, the majority class samples gradually increased until all the majority class samples were selected. With the increase of the selected majority class samples, the role played by the density domain gradually became smaller, which deviated from our aim in proposing DBRF to improve the prediction of minority classes through additional training boundary samples. Therefore, choosing a suitable η significantly impacts the performance of predictions involving minority classes.
Figure 5 presents the experimental results obtained on the metal glass, vehicle evaluation, and Haberman’s survival data with different values of η . Each point in the figure represents the average value of the ten-fold cross-validation experiments. The experimental results were consistent with our expectations. For example, as η increased, the accuracy gradually increased, whereas F1 and GM gradually decreased. This means that the role of the density domain gradually weakened. When all the samples were included, it was equivalent to training a random forest classifier with the original dataset, nullifying the performance improvement of the proposed approach.
For the metal glass dataset, GM decreased as η increased, whereas F1 and Accuracy increased. The main reason for the growth of F1 is that as the number of majority classes increased, the model’s prediction accuracy gradually increased for the majority class and gradually decreased for the minority class samples. The increase in the majority class compensated for the decreases in the minority class, resulting in an increase in F1 with increasing η .
For the Haberman’s survival dataset, both GM and F1 decreased with increasing η , and accuracy increased with increasing η . The experimental results were consistent with our expectations.
For the vehicle evaluation dataset, accuracy, F1, and GM first decreased and then gradually stabilized as η increased. This shows that η for the vehicle evaluation dataset could only be adjusted to one. When η 2 , the density domain contained all the majority samples. Therefore, there was a sharp drop when η = 1 and η = 2 .
Figure 6 presents the results obtained on the metal glass, vehicle evaluation, and Haberman’s survival datasets with different values of p. It can be observed that the overall accuracy decreased as p increased in Figure 6. Although the recall of the minority class increased with increasing p, the majority class was also miscategorized. Through F1 and GM, the results showed that after p = 0.5 , the performance of the model began to decline, mainly because the prediction accuracy of the majority class began to decline. Therefore, for the metal glass dataset, p was set at 0.4.
In Figure 6, for the vehicle evaluation dataset, it can be observed that DBRF outperformed the base model RF for F1 and GM. The reason that DBRF was higher in F1, GM, and accuracy than those of RF was mainly that the TP of the other two models was very low, while DBRF compensated for the drop in FP due to the increase in TP. Therefore, the F1 and GM of DBRF were higher than those of RF. Therefore, the best p value for the vehicle evaluation dataset was 0.5.
In Figure 6, for the Haberman’s survival dataset, it can be seen that the F1 and GM of DBRF were higher than those of RF. To avoid losing too much overall accuracy, we set p = 0.6 . When p = 0.6 , the F1 and GM of the DBRF were improved, and the overall accuracy loss was less.
Figure 7 shows a box plot of the 10-fold cross-validation on the three datasets with the best p and η . Figure 7 indicates that the maximum value of DBRF was larger than that of the base algorithm RF, and the minimum value was larger than that of RF. In addition, the distribution of the 10 experimental results revealed that DBRF was relatively stable.

4.3.2. Performance on Public Imbalanced Datasets

In this experiment, we first compared random forest with DBRF and then the random forest combined with oversampling methods through the remaining 19 datasets and 12 synthetic datasets. The oversampling methods included SMOTE, borderline SMOTE, and ADASYN. The comparison experiment was conducted to evaluate whether DBRF is effective at handling imbalanced datasets.
In Table 3, (A) shows the F1 and GM results for metal glass, vehicle evaluation, and Haberman’s survival. Figure 8 shows the averaging confusion matrices of metal glass. In Figure 8, DBRF exhibited better prediction accuracy for BMG than RF. Compared to other algorithms, DBRF was less competitive, but had better performance on F1 and GM. Figure 9 shows the averaging AUC curve and ROC of metal glass. DBRF had good performance on the AUC and ROC curve compared with the other algorithms.
In Table 3, (B) shows the F1 and GM results for the 19 public imbalanced datasets. DBRF improved F1 by 2–5% compared with the other models. DBRF was more competitive than the other models in most imbalanced datasets. ADASYN + RF, RF, b-SMOTE + RF, and ADASYN + RF were more competitive than DBRF on glasses1, dermatology, page-blocks0, Vehicle0, Vehicle1, and Vehicle2. DBRF improved the GM by 2–6% compared with the other models. Specifically, DBRF was more competitive than RF on the 19 public imbalanced datasets. SMOTE + RF, b-SMOTE + RF, and ADASYN + RF outperformed DBRF on glassed1, car-good, car-vgood, page-blocks0, Vehicle0, Vehicle1, and Vehicle2.
In Table 3, (C) shows the average value of 12 synthetic datasets after 10-fold cross-validation. Among all 12 datasets, the difficulty increased with the number of interference samples. For example, in Paw0, the boundary between the minority class and the majority class was clear, and F1 and GM were generally high. However, in the Paw70 dataset, the boundary was unclear. As the number of interference samples increased, F1 and GM began to decline, indicating that the decision boundary between the minority class and the majority class began to become difficult to distinguish. For F1 and GM, DBRF was best on most datasets. In particular, DBRF was more competitive than RF on GM. This indicates that our proposed model can achieve an improvement in the minority class prediction accuracy over prior methods while remaining relatively stable even when the decision boundary is very difficult to distinguish.
Table 4 shows the average time during training for RF, DBRF, SMOTE + RF, b-SMOTE + RF, and ADASYN + RF. As the number of features and samples in the dataset increased, DBRF took more time to train the model than other algorithms. In particular, DBRF took twice the time of RF on the metal glass and page-blocks0 datasets.
We used the Wilcoxon signed rank test, which is a non-parametric test, to statistically analyze the results of the experiments on 34 datasets. The function of the Wilcoxon signed-rank test is to determine whether the corresponding overall distribution of the data is the same without assuming that the data obey a normal distribution. In this test, the confidence interval was set at 0.05. When the test yields a p-value significantly less than 0.05, the two methods are significantly different. From Table 5, it can be seen that the p-values for DBRF versus RF, SMOTE + RF, b-SMOTE + RF, and ADASYN + RF were all less than 0.05. This suggests that the differences between them were significant. It also indicates that DBRF was more competitive than the other models in handling imbalanced data.

5. Discussion

Despite its performance, DBRF has the following limitations:
(1)
Parameter setting problem. DBRF has two parameters, η and p. Figure 4, Figure 5 and Figure 6 show that different parameters need to be set for different datasets. If η is too large, the density domain will have all samples in the dataset. This results in the failure of DBRF to classify the minority class. Choosing which parameters to use to train the model requires some tuning experience;
(2)
Questions about datasets. For this question, there are two main problems: (a) Time-consuming problem. DBRF can effectively train large datasets, but it takes much time in the training process. Metal glass is a dataset with 98 features and 5936 samples. It is the largest of the 34 datasets. According to the experimental results in Table 2, DBRF took more time to train on it than other algorithms. Therefore, for large datasets with high-dimensional features, the training time of DBRF will obviously become long; (b) The number of minority class samples problem. DBRF will be ineffective if the dataset has few minority class samples. Owing to the excessively scattered distribution of minority class samples, they will be deleted as noise samples when DBRF constructs the boundary domain. This will lead to an inability to build the density domain. Our proposed method will not work;
(3)
The problem of unclear decision boundaries between minority classes. DBRF cannot solve this problem. DBRF can just deal with the problem of the unclear decision boundary between majority samples and minority samples. This is because DBRF takes one class from the minority class group separately as the only minority class for density domain construction.

6. Conclusions and Future Work

We proposed a density-based random forest algorithm (DBRF) to improve the prediction performance, especially for minority classes. We aimed to improve the original random forest algorithm in a way that enhances its performance on imbalanced sets. To achieve this aim, we proposed to borrow some ideas from the DBSCAN algorithm. In particular, we took into account the density of objects in space to improve the prediction performance, especially for minority classes. At the same time, we considered already known approaches for the development of classifiers for imbalanced datasets, including the SMOTE algorithm. DBRF was designed to recognize boundary objects, and it uses a density-based method to recognize them. Two different random forest classifiers were constructed to model the augmented boundary objects and the original dataset dependently, and the final output was determined using a bagging technique. Table 3 shows the average of 34 public imbalanced datasets. Our proposed method (DBRF) was the best among the five algorithms. On F1, DBRF improved classification by 1.7–2.5% on average. On GM, DBRF there was an improvement of approximately 1–2.5% on average. The experimental results proved the ability of the proposed algorithm (DBRF) to solve the problem of classifying objects located on the class boundary, including objects of minority classes, by taking into account the density of objects in space (as is done when solving the clustering problem with the DBSCAN algorithm).
Several directions deserve further study in the future. First, in imbalanced data processing, the imbalance is caused by a variety of factors. To address this problem, the integration of domain knowledge into the classification models is very important. Second, we used a random forest classifier as the basic model, which suggests that our density-based method may also be effective for other models, such as XGBoost, LightGBM, and neural networks. Finally, data labeling is time-consuming; thus, methods to utilize the unlabeled data in imbalanced data classification also constitute an interesting potential avenue for future research.

Author Contributions

Conceptualization, Q.Q.; Data curation, J.D.; Software, J.D.; Supervision, Q.Q.; Writing—original draft, J.D.; Writing—review & editing, Q.Q. All authors have read and agreed to the published version of the manuscript.

Funding

This work was sponsored by the National Key Research and Development Program of China (Grant No. 2018YFB0704400), the Key Program of Science and Technology of Yunnan Province (No. 202102AB080019-3, 202002AB080001-2), the Key Research Project of Zhejiang Laboratory (No. 2021PE0AC02), and the Key Project of Shanghai Zhangjiang National Independent Innovation Demonstration Zone (No. ZJ2021-ZD-006).

Data Availability Statement

All the datasets and source code that support the experimental findings can be accessed at: https://github.com/qq-shu/DBRF (accessed on 8 May 2021).

Acknowledgments

The authors gratefully appreciate the anonymous Reviewers for their valuable comments.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Zhang, J.; Cao, P.; Gross, D.P.; Zaiane, O.R. On the application of multi-class classification in physical therapy recommendation. Health Sci. Syst. 2013, 1, 15. [Google Scholar] [CrossRef] [Green Version]
  2. Zhang, Y.; Zhang, H.; Zhang, X.; Qi, D. Deep learning intrusion detection model based on optimized imbalanced network data. In Proceedings of the 2018 IEEE 18th International Conference on Communication Technology (ICCT), Chongqing, China, 8–11 October 2018. [Google Scholar]
  3. Bian, Y.; Cheng, M.; Yang, C.; Yuan, Y.; Li, Q.; Zhao, J.L.; Liang, L. Financial fraud detection: A new ensemble learning approach for imbalanced data. In Proceedings of the 20th Pacific Asia Conference on Information Systems (PACIS 2016), Chiayi, Taiwan, 27 June–1 July 2016; p. 315. [Google Scholar]
  4. Plant, C.; Böhm, C.; Tilg, B.; Baumgartner, C. Enhancing instance-based classification with local density: A new algorithm for classifying unbalanced biomedical data. Bioinformatics 2006, 22, 981–988. [Google Scholar] [CrossRef] [Green Version]
  5. Yap, B.W.; Rani, K.A.; Rahman, H.A.A.; Fong, S.; Khairudin, Z.; Abdullah, N.N. An application of oversampling, undersampling, bagging and boosting in handling imbalanced datasets. In Proceedings of the First International Conference on Advanced Data and Information Engineering (DaEng-2013), Kuala Lumpur, Malaysia, 16–18 December 2013; Springer: Berlin/Heidelberg, Germany, 2014; pp. 13–22. [Google Scholar]
  6. Chawla, N.V.; Bowyer, K.W.; Hall, L.O.; Kegelmeyer, W.P. Smote: Synthetic minority over-sampling technique. J. Artif. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef]
  7. Bunkhumpornpat, C.; Sinapiromsaran, K.; Lursinsap, C. Dbsmote: Density-based synthetic minority over-sampling technique. Appl. Intell. 2012, 36, 664–684. [Google Scholar] [CrossRef]
  8. Ma, L.; Fan, S. Cure-smote algorithm and hybrid algorithm for feature selection and parameter optimization based on random forests. BMC Bioinform. 2017, 18, 169. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  9. Gao, M.; Aiqiang, X.U.; Qing, X.U. Fault detection method of electronic equipment based on sl-smote and cs-rvm. Comput. Eng. Appl. 2019, 55, 185–192. [Google Scholar]
  10. Han, H.; Wang, W.-Y.; Mao, B.-H. Borderline-smote: A new over-sampling method in imbalanced datasets learning. In Proceedings of the International Conference on Intelligent Computing, Hefei, China, 23–26 August 2005; Springer: Berlin/Heidelberg, Germany, 2005; pp. 878–887. [Google Scholar]
  11. He, H.; Bai, Y.; Garcia, E.A.; Li, S. Adasyn: Adaptive synthetic sampling approach for imbalanced learning. In Proceedings of the 2008 IEEE International Joint Conference on Neural Networks (IEEE World Congress on Computational Intelligence), Hong Kong, 1–8 June 2008; pp. 322–1328. [Google Scholar]
  12. Batista, G.E.; Prati, R.C.; Monard, M.C. A study of the behavior of several methods for balancing machine learning training data. ACM Sigkdd Explor. Newsl. 2004, 6, 20–29. [Google Scholar] [CrossRef]
  13. Tomek, I. Two modifications of cnn. IEEE Trans. Syst. Man Cybern. 1976, SMC-6, 769–772. [Google Scholar]
  14. Kubat, M.; Matwin, S. Addressing the curse of imbalanced training sets: One-sided selection. Icml 1997, 97, 179–186. [Google Scholar]
  15. Wilson, D.L. Asymptotic properties of nearest neighbor rules using edited data. IEEE Trans. Syst. Man Cybern. 1972, SMC-2, 408–421. [Google Scholar] [CrossRef] [Green Version]
  16. Laurikkala, J. Improving identification of difficult small classes by balancing class distribution. In Proceedings of the Conference on Artificial Intelligence in Medicine in Europe, Cascais, Portugal, 1–4 July 2001; Springer: Berlin/Heidelberg, Germany, 2001; pp. 63–66. [Google Scholar]
  17. Zhou, Z.-H.; Liu, X.-Y. Training cost-sensitive neural networks with methods addressing the class imbalance problem. IEEE Trans. Knowl. Data Eng. 2005, 18, 63–77. [Google Scholar] [CrossRef]
  18. Zhou, Z.-H. Ensemble Learning: Foundations and Algorithms; Electronic Industry Press: Beijing, China, 2020. [Google Scholar]
  19. Raskutti, B.; Kowalczyk, A. Extreme re-balancing for svms: A case study. ACM Sigkdd Explor. Newsl. 2004, 6, 60–69. [Google Scholar] [CrossRef]
  20. Chawla, N.V.; Lazarevic, A.; Hall, L.O.; Bowyer, K.W. Smoteboost: Improving prediction of the minority class in boosting. In Proceedings of the European Conference on Principles of Data Mining and Knowledge Discovery, Antwerp, Belgium, 15–19 September 2003; Springer: Berlin/Heidelberg, Germany, 2003; pp. 107–119. [Google Scholar]
  21. Freund, Y.; Schapire, R.E. A decision-theoretic generalization of on-line learning and an application to boosting. J. Ournal Comput. And Syst. Sci. 1997, 55, 119–139. [Google Scholar] [CrossRef] [Green Version]
  22. Chen, Z.; Duan, J.; Kang, L.; Qiu, G.-Q. A hybrid data-level ensemble to enable learning from highly imbalanced dataset. Inf. Sci. 2021, 554, 157–176. [Google Scholar] [CrossRef]
  23. Fan, W.; Stolfo, S.J.; Zhang, J.; Chan, P.K. Adacost: Misclassification cost-sensitive boosting. Icml 1999, 99, 97–105. [Google Scholar]
  24. Schapire, R.E.; Freund, Y. Boosting: Foundations and algorithms. Kybernetes 2013, 42, 164–166. [Google Scholar] [CrossRef]
  25. Chen, C.; Breiman, L. Using Random Forest to Learn Imbalanced Data; University of California: Berkeley, CA, USA, 2004. [Google Scholar]
  26. Choudhary, R.; Shukla, S. A clustering based ensemble of weighted kernelized extreme learning machine for class imbalance learning. Expert Syst. Appl. 2021, 164, 114041. [Google Scholar] [CrossRef]
  27. Bader-El-Den, M.; Teitei, E.; Perry, T. Biased random forest for dealing with the class imbalance problem. IEEE Trans. Neural Netw. Learn. Syst. 2018, 30, 2163–2172. [Google Scholar] [CrossRef] [Green Version]
  28. Li, Y.-S.; Chi, H.; Shao, X.-Y.; Qi, M.-L.; Xu, B.-G. A novel random forest approach for imbalance problem in crime linkage. Knowl.-Based Syst. 2020, 195, 105738. [Google Scholar] [CrossRef]
  29. Oyewola, D.O.; Dada, E.G.; Misra, S.; Damaeviius, R. Detecting cassava mosaic disease using a deep residual convolutional neural network with distinct block processing. PeerJ Comput. Sci. 2021, 7, E352. [Google Scholar] [CrossRef]
  30. Hemalatha, J.; Roseline, S.A.; Geetha, S.; Kadry, S.; Damaeviius, R. An Efficient DenseNet-Based Deep Learning Model for Malware Detection. Entropy 2021, 23, 344. [Google Scholar] [CrossRef] [PubMed]
  31. Alli, O.O.A.; Damaeviius, R.; Misra, S.; Rytis, M.; Alli, A.A. Malignant skin melanoma detection using image augmentation by oversampling in nonlinear lower-dimensional embedding manifold. Turk. J. Electr. Eng. Comput. Sci. 2021, 2021, 2600–2614. [Google Scholar] [CrossRef]
  32. Nasir, I.M.; Khan, M.A.; Yasmin, M.; Shah, J.H.; Damasevicius, R. Pearson Correlation-Based Feature Selection for Document Classification Using Balanced Training. Sensors 2020, 20, 6793. [Google Scholar] [CrossRef] [PubMed]
  33. Ester, M.; Kriegel, H.-P.; Sander, J.; Xu, X. A density-based algorithm for discovering clusters in large spatial databases with noise. Kdd 1996, 96, 226–231. [Google Scholar]
  34. Zhang, L.; Huang, H. Micro machining of bulk metallic glasses: A review. Int. J. Adv. Manuf. Technol. 2018, 100, 637–661. [Google Scholar] [CrossRef]
  35. Dua, D.; Graff, C. UCI Machine Learning Repository. 2017. Available online: http://archive.ics.uci.edu/ml (accessed on 8 May 2012).
  36. Alcalá-Fdez, J.; Fernandez, A.; Luengo, J.; Derrac, J.; García, S.; Sánchez, L.; Herrera, F. Keel data-mining software tool: Data set repository, integration of algorithms and experimental analysis framework. Crit. Rev. Solid State Mater. Sci. 2011, 17, 255–287. [Google Scholar]
  37. Mehdi, J.Z.; Gideon, P.K.; Paulo, B.; Mohsen, S.; John, L.; Cui, F. A critical review on metallic glasses as structural materials for cardiovascular stent applications. J. Funct. Biomater. 2018, 9, 19. [Google Scholar]
  38. Khan, M.M.; Nemati, A.; Rahman, Z.U.; Shah, U.H.; Asgar, H.; Haider, W. Recent advancements in bulk metallic glasses and their applications: A review. Crit. Rev. Solid State Mater. Sci. 2018, 43, 233–268. [Google Scholar] [CrossRef]
  39. Nair, B.; Priyadarshini, B.G. Process, structure, property and applications of metallic glasses. AIMS Mater. Sci. 2016, 3, 1022–1053. [Google Scholar] [CrossRef]
  40. Zhou, Z.-H. Machine Learning; Tsinghua University Press: Beijing, China, 2016. [Google Scholar]
Figure 1. Illustrative diagram of the process for determining boundary samples. Here, the triangles represent the minority class samples and the circles represent the majority class samples. The blue circles are the majority class with a clear decision boundary, and the red triangles are the minority class with a clear decision boundary. The gray triangles indicate the boundary minority samples, i.e., the boundary domain. The green circles indicate the boundary majority class samples. The red triangles, gray triangles, and green circles constitute the overall density domain.
Figure 1. Illustrative diagram of the process for determining boundary samples. Here, the triangles represent the minority class samples and the circles represent the majority class samples. The blue circles are the majority class with a clear decision boundary, and the red triangles are the minority class with a clear decision boundary. The gray triangles indicate the boundary minority samples, i.e., the boundary domain. The green circles indicate the boundary majority class samples. The red triangles, gray triangles, and green circles constitute the overall density domain.
Futureinternet 14 00090 g001
Figure 2. Example of direct density-reachability and density-reachability, supposing ω = 4 . The dotted line indicates the maximum distance from the sample. “▲” is the sample in the boundary domain, and the “circle shape” is the majority class. q 2 is directly density-reachable by q 1 , and q 3 is density-reachable by q 1 .
Figure 2. Example of direct density-reachability and density-reachability, supposing ω = 4 . The dotted line indicates the maximum distance from the sample. “▲” is the sample in the boundary domain, and the “circle shape” is the majority class. q 2 is directly density-reachable by q 1 , and q 3 is density-reachable by q 1 .
Futureinternet 14 00090 g002
Figure 3. Framework of the density-based random forest (DBRF) algorithm.
Figure 3. Framework of the density-based random forest (DBRF) algorithm.
Futureinternet 14 00090 g003
Figure 4. Data visual distribution for synthetic dataset paw50 with different η . Here, (a) is the original dataset; the red point is the minority class, and the blue point is the majority class. In (bf), the red and gray points are the minority class samples in the entire dataset, whereas the green and blue points are the majority class samples in the entire dataset. The red points show the boundary domain. The gray points show the minority class with a clear decision boundary. The green points show the majority class selected by the DBRF algorithm. The green, red, and gray points form the density domain.
Figure 4. Data visual distribution for synthetic dataset paw50 with different η . Here, (a) is the original dataset; the red point is the minority class, and the blue point is the majority class. In (bf), the red and gray points are the minority class samples in the entire dataset, whereas the green and blue points are the majority class samples in the entire dataset. The red points show the boundary domain. The gray points show the minority class with a clear decision boundary. The green points show the majority class selected by the DBRF algorithm. The green, red, and gray points form the density domain.
Futureinternet 14 00090 g004
Figure 5. Three real-world datasets on (a) the metal glass, (b) Haberman’s survival, and (c) vehicle evaluation with different η . The horizontal axis is the η , and the vertical axis shows the F1, GM, and accuracy.
Figure 5. Three real-world datasets on (a) the metal glass, (b) Haberman’s survival, and (c) vehicle evaluation with different η . The horizontal axis is the η , and the vertical axis shows the F1, GM, and accuracy.
Futureinternet 14 00090 g005
Figure 6. Three real-world datasets on the (a) metal glass, (b) vehicle evaluation, and (c) Haberman’s survival with different p. F1 focused on the minority class: comparisons with different p. The horizontal axis is p, and the vertical axis is accuracy, F1, and GM in the different sub-figures. For metal glass, η = 80 ; for Haberman’s survival, η = 2 ; for vehicle evaluation, η = 1 .
Figure 6. Three real-world datasets on the (a) metal glass, (b) vehicle evaluation, and (c) Haberman’s survival with different p. F1 focused on the minority class: comparisons with different p. The horizontal axis is p, and the vertical axis is accuracy, F1, and GM in the different sub-figures. For metal glass, η = 80 ; for Haberman’s survival, η = 2 ; for vehicle evaluation, η = 1 .
Futureinternet 14 00090 g006
Figure 7. Box plot of 10-fold cross-validation on the on the (a) metal glass, (b) vehicle evaluation, and (c) Harberman’s suvival with the best p and η .
Figure 7. Box plot of 10-fold cross-validation on the on the (a) metal glass, (b) vehicle evaluation, and (c) Harberman’s suvival with the best p and η .
Futureinternet 14 00090 g007
Figure 8. Averaging confusion matrices of (a) RF; (b) DBRF; (c) SMOTE + RF; (d) bSMOTE + RF; (e) ADASYN + RF. “BMG” is the minority class.
Figure 8. Averaging confusion matrices of (a) RF; (b) DBRF; (c) SMOTE + RF; (d) bSMOTE + RF; (e) ADASYN + RF. “BMG” is the minority class.
Futureinternet 14 00090 g008
Figure 9. Averaging AUC curve and ROC of metal glass.
Figure 9. Averaging AUC curve and ROC of metal glass.
Futureinternet 14 00090 g009
Table 1. Detailed description of the three experimental datasets.
Table 1. Detailed description of the three experimental datasets.
Dataset NameSample SizeFeature NumberMajority Class NumberMinority Class NumberImbalance Ratio
AMetal glass59369837086755.493
Vehicle evaluation1728612105182.3359
Haberman survival3064225812.7778
Bglasses02149144702.06
glasses12149138761.82
glasses52149205922.81
Ecoli13367259773.36
Ecoli23367284525.46
Ecoli33367301358.19
Ecoli0-12447220249.17
car-good1728616596924
car-vgood1728616636525.58
cleveland173131601312,62
dermatology358343382016.9
page-blocks054721049135598.77
Vehicle0846186471993.23
Vehicle1846186292172.52
Vehicle2846186282182.52
Vehicle3846186342122.52
Wisconsin68394442391.86
Yeast11484810554292.46
Connectionist Bench990139009010
CClover080027001007
Clover3080027001007
Clover5080027001007
Clover7080027001007
Subclus080027001007
Subclus3080027001007
Subclus5080027001007
Subclus7080027001007
Paw080027001007
Paw3080027001007
Paw5080027001007
Paw7080027001007
Table 2. Confusion matrix.
Table 2. Confusion matrix.
Predict
Minority ClassMajority Class
ActualMinority classTPFN
Majority classFPTN
Table 3. Comparison of random forest, SMOTE + RF, b-SMOTE + RF, ADASYN + RF, and DBRF on three dataset categories. The bold results in the table are optimal after 10-fold cross-validation. DBRF’s parameter values are s i z e = 100 , ω = 10 , p = 0.4–0.6, and η = 0.5–50. RF denotes random forest. SMOTE + RF signifies that each dataset was balanced with SMOTE, then classified with RF. b-SMOTE + RF signifies that each dataset was balanced with borderline SMOTE, then classified with RF. ADASYN + RF signifies that each dataset was balanced with ADASYN, then classified with RF.
Table 3. Comparison of random forest, SMOTE + RF, b-SMOTE + RF, ADASYN + RF, and DBRF on three dataset categories. The bold results in the table are optimal after 10-fold cross-validation. DBRF’s parameter values are s i z e = 100 , ω = 10 , p = 0.4–0.6, and η = 0.5–50. RF denotes random forest. SMOTE + RF signifies that each dataset was balanced with SMOTE, then classified with RF. b-SMOTE + RF signifies that each dataset was balanced with borderline SMOTE, then classified with RF. ADASYN + RF signifies that each dataset was balanced with ADASYN, then classified with RF.
DatasetRFDBRFSMOTE + RFb-SMOTE + RFADASYN + RF
F1GMF1GMF1GMF1GMF1GM
Ametal glass0.889 ± 0.010.871 ± 0.020.894 ± 0.010.892 ± 0.020.858 ± 0.010.879 ± 0.010.857 ± 0.020.877 ± 0.010.838 ± 0.010.879 ± 0.02
vehicle evaluation0.824 ± 0.030.826 ± 0.030.875 ± 0.020.910 ± 0.020.862 ± 0.030.887 ± 0.030.865 ± 0.030.890 ± 0.030.865 ± 0.020.895 ± 0.02
Haberman’s survival0.541 ± 0.080.435 ± 0.170.603 ± 0.080.615 ± 0.070.533 ± 0.070.526 ± 0.080.524 ± 0.070.512 ± 0.10.551 ± 0.090.558 ± 0.11
Bglasses00.830 ± 0.110.812 ± 0.140.858 ± 0.10.854 ± 0.110.835 ± 0.10.838 ± 0.110.823 ± 0.10.833 ± 0.10.831 ± 0.10.850 ± 0.09
glasses10.839 ± 0.080.825 ± 0.090.818 ± 0.090.819 ± 0.090.821 ± 0.060.819 ± 0.070.848 ± 0.070.845 ± 0.080.845 ± 0.080.850 ± 0.08
glasses50.651 ± 0.220.340 ± 0.450.737 ± 0.260.497 ± 0.520.693 ± 0.220.421 ± 0.460.692 ± 0.220.421 ± 0.460.693 ± 0.220.426 ± 0.47
Ecoli10.843 ± 0.070.844 ± 0.100.870 ± 0.050.910 ± 0.050.862 ± 0.070.889 ± 0.060.869 ± 0.060.901 ± 0.060.849 ± 0.060.853 ± 0.08
Ecoli20.874 ± 0.080.826 ± 0.120.891 ± 0.090.891 ± 0.120.878 ± 0.090.863 ± 0.120.868 ± 0.090.833 ± 0.110.839 ± 0.080.844 ± 0.12
Ecoli30.745 ± 0.170.593 ± 0.340.805 ± 0.140.808 ± 0.280.803 ± 0.140.801 ± 0.280.765 ± 0.170.623 ± 0.340.763 ± 0.120.793 ± 0.29
Ecoli0-10.816 ± 0.130.775 ± 0.280.853 ± 0.150.783 ± 0.290.837 ± 0.140.824 ± 0.290.827 ± 0.140.809 ± 0.290.829 ± 0.140.822 ± 0.29
car-good0.921 ± 0.060.861 ± 0.090.946 ± 0.040.903 ± 0.070.910 ± 0.040.991 ± 00.927 ± 0.040.993 ± 00.917 ± 0.030.992 ± 0
car-vgood0.966 ± 0.040.94 ± 0.070.974 ± 0.030.970 ± 0.040.949 ± 0.050.996 ± 0.010.948 ± 0.060.996 ± 0.010.963 ± 0.050.997 ± 0
cleveland0.565 ± 0.180.171 ± 0.350.749 ± 0.220.523 ± 0.440.697 ± 0.210.423 ± 0.430.697 ± 0.210.423 ± 0.430.628 ± 0.180.299 ± 0.38
dermatology0.550 ± 0.140.141 ± 0.30.724 ± 0.180.608 ± 0.430.749 ± 0.230.523 ± 0.460.731 ± 0.220.520 ± 0.460.739 ± 0.230.521 ± 0.46
page-blocks00.936 ± 0.020.930 ± 0.020.932 ± 0.020.939 ± 0.020.927 ± 0.020.956 ± 0.020.925 ± 0.020.957 ± 0.020.910 ± 0.020.960 ± 0.01
Vehicle00.965 ± 0.020.966 ± 0.020.961 ± 0.020.960 ± 0.020.945 ± 0.030.962 ± 0.030.950 ± 0.020.965 ± 0.030.950 ± 0.020.969 ± 0.02
Vehicle10.704 ± 0.050.661 ± 0.060.721 ± 0.030.736 ± 0.040.743 ± 0.030.773 ± 0.040.743 ± 0.030.775 ± 0.040.760 ± 0.030.796 ± 0.03
Vehicle20.982 ± 0.020.977 ± 0.030.980 ± 0.020.976 ± 0.030.982 ± 0.010.984 ± 0.020.983 ± 0.010.985 ± 0.010.983 ± 0.010.984 ± 0.02
Vehicle30.684 ± 0.080.609 ± 0.110.723 ± 0.050.749 ± 0.070.672 ± 0.060.621 ± 0.090.716 ± 0.050.737 ± 0.060.719 ± 0.050.749 ± 0.07
Wisconsin0.971 ± 0.020.973 ± 0.020.972 ± 0.020.978 ± 0.020.966 ± 0.020.970 ± 0.020.963 ± 0.020.969 ± 0.020.966 ± 0.020.972 ± 0.02
Yeast10.709 ± 0.050.664 ± 0.070.718 ± 0.040.727 ± 0.050.717 ± 0.050.727 ± 0.060.717 ± 0.040.689 ± 0.050.706 ± 0.030.721 ± 0.04
Connectionist Bench0.982 ± 0.030.971 ± 0.050.990 ± 0.020.993 ± 0.020.987 ± 0.020.987 ± 0.020.965 ± 0.030.989 ± 0.020.989 ± 0.020.987 ± 0.03
C03subcl00.907 ± 0.040.901 ± 0.060.824 ± 0.070.941 ± 0.020.824 ± 0.060.930 ± 0.040.824 ± 0.060.930 ± 0.040.822 ± 0.060.924 ± 0.04
03subcl300.747 ± 0.140.645 ± 0.270.683 ± 0.060.828 ± 0.040.700 ± 0.070.822 ± 0.070.701 ± 0.060.823 ± 0.070.675 ± 0.070.812 ± 0.06
03subcl500.682 ± 0.120.551 ± 0.250.701 ± 0.060.751 ± 0.090.650 ± 0.060.796 ± 0.050.648 ± 0.070.791 ± 0.060.643 ± 0.050.799 ± 0.04
03subcl700.592 ± 0.090.408 ± 0.250.641 ± 0.060.648 ± 0.140.627 ± 0.060.791 ± 0.040.628 ± 0.060.791 ± 0.050.628 ± 0.060.794 ± 0.05
04clover00.878 ± 0.050.859 ± 0.10.741 ± 0.040.886 ± 0.040.710 ± 0.060.863 ± 0.060.712 ± 0.070.864 ± 0.060.706 ± 0.050.862 ± 0.06
04clover300.758 ± 0.080.687 ± 0.130.687 ± 0.070.832 ± 0.080.672 ± 0.050.815 ± 0.080.674 ± 0.060.815 ± 0.080.642 ± 0.040.805 ± 0.06
04clover500.628 ± 0.090.480 ± 0.150.679 ± 0.060.806 ± 0.060.638 ± 0.060.800 ± 0.070.642 ± 0.060.804 ± 0.070.640 ± 0.060.805 ± 0.07
04clover700.594 ± 0.080.421 ± 0.110.656 ± 0.060.761 ± 0.090.646 ± 0.060.799 ± 0.060.632 ± 0.060.781 ± 0.070.615 ± 0.070.776 ± 0.09
paw00.939 ± 0.040.932 ± 0.040.889 ± 0.080.956 ± 0.030.778 ± 0.070.907 ± 0.040.778 ± 0.070.907 ± 0.040.781 ± 0.060.916 ± 0.03
paw300.830 ± 0.060.793 ± 0.10.817 ± 0.040.836 ± 0.070.705 ± 0.060.830 ± 0.060.708 ± 0.050.835 ± 0.050.665 ± 0.050.822 ± 0.04
paw500.757 ± 0.090.693 ± 0.160.743 ± 0.040.832 ± 0.060.669 ± 0.070.814 ± 0.050.673 ± 0.070.817 ± 0.070.652 ± 0.060.820 ± 0.04
paw700.668 ± 0.050.599 ± 0.120.666 ± 0.090.818 ± 0.070.654 ± 0.070.814 ± 0.050.656 ± 0.070.816 ± 0.050.645 ± 0.080.809 ± 0.06
Average0.7870.7040.8040.8200.7790.8110.7790.8080.7720.812
Table 4. Average time spent by the RF, DBRF, SMOTE + RF, b-SMOTE + RF, and ADASYN + RF training datasets. The results are in seconds.
Table 4. Average time spent by the RF, DBRF, SMOTE + RF, b-SMOTE + RF, and ADASYN + RF training datasets. The results are in seconds.
RFDBRFSMOTE + RFb-SMOTE + RFADASYN + RF
Ametal glass3.0388.1904.6724.5724.630
vehicle evaluation0.1400.3740.1590.1620.222
Haberman’s survival0.1200.3790.1270.1260.165
Bglasses00.1200.3800.1310.1310.153
glasses10.1230.4090.1310.1300.148
glasses50.1140.3810.1260.1250.143
Ecoli10.1210.3860.1320.1310.192
Ecoli20.1190.3790.1340.1340.198
Ecoli30.1180.3810.1400.1380.202
Ecoli0-10.1150.3680.1260.1250.164
car-good0.1340.3590.1650.1640.195
car-vgood0.1280.3700.1570.1600.160
cleveland0.1130.3550.1250.1240.183
dermatology0.1170.3570.1280.1260.146
page-blocks00.7341.5840.8990.9070.948
Vehicle00.1490.4780.1810.2260.187
Vehicle10.1760.5050.2060.2480.210
Vehicle20.1760.5050.2060.2480.210
Vehicle30.1760.5400.2050.2550.211
Wisconsin0.1250.4380.1340.1360.164
Yeast10.1850.5440.2140.2800.225
Connectionist Bench0.1650.5310.2150.2350.219
C03subcl00.1630.3530.1450.1450.147
03subcl300.1660.3680.1510.1470.150
03subcl500.1620.3680.1490.1480.148
03subcl700.1660.3710.1480.1470.149
04clover00.1640.3600.1470.1470.148
04clover300.1670.3650.1480.1470.149
04clover500.1660.3660.1510.1500.150
04clover700.1680.3690.1510.1490.150
paw00.1510.3490.1450.1460.146
paw300.1650.3640.1490.1470.148
paw500.1670.3700.1490.1480.149
paw700.1680.3690.1490.1490.151
Table 5. Results of the Wilcoxon signed-rank test for F1 and GM of 34 datasets. W+ represents the positive differential rank sum. W− represents the negative differential rank sum.
Table 5. Results of the Wilcoxon signed-rank test for F1 and GM of 34 datasets. W+ represents the positive differential rank sum. W− represents the negative differential rank sum.
ComparisonW+W−p-ValueHypothesis (0.05)
F1DBRF vs. RF370191 3.89 × 10 4 Rejected
DBRF vs. SMOTE + RF49269 6.64 × 10 7 Rejected
DBRF vs. b-SMOTE+ RF49863 4.62 × 10 7 Rejected
DBRF vs. ADASYN + RF50754 2.65 × 10 7 Rejected
GMDBRF vs. RF5538 1.32 × 10 8 Rejected
DBRF vs. SMOTE + RF351210 8.81 × 10 4 Rejected
DBRF vs. b-SMOTE+ RF343218 1.23 × 10 3 Rejected
DBRF vs. ADASYN + RF331230 1.98 × 10 3 Rejected
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Dong, J.; Qian, Q. A Density-Based Random Forest for Imbalanced Data Classification. Future Internet 2022, 14, 90. https://doi.org/10.3390/fi14030090

AMA Style

Dong J, Qian Q. A Density-Based Random Forest for Imbalanced Data Classification. Future Internet. 2022; 14(3):90. https://doi.org/10.3390/fi14030090

Chicago/Turabian Style

Dong, Jia, and Quan Qian. 2022. "A Density-Based Random Forest for Imbalanced Data Classification" Future Internet 14, no. 3: 90. https://doi.org/10.3390/fi14030090

APA Style

Dong, J., & Qian, Q. (2022). A Density-Based Random Forest for Imbalanced Data Classification. Future Internet, 14(3), 90. https://doi.org/10.3390/fi14030090

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop