# Unraveling the Impact of Class Imbalance on Deep-Learning Models for Medical Image Classification
## 3 Results and Analysis
### Results and Analysis for One Layer
To demonstrate this, the total number of processed labels during testing, as well as the number of actual and predicted labels for samples of normal (N) pathologies, viruses  
\begin{table}
\begin{tabular}{l r r r r r r r r r r r r r} \hline \hline  & & & & & & & & & & & & & & & & \\ \hline deepnet & 10–100 & No\_bal & 80 & 64 & 0.65 & 0.65 & 637 & 373 & 451 & 118 & 186 & 146 & – & – \\ deepnet & 100–500 & No\_bal & 100 & 99 & 0.64 & 0.64 & 0.63 & 373 & 396 & 118 & 241 & 146 & – & – \\ deepnet & 10–100 & Bal & 80 & 94 & 0.47 & 0.48 & 354 & 118 & 105 & 118 & 249 & 118 & – & – \\ deepnet & 100–500 & Bal & 100 & 4 & 0.33 & 0.33 & 354 & 118 & 354 & 118 & 118 & – & – \\ keras & 10–100 & No\_bal & 30 & 85 & 0.70 & 0.71 & 637 & 373 & 450 & 118 & 187 & 146 & – & – \\ keras & 100–500 & No\_bal & 150 & 77 & 0.67 & 0.68 & 637 & 373 & 373 & 118 & 264 & 146 & – & – \\ keras & 10–100 & Bal & 100 & 91 & 0.54 & 0.53 & 354 & 118 & 145 & 118 & 209 & 118 & – & – \\ keras & 100–500 & Bal & 150 & 89 & 0.55 & 0.54 & 354 & 118 & 182 & 118 & 172 & 118 & – & – \\ keras-cnn & 10–100 & No\_bal & 40 & 88 & 0.89 & 0.78 & 637 & 373 & 462 & 118 & 60 & 146 & 115 & – \\ keras-cnn & 100–500 & No\_bal & 450 & 53 & 0.92 & 0.80 & 637 & 373 & 380 & 118 & 90 & 146 & 167 & – \\ keras-cnn & 10–100 & Bal & 30 & 89 & 0.74 & 0.63 & 354 & 118 & 154 & 118 & 118 & 106 & 118 & 40 & – \\ keras-cnn & 100–500 & Bal & 150 & 84 & 0.85 & 0.63 & 354 & 118 & 91 & 118 & 111 & 118 & 152 & – \\ neuralnet & 10–100 & No\_bal & 10 & 81 & 0.67 & 0.67 & 637 & 373 & 393 & 118 & 173 & 146 & 68 & 3 \\ neuralnet & 10–500 & No\_bal & 100 & 62 & 0.69 & 0.60 & 637 & 373 & 317 & 118 & 143 & 146 & 66 & 11 \\ neuralnet & 10–100 & Bal & 40 & 6 & 0.62 & 0.55 & 354 & 118 & 90 & 118 & 197 & 118 & 63 & 4 \\ neuralnet & 100–500 & Bal & 100 & 42 & 0.63 & 0.53 & 354 & 118 & 80 & 118 & 198 & 118 & 62 & 14 \\ rsms & 10–100 & No\_bal & 70 & 92 & 0.70 & 0.71 & 637 & 373 & 490 & 118 & 24 & 146 & 123 & – \\ rsms & 10–500 & No\_bal & 150 & 96 & 0.70 & 0.70 & 637 & 373 & 478 & 118 & 33 & 146 & 126 & – \\ rsms & 10–100 & Bal & 100 & 55 & 0.47 & 0.49 & 354 & 118 & 171 & 118 & 183 & 118 & – & – \\ rsms & 10–500 & Bal & 400 & 92 & 0. (V), and bacteria (B), are recorded from Column 8 to Column 15. Based on the provided information, the Keras package is analyzed in its implementation version for convolutional layers (see keras_cnn in Row 11 of Table 1), where an 80% overall accuracy in testing has been achieved. However, this model predicted 380 samples with normal labels when there were actually 373. It also predicted 90 and 167 samples with virus and bacteria labels, respectively, when there are actually 118 and 146 of each. These results do not align adequately with the observed overall accuracy of 80% in the tests, as there would be an expectation to see 298, 94, and 116 respective samples for the labels involved. While the initial analysis focuses on the highest-performing model, the assessment of alternative models reveals that the overall accuracy achieved in tests does not provide a comprehensive representation of predictive performance by class. Referencing the Deepnet package, which achieves an overall accuracy of 65% in evaluations (see Deepnet in Row 2 of Table 1), a predisposition towards identifying features associated with normal pathology samples is detected, resulting in 451 predictions for this category, despite there being only 373 actual samples. Furthermore, this model shows an inability to identify bacterial pathology samples, failing to predict any of the 146 samples belonging to this classification. This discrepancy between observed results and the indicated overall accuracy of 65% suggests that evaluation metrics do not adequately reflect specific predictive performance by category, with distributions of 242, 76, and 94 samples for the respective labels being expected. Exploring more alternative models is feasible; however, the inclination towards ineffective predictions indicated by the overall accuracy will continue to be misleading.