# Code Smell Detection Using Ensemble Machine Learning Algorithms
## 3 Proposed Research Framework
### Key Measurements of Performance  
In this study, we evaluated the performance of various experiments. The confusion matrix (CM) was calculated. The actual and expected information detected by code smell detection classifiers was stored in the CM. Then using the CM, the true positive (TP), true negative (TN), false positive (FP), and false-negative (FN) were calculated. The definition of TP, TN, FP, and FN are given below:  
* TP represents the outputs (occurrences) where the algorithm accurately expects the positive class. * TN represents the outputs (occurrences) where the algorithm accurately expects the negative class. * FP represents the outputs (occurrences) where the algorithm inaccurately expects the positive class. * FN represents the outputs (occurrences) where the algorithm inaccurately expects the negative class. Definitions and formula of evaluation metrics: PPV, sensitivity, F-measure, AUC_ROC_score, accuracy, MCC, and Cohen_Kappa_score used to evaluate the model's performance are given below:  
Positive predictive value (PPV):Positive predictive value measures the number of code smell instances correctly identified by machine learning methods. PPV is also known as precision [55]. Formula (3) was used to calculate the positive predictive value. PPV is calculated as the number of TP divided by the total number of TP and FP. \[\text{Positive Predictive Value}(\text{PPV})=\frac{\text{TP}}{\text{TP}+\text{ FP}} \tag{3}\]  
Sensitivity: Sensitivity measures the amount of code smell occurrences recognized by machine learning methods. The sensitivity is also known as the true positive rate (TPR) and Recall [55]. Formula (4) was used to calculate the sensitivity. The sensitivity is calculated as the number of TP divided by the total number of TP and FN. \[\text{Sensitivity}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{4}\]  
F-measure: F-measure measures the harmonic mean of positive predictive value (PPV) and sensitivity, and its stand for a balance between their values [55]. Formula (5) was used to calculate the F-measure. \[\text{F}-\text{measure}(\text{F})=2\times\frac{\text{PPV}\times\text{Sensitivity }}{\text{PPV}+\text{Sensitivity}} \tag{5}\]  
AUC_ROC_Score: The AUC_ROC_score is applied to observe the performance of a classification model based on its rate of correct and incorrect classifications. ROC represents the probability, and AUC calculates the degree of separability [55]. It says how much the model is able to distinguish between classes. An outstanding model puts AUC near one, which notifies that it has a good measure of separation. A bad model will have an AUC near 0, notifying that it has the worst measure of separation. Indeed, it means it returns the result and calculates 0s as 1s and 1s as 0s. When an AUC is 0.5, the model has no class separation ability in the model. Accuracy: Accuracy measures the association between PPV and sensitivity. It displays the percentage of positive and negative instances that were accurately categorized [55]. Formula (6) was used to calculate accuracy. Accuracy is calculated as the total number of TP and TN divided by the total number of TP, TN, FP, and FN. \[\text{Accuracy}(\text{A})=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{TN}+ \text{FP}+\text{FN}} \tag{6}\]Matthews Correlation Coefficient (MCC): The Matthews correlation coefficient (MCC) is utilized in MLT to determine the quality of two-class or binary classification. It obtains true and false positives and negatives and is normally considered a balanced calculation that can be utilized if the classes are of significantly different sizes [56]. The formula for calculating the MCC is given in Equation (7). \[\text{MCC}=\frac{(\text{TP}\times\text{TN})-(\text{FP}\times\text{FN})}{\sqrt{( \text{TP}+\text{FP})(\text{TP}+\text{FN})(\text{TN}+\text{FP})(\text{TN}+ \text{FN})}} \tag{7}\]  
Cohen_Kappa_Score: Cohen_Kappais a metric which is utilized to evaluate the agreement between two raters. It can also be utilized to evaluate the performance of a classification model [57].