**3. Results**

The following metrics help in evaluating machine learning models for classification and regression. **Regression Metrics**: MBE (mean bias error), RMSE (root mean square error), MABE (mean absolute bias error), and R2 (determination coefficients). **Classification metrics**: discuss the classification report and confusion matrix. F1-score, recall, accuracy, and precision are included in the classification report and their equations are shown in Equations (2)–(5). Two dimensions, "actual" and "predicted," are included in the confusion matrix. For each dimension, there are values for true positive (TruePos), true negative (TrueNeg), false positive (FalsePos), and false negative (FalseNeg).


The following class labels were used for regression and classification purposes: 'Normal\_Weight', 'Insufficient\_Weight', 'Overweight\_Level\_I', 'Overweight\_Level\_II', 'Obesity\_Type\_I', 'Obesity\_Type\_II', 'Obesity\_Type\_III' with the indexes of '0', '1', '2', '3', '4', '5', and '6', respectively.

The following formulas help in the calculation of classification metrics:

$$Accuracy = \frac{(TruePos + TrueNeg)}{TruePos + FalsePos + FalseNeg + TrueNeg} \tag{2}$$

$$Precision(P) = \frac{TruePos}{TruePos + FalsePos} \tag{3}$$

$$Recall(\text{R}) \text{ or } Sensitivity(\text{S}) = \frac{TruePos}{TruePos + FalseNeg} \tag{4}$$

$$F1\text{-score} = \mathcal{Z} \times \frac{Precision \times Recall}{Precision + Recall} \tag{5}$$

The precision determines how closely the real value resembles the measured value, while accuracy assesses how closely the measured value resembles the actual value. Recall and sensitivity indicate a machine learning model's overall usefulness. MBE, RMSE, MABE, and R2 are used for regression problems as represented in Equations (6)–(9). If the MBE is low and close to zero, the prediction model performs well. Furthermore, zero represents the optimal situation. The prediction model effectiveness (in the short term) is assessed by the RMSE metric. It always has a positive value, which ought to be close to zero. MABE evaluates the severity of an association. The objective is to come as close to zero. The R2 approach shows how well a method can forecast a set of quantifiable facts. Its value is a number between 0 and 1.

$$MBE = \frac{1}{q} \sum\_{n=1}^{q} (b\_n - c\_n)^2 \tag{6}$$

$$RMSE = \sqrt{\frac{1}{q} \sum\_{n=1}^{q} (b\_n - c\_n)^2} \tag{7}$$

$$MAE = \frac{1}{q} \sum\_{n=1}^{q} |b\_n - c\_n| \tag{8}$$

$$R^2 = 1 - \frac{\sum (b\_n - c\_n)^2}{\sum (b\_n - \overline{b\_n})^2} \tag{9}$$

## *3.1. Confusion Matrix*

The confusion matrix clarifies the performance of the classification algorithm. The accuracy value can be misled if the number of classes in a dataset is more than one or the dataset has unequal observations. A confusion matrix gives a clear idea of the results of the classification model and highlights the errors. It contains the summary of the predicted results applied to a classified problem [35]. The percentage of accurate classification in all of the predictions is indicated by accuracy. The matrix contains several values, but the confusion matrix tells precisely where the process went wrong. There are two axes in the confusion matrix. The Y-axis shows the test values of the dataset, while the x-axis represents the prediction results of the test values. There are seven classes in the dataset predicted by machine learning algorithms. The confusion matrix of the decision tree, regression logistic, KNN, naïve Bayes, SVM, and random forest are shown in Figures 4–9. The colorful boxes represent the actual scores of the classes, while the values in other boxes show the mistaken values.

**Figure 4.** Decision tree prediction on each class testing sample.

**Figure 5.** KNN prediction on each class testing sample.

**Figure 6.** Logistic regression prediction on each class testing sample.

**Figure 7.** Naïve Bayes prediction on each class testing sample.

**Figure 8.** Random Forest prediction on each class testing sample.

**Figure 9.** Support vector machine prediction on each class testing sample.
