Building of Informatics, Technology and Science
Vol 7 No 2 (2025): September 2025

Comparative Analysis of Random Forest and Convolutional Neural Network (CNN) Algorithms for Pneumonia Detection in Chest X-ray Images: Accuracy, Interpretability, and Computational Efficiency

Zaena, Siffa (Unknown)
Lhaksmana, Kemas Muslim (Unknown)



Article Info

Publish Date
02 Sep 2025

Abstract

Pneumonia is a lung infection that can be detected through chest X-ray images. Manual diagnosis requires radiological expertise and time, thus an accurate automated method is needed. This study aims to compare the performance of two image classification algorithms, Convolutional Neural Network (CNN) and Random Forest (RF), in detecting pneumonia. The dataset used was obtained from Kaggle, consisting of 5,863 X-ray images categorized into three classes: bacterial pneumonia, viral pneumonia, and normal. Preprocessing steps include image resizing, normalization, and data augmentation. The CNN model was built using multiple convolutional and pooling layers, while RF utilized numerical features derived from histograms and texture. The CNN model demonstrated superior performance, achieving 92.4% accuracy, 93.1% precision, 91.6% recall, and 92.3% F1-score, compared to 82.7%, 80.3%, 85.1%, and 82.6% for Random Forest, respectively. Although CNN offers better accuracy, RF excels in interpretability. In conclusion, CNN is more effective for image-based pneumonia classification, yet RF remains relevant in applications requiring transparent decision-making. Potential biases, such as class imbalance and limited demographic representation in the dataset, could influence model performance and generalizability across different patient populations.

Copyrights © 2025






Journal Info

Abbrev

bits

Publisher

Subject

Computer Science & IT

Description

Building of Informatics, Technology and Science (BITS) is an open access media in publishing scientific articles that contain the results of research in information technology and computers. Paper that enters this journal will be checked for plagiarism and peer-rewiew first to maintain its quality. ...