# Machine Learning Models for the Classification of Histopathological Images of Colorectal Cancer
## 3 Results  
Regarding the extracted features, the RGB colors showed a high discriminatory ability to identify the classes, but energy was also effective in distinguishing between the different classes (Figure 3). It was observed that the empty images scored high in red color, as they mainly contain white or red colors, while there is an absence of the other two colors. Empty images also exhibited large values for energy, due to the white parts that are mostly contained in each image. On the other hand, images containing tumors achieved low energy scores and this is explained through the fact that they contain more colors and that the patterns shown in those images tend to be quite varied, with various shapes present. As a result, the \"Lympho\" tissues tended to score the largest energy value compared to the others. Overall, for the aggregated tissue classes, Table 4 presents the training and test accuracies. The XGBoost and random forest algorithms demonstrate the highest test set accuracy, achieving 89.79% and 88.82% respectively. XGBoost was also associated with the highest sensitivity, specificity, precision, and F1 scores, as presented in Table 5 and in Figure 4. This indicates its effectiveness in generalizing to unseen data well, as it performed well not only on the training set but also on the test set. The SVM algorithm shows a decent test set accuracy of 87.73%, indicating its effectiveness in learning patterns from data and generalizing to unseen samples. However, it lags slightly behind the random forest and XGBoost algorithms in terms of test set performance. While the CNN algorithm achieves a high accuracy of 87.50% on the test set, this value is slightly lower than that of the XGBoost, random forest, and SVM algorithms. However, it still demonstrates strong performance, indicating its suitability for image classification tasks. The NB and CIT algorithms also exhibit moderate performance. The k-NN algorithm shows the lowest test set accuracy among the methods considered, at 45.92%. This could suggest that the k-NN algorithm does not generalize well to unseen data in this particular task, possibly due to its reliance on local similarity measures. Figure 3: Boxplots for RGB color red and energy across the eight tissue types. In order to compare the performance for each tissue type between the different algorithms, the balanced accuracy achieved by each algorithmic method is presented in Table 6, while the calculated metrics are visualized in Figure 5. XGboost achieved at least 90% accuracy in all classes, and the lowest accuracy was observed for the \"Complex\" and \"Stroma\" classes. The most influential features that provided a good accuracy level through the random forest were the images' colors (especially red), HoG, and variance. Overall, the random forest's metrics were adequate, with high sensitivity (>82.7%) and specificity scores (>97%), while the model's accuracy scores ranged from 90% to 99%. The SVM had high metrics for all tissues, exhibiting good properties and competitive performance across most classes, with particularly high sensitivity for the \"Empty\" class (99.5%) and high specificity for several classes, such as \"Adipose\", \"Debris\", \"Empty\", and \"Lympho\". While the sensitivity for the \"Complex\" class was relatively high (85.5%), the precision was lower (75%), suggesting a higher rate of false positives among the predicted \"Complex\" instances \begin{table}
\begin{tabular}{c c c} \hline \hline
**Method** & **Train Sample Accuracy** & **Test Sample Accuracy** \\ \hline XGBoost & 100\% & 89.79\% \\ Random Forest & 87.15\% & 88.82\% \\ SVM & 85.40\% & 87.73\% \\ CNN & 88.34\% & 87.50\% \\ Conditional Inference Tree & 78.97\% & 82.93\% \\ Naive Bayes & 74.20\% & 78.07\% \\ k-NN & 45.14\% & 45.92\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Train–test accuracy results. Figure 4: Comparison of predictive performance in the test set across the different algorithms.