Classification of bacteria-contaminated urine using an electronic nose and machine learning analysis for early detection of urinary tract infection

Document Type

Article

Publication Date

6-1-2026

Abstract

Introduction: Urinary Tract Infection (UTI) is an infection caused by the growth of microorganisms in the human urinary tract. Escherichia coli (E. coli) is the primary pathogen responsible for nearly 85% of UTI cases. Diagnosis of UTIs is typically conducted in laboratories using three main tests: dipstick urinalysis, microscopic urinalysis, and urine culture. However, these methods have certain limitations: they are time-consuming (taking a minimum of 24 h), dipstick urinalysis results cannot be used as the sole indicator for a positive UTI diagnosis, and the procedures must be performed in a laboratory setting. This study aims to explore the potential of an electronic nose (E-Nose) as a tool for detecting UTIs through urine samples. Method: The study analyzes the voltage response of an E-Nose sensor array to healthy urine samples and samples contaminated with E. coli (urine + bacteria). The data were processed using Principal Component Analysis (PCA) followed by several machine-learning classifiers, including Support Vector Machine (SVM), XGBoost, Logistic Regression, K-Nearest Neighbors (KNN), Random Forest, Decision Tree, and Multi-Layer Perceptron (MLP). Ten urine samples, five healthy and five contaminated with E. coli bacteria (urine + bacteria), were used in this study. The contaminated samples were prepared using a standardized E. coli inoculum (McFarland 0.5), adjusted to a final concentration of approximately 10⁵ CFU/mL, incubated at 37 °C for 24 h, and represented by a six-dimensional feature vector obtained from the standard deviation of the six sensor responses. Electronic nose sensing was conducted every 6 h over 24 h. The results showed that the TGS 2602 and TGS 826 sensors produced the highest voltage response values among the six sensors, as both are highly sensitive to ammonia gas in urine. Result: PCA was employed to reduce the dataset’s dimensionality before classification. In an initial hold-out evaluation, the SVM model achieved an accuracy of 90%. However, in the standardized comparative analysis performed across all classifiers using the same train–test split, XGBoost achieved the highest performance with an accuracy of 84%, while SVM and several other models showed competitive performance in the range of 80–82%. The TGS 2602 and TGS 826 sensors produced the highest voltage response values among the six sensors, as both are highly sensitive to ammonia gas in urine. Conclusion: Based on these findings, the electronic nose (E-Nose) shows strong potential for detecting E. coli in urine as a positive indicator of urinary tract infections (UTIs). However, the present findings are based on artificially contaminated in vitro urine samples and should therefore be interpreted as preliminary evidence requiring further validation on clinically derived samples and multiple uropathogens.

Keywords

Electronic nose, Escherichia coli, Machine learning, PCA, SVM, Urinary tract infection

Publication Title

Scientific African

ISSN

2468-2276

DOI

10.1016/j.sciaf.2026.e03364

Volume

32

Share

COinS