# Class-Level Refactoring Prediction by Ensemble Learning with Various Feature Selection Techniques
## 4 Results and Discussion  
Considering the significance of reliable software design and probable fault avoidance, the refactoring concept has been recognized as a potential approach. Practically, the refactoring method enables the identification of probable code smells and vulnerabilities and introduces changes to retain code sanity and reliability without making any significant change in functional behavior. Its significance becomes inevitable, especially in the modern software industry where firms try to make component reuse, FOSS to save cost. The industry employs manual testing, regression-based methods, etc., to identify such refactoring probability; however, in contrast to the cost-minimization objective, it increases cost and makes delivery time-consuming. It does not guarantee human error avoidance, especially when the software program size is more. Considering such issues, developing an automatic software refactoring estimation model becomes inevitable. This paper developed a highly robust code-metrics-enabled artificial intelligence concept, exploiting hundreds of the code metrics to assess each class's refactoring probability, vulnerability, and allied refactoring probability. To achieve this, the research employed a multi-phased paradigm where, at first, a standard source code chunk was obtained from a software engineering benchmark dataset named PROMISE. At first, a total of 125 source code metrics were obtained, including Halstead, Chidambaram, and Kamarer code metrics, Object Oriented Code metrics, etc., realizing that among the 125 features, certain features have higher significance towards refactoring prediction or characterization, while few can be insignificant. Considering this, we first performed significant feature estimation for which a strategic paradigm encompassing Wilcoxon Signed Rank Test, Significant Test, and Cross-Correlation Test was applied in sequence. Here, our prime motive was to retain only the most significant features which can have a high correlation or association with refactoring probability. Here, for significant estimation, we considered a threshold value of 0.5. Once we had obtained the optimal set of features, which were 24 in our case, we performed Min-Max normalization, which mapped each data element into [0, 1] patterns. Noticeably, normalization was mainly performed to avoid any convergence problem. A highly significant step was performed with the obtained normalized values, which major researchers did not address. To be noted, the software or program as a case study can be of any size with diverse classes, connectivity, coupling, cohesion, etc. Under such circumstances, the probability of data imbalance increased significantly. Unfortunately, it increases the likelihood of false classification, so avoiding such data imbalance was necessary. This paper applied different data-sampling algorithms with this motive, including random sampling, downsampling, and upsampling. We used the confidence interval concept to upsample the input video data, which helped retain features with significance in almost 95% of the original metrics or samples. Thus, with the actual 24 samples or data metrics as an input, we obtained 96 feature samples containing the original sample, random sample, and downsampled and upsampled data, for each of the source code metrics. Noticeably, in each class's proposed method, we applied 96 feature samples, making classification both robust and accurate. Finally, we performed a two-class classification with the 96 feature sets, classifying each software code class as refactoring prone or non-refactoring. Noticeably, we realized that each classifier has a different classification performance and generalizing performance based on specific random classifiers is not suitable. This paper designed a novel heterogeneous classifier with machine learning methods of the different types. It strengthened our proposed model to achieve better learning and classification in conjunction with ensemble concepts such as maximum voting ensemble or base-trained ensemble models.