# Class-Level Refactoring Prediction by Ensemble Learning with Various Feature Selection Techniques
## 3 Research Methodology
### System Model
#### 3.1.1 Refactoring Data Preparation  
Considering overall research intent, where the focus is placed on performing refactoring analysis and predicting whether a software and its components (say, class) might be refactored or not, we hypothesize code smells as the trait signifying refactoring probability in a software.  
We considered the standard benchmark data from the tera-PROMISE repository ([[https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr)]([https://github.com/dspinellis/awesome-msr](https://github.com/dspinellis/awesome-msr))) (accessed on 20 March 2020). The exact data set is available in the URL [[https://github.com/rasmitapanigrahi/data-set](https://github.com/rasmitapanigrahi/data-set)]([https://github.com/rasmitapanigrahi/data-set](https://github.com/rasmitapanigrahi/data-set)) (accessed on 20 March 2020) [52]. The four different (refactoring) datasets are collected with varied refactoring quotients to assess the proposed refactoring analysis model's efficiency shown in Table 1. We considered a set of four refactoring datasets obtained from the tera-PROMISE repository. These datasets typically encompass source code metrics of object-oriented software programs that employ techniques such as Helstied, Chidamber, Kemerer Java Virtual Machine (CKJM), etc. Since these data elements signify a software's structural traits, identifying associations and mapping their impact towards refactoring can help machine learning model(s) predict or classify a software component or code for its refactoring likelihood. We considered manually validated data for refactoring [14; 15], which comprises almost 125 source code metrics obtained employing RefFinder-based extraction [53], followed by SourceMeter tool [54] ([[https://www.sourcemeter.com/](https://www.sourcemeter.com/)]([https://www.sourcemeter.com/](https://www.sourcemeter.com/)), (accessed on 19 December 2020)) based metrics extraction. Noticeably, this research's code metrics are related to different features, including coupling, cohesion, size, complexity, inter-component dependency, etc. We obtained a total of 125 such features to assess their respective efficacy toward refactoring prediction. The literature reveals that numerous code metrics can characterize the refactoring probability of a class, such as cohesion between individual clones, cyclomatic complexity, the total number of lines of code, the number of methods, the number of methods overridden, etc. Exploring this in-depth, it has been found that hundreds of software metrics characterizing software code quality can be used to assess refactoring analysis. Undeniably, several code metrics can characterize source code quality and eventually the refactoring probability; however, it is not inevitable that all metrics can have a similar significance to classify a class as refactoring prone or to be refactored. Considering this fact, we performed a statistical significance level estimation.  
\begin{table}
\begin{tabular}{l l l l l l} \hline \hline
**Projects** & **No. of Class** & \begin{tabular}{c} **No. of Refactored** \\ **Class** \\ \end{tabular} & \begin{tabular}{c} **No. of Non-Refactored** \\ **Class** \\ \end{tabular} & \
\begin{tabular}{c} **Refactoring Class** \\ **Percentage** \\ \end{tabular} &
\begin{tabular}{c} **Non-Refactoring** \\ **Class Percentage** \\ \end{tabular} \\ \hline Antlr4 & 408 & 23 & 385 & 5.64 & 94.36 \\ \hline Junit & 655 & 9 & 646 & 1.37 & 98.63 \\ \hline Mct & 2028 & 15 & 2013 & 0.74 & 99.26 \\ \hline Titan & 1158 & 13 & 1145 & 1.12 & 98.88 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Implemented Data set.