Improving diagnosis of pneumonia among population: A machine learning method using k-nearest neighbors (KNN), random forest, and support vector machine (SVM) on chest X-ray images

Authors

  • Oluwaseun Olumide Okundalaye Department of Mathematical Sciences, Faculty of Science, Adekunle Ajasin University, 001 Akungba-Akoko, Ondo State, Nigeria Author

DOI:

https://doi.org/10.63112/1e038s75

Keywords:

Infectious disease, Modeling, Machine learning, Pneumonia

Abstract

Pneumonia is a major global health challenge, particularly affecting children under five, and remains a leading cause of mortality due to diagnostic delays and variability in clinical interpretation. This study investigates the application of classical machine learning (ML) classifiers—K-Nearest Neighbors (KNN), Random Forest (RF), and Support Vector Machine (SVM)—to enhance pneumonia detection using pediatric chest X-ray images. A dataset of 5,856 chest X-rays was preprocessed using spatial (Gaussian Blur, Histogram Equalization) and frequency-domain (Discrete Cosine Transform, High-Pass Filtering) techniques. Feature extraction was performed using a hybrid approach combining handcrafted methods (GLCM, HOG, Wavelets) and deep features via a pretrained ResNet-50. Among the models evaluated, SVM with Gaussian Blur achieved the highest accuracy (96.75%) and F1-score (0.97), followed by RF with Gaussian Blur (95.32% accuracy, F1-score 0.95). In contrast, DCT preprocessing consistently underperformed across all models. Statistical analyses, including ANOVA (p = 0.0003) and Tukey’s HSD, confirmed that model-preprocessing interactions significantly influenced diagnostic performance. While DenseNet121, a deep learning baseline, achieved slightly higher accuracy (93.1%), classical models demonstrated superior computational efficiency and interpretability, making them better suited for deployment in resource-constrained settings. This research highlights the importance of image preprocessing and feature engineering in ML-based pneumonia diagnostics, offering promising solutions for improving early detection and clinical decision-making in low-resource environments.

Downloads

Published

2025-12-31

Issue

Section

Articles: Use for submitting articles for consideration in an ongoing issue

How to Cite

Improving diagnosis of pneumonia among population: A machine learning method using k-nearest neighbors (KNN), random forest, and support vector machine (SVM) on chest X-ray images. (2025). SRA - Physical Sciences, 1(2), 1-16. https://doi.org/10.63112/1e038s75