IDEAS home Printed from https://ideas.repec.org/a/plo/pone00/0343606.html

Use of machine learning to detect Escherichia coli in drinking water in Bangladesh

Author

Listed:
  • Iqramul Haq
  • Md Yusuf Hossain Ador
  • Diego Nobrega

Abstract

Escherichia coli (E. coli) is a key indicator of fecal contamination in freshwater and can signal the presence of other harmful bacteria and viruses. The aim of the study is to evaluate the performance of machine learning (ML) tools to detect E. coli in drinking water in Bangladesh using surveillance data under two scenarios: an imbalanced dataset and a balanced dataset. We utilized data from the 2019 Bangladesh Multiple Indicator Cluster Survey, which included a total of 6,069 household drinking water samples. We used agglomerative hierarchical clustering with Ward’s linkage to identify district-level hotspots. Extreme Gradient Boosting with SHapley Additive exPlanations values were used for feature selection, and the Synthetic Minority Over-sampling Technique (SMOTE) was used to address class imbalance in the classification task. We applied nine classical ML models in this study: Adaptive Boosting (AdaBoost), Decision Trees (DT), Gradient Boosting Algorithm (GBA), k-Nearest Neighbors (KNN), Light Gradient-Boosting Machine (LightGBM), Logistic Regression (LR), Naïve Bayes (NB), Random Forest (RF), and Support Vector Machine (SVM), along with a Deep Learning Multi-Layer Perceptron (DL-MLP) model to predict the risk of E. coli contamination (REcC) in water. Model performance was evaluated using accuracy, precision, recall, F1 score, Cohen Kappa, area under the curve (AUC), and a violin plot. E. coli contamination in drinking water was detected in 39.2% (95% CI: 37.4–41.2) of households. Bandarban district had the highest REcC. After applying SMOTE and 10-fold cross-validation with hyperparameter tuning, model performance was more consistent across algorithms. In terms of model evaluation, AdaBoost slightly outperformed the others with an accuracy of 81.6%, Cohen kappa statistic of 19.4%, precision of 82.2%, recall of 99%, F1-score of 89.8%, and an AUC of 68.6%. Ensemble model for example AdaBoost and GBA models had ability to accurately classify drinking water samples with respect to the presence of E. coli using surveillance data than others selected model in this study.

Suggested Citation

  • Iqramul Haq & Md Yusuf Hossain Ador & Diego Nobrega, 2026. "Use of machine learning to detect Escherichia coli in drinking water in Bangladesh," PLOS ONE, Public Library of Science, vol. 21(8), pages 1-19, August.
  • Handle: RePEc:plo:pone00:0343606
    DOI: 10.1371/journal.pone.0343606
    as

    Download full text from publisher

    File URL: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0343606
    Download Restriction: no

    File URL: https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0343606&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pone.0343606?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pone00:0343606. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: plosone (email available below). General contact details of provider: https://journals.plos.org/plosone/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.