# Class-Level Refactoring Prediction by Ensemble Learning with Various Feature Selection Techniques
## 3 Research Methodology
### System Model
#### 3.1.3 Sampling  
We have used a publicly accessible dataset from the tera-PROMISE repository for our investigations. A well-known repository for software engineering research datasets on code analysis, errors, effort, refactoring, and test creation is the tera-PROMISE website [52]. To make our studies simple to reproduce and use by other researchers for benchmarking and comparison, we have used a dataset from the tera-PROMISE repository. In this work, we are implementing data sampling techniques on four projects. The data set shown in Table 1 is highly imbalanced because the refactored number of samples is different from the non-refactored samples. The implemented projects are, i.e., Antlr4, Junit, Met, and Titan, having 408, 655, 2028, and 1158 classes. Considering data imbalance problems in data learning and classification, we used three data sampling methods: random sampling, upsampling, and downsampling. Our proposed method incorporates different sampling methods that ensure data augmentation so that it encompasses major possible features or information for further computation. Noticeably, the considered refactoring dataset contains many samples for each feature characterizing software structure and eventual refactoring probability. For illustration, let the total sample be 100. Then, in the random sampling method, five data samples are selected randomly (assuming that each element would have an equal probability of being identified as a refactoring class) from the total samples. In contrast, merely five samples from ninety-five non-refactoring samples are considered in downsampling. On the contrary, to perform upsampling, a small data element (say five) is extrapolated or augmented into the large scale (say, ninety-five to constitute one-hundred samples) non-refactoring data samples. Thus, the inclusion of randomly selected X\({}_{\text{Rand}}\), upsampled (X\({}_{\text{Upsampled}}\)), and downsampled data (X\({}_{\text{Downsampled}}\)) along with the original data (X\({}_{\text{Original}}\)). They constituted augmented data for further computation shown in Equation (3). \[\text{Feat}_{\text{Composite}}=\left[\text{X}_{\text{Original}},\text{X}_{ \text{Rand}},\text{X}_{\text{Upsampled}},\text{X}_{\text{Downsampled}}\right] \tag{3}\]  
In enormous classification or prediction systems, extensive features-based models, data imbalance impacts system performance. The considered data set may comprise minor features indicating refactoring probability, which might generate classification bias and impair overall prediction accuracy; for example, let the dataset have one-hundred elements, out of which merely between four and five data elements signify the refactoring tract. Therefore, learning the data might cause or influence overall performance, especially classification accuracy. A dual-phase data augmentation method was incorporated into the proposed model by executing data normalization followed by data re(sampling) to alleviate these problems. We applied the Min-Max normalization method, while for data resampling, three methods, random sampling, downsampling, and upsampling, have been applied. A brief of these methods is given as follows:  
Data items can be of varying sizes and ranges; hence, computing over such unstructured and broad-scaled data can cause learning models to converge prematurely. As a result, it can impact the overall precision of the suggested model. We have normalized the data using the Min-Max technique in light of this data imbalance issue. Our suggested Min-Max normalization model normalizes input data from a functional standpoint in the 0 to 1 range. Our suggested normalization approach maps and linearly transforms the input data items inside the interval \([0,1]\). Each data element x\({}_{i}\) of the software component X is functionally mapped to its corresponding normalized value \(x_{i}\) in the range [0, 1]. Mathematically, we estimated the normalized value(s) of the input data \(x_{i}\) using the formula of Equation (4).