# Class-Level Refactoring Prediction by Ensemble Learning with Various Feature Selection Techniques
## 3 Research Methodology
### Logistic Regression (LR)  
LR is one of the most common ways to use regression to group data. It uses the idea of regression to classify a dependent variable based on more than one input (say, code metrics). For example, in our proposed refactoring prediction problem, the dependent variable (software code or class) can be either refactoring prone or not refactoring. In logistic regression, the base classifier looks at how likely each class needs refactoring based on the relationship between the code metrics for each class. Mathematically, logistic regression is presented as Equation (5). \[\text{logit}[\pi(x)]=\beta_{0}+\beta_{1}X_{1}+\beta_{2}X_{2}+\ldots\ldots+ \beta_{m}X_{m} \tag{5}\]  
In Equation (5), the left-hand component \(\text{logit}[\pi(x)]\) represents the dependent variable, whereas \(X_{i}\) represents the independent variable [0-\(m\)]. The logistic regression approach uses the linear regression idea to convert dichotomous outputs to logit function values ranging from 0 to m denote the total number of independent variables in Equation (5) (here, the code metrics). The second field indicates the refactoring propensity of the class during validation. Consequently, the dependent variable or class-level (\(x\)) predicted by LR is denoted by Equation (6). \[\pi(x)=\frac{e^{\beta_{0}+\beta_{1}X_{1}+\beta_{2}X_{2}+\ldots\ldots+\beta_{m }X_{m}}}{1+e^{\beta_{0}+\beta_{1}X_{1}+\beta_{2}X_{2}+\ldots\ldots+\beta_{m}X_ {m}}} \tag{6}\]  
Decision Tree (DT.) Algorithm  
Pattern classification has traditionally been performed using the Decision Tree method [49, 50], although its efficiency has seen significant improvements throughout time, allowing it to attain higher accuracy. For example, DT C4.5 and DT C5.0, which are mostly used for data mining and categorization, have evolved. DT's C5.0 method was used as a basis classifier to perform class-level predictions on the input data. Noticeably, the C5.0 DT algorithm categorized or labeled each class of the investigated software as either refactor-prone or non-refactoring. The input data metrics are divided into numerous branches at each node of the DT, starting at the root node and using an association rule in between the split criteria. Refactoring-prone and non-refactoring classes were defined using the Information Gain Ratio (IGR) in the C5.0 method used in this study. [PERSON] et al. [55] conducted an empirical evaluation to find the impact of feature selection techniques, ensemble models, and sampling techniques implemented on seven data sets for predicting change-proneness using different source code metrics. However, [PERSON] et al. [56] discussed automated software requirements using machine learning algorithms. Support Vector Machine (SVM)  
SVM is one of the most used supervised machine-learning approaches for pattern recognition. A binary linear classifier that learns from data that is not probabilistic. SVM uses the structural risk reduction paradigm to reduce generalization errors on unseen instances. To achieve the boundary's value, also referred to as a hyper-plane, in between the two classes, this method uses support vectors to represent a portion of the training set. The following function is used in pattern-based classification using SVM-based prediction in Equation (7). \[Y^{\prime}=w*\phi(x)+b \tag{7}\]  
Collecting the correct weights factor \(w\) and bias component b values to complete the non-linear transformation is essential. We obtain \(Y^{\prime}\) in Equation (7) by iteratively reducing the regression risk. The risk of regression is expressed numerically in Equation (8). \[R_{reg}\left(Y^{\prime}\right)=C*\sum_{i=0}^{l}\ \gamma\left(Y_{i}^{\prime}-Y_{i} \right)+\frac{1}{2}*\|w\|^{2} \tag{8}\]  
These two parameters represent the penalty and cost functions, \(C\) and, are represented in Equation (8). Weights are estimated using the method in Equation (9). \[w=\sum_{j=1}^{l}\ \left(\alpha_{j}-\alpha_{j}^{*}\right)\phi\left(x_{j}\right) \tag{9}\]  
In Equation (9), \(*\) stands for the relaxation factor called Lagrange multipliers.