Waterborn diseases Predication

Introduction 

Waterborne diseases are usually caused by pathogenic microbes which spread through contaminated water. These diseases transmitted by using the infected water for domestic purposes. In the world, most developing countries do not have treatment plants, particularly in rural areas. Waterborne diseases included Diarrhea, Cholera and Typhoid, Amoebiasis and Hepatitis, etc. These are diseases that are threading for humanity. This study will focus on developing an early warning system using Machine learning specifically for the health care departments of Pakistan to mitigate the adverse impacts of sudden health-related outbreaks like waterborne diseases. Further, it will suggest the best treatment solutions to the health experts by analyzing the current patient's data.

Table of Content

  • Train and validate models and develop a machine learning pipeline for deployment.

  • Model for Deployment.

  • Build a basic HTML front-end with an input form for independent variables (age, sex,  BMI, children, smoker, region).

  •  Build a back-end of the web application using a Flask Framework.

  • Deploy the web app on Heroku. Once deployed, it will become publicly available and can be accessed via Web URL.

1- Train and Validate the Models. 

Training and model validation is performed in Integrated Development Environment (IDE) or Notebook either on your local machine or on the cloud. In this tutorial, we will use PyCaret in Jupyter Notebook to develop machine learning pipelines and train regression, models. In this study, we have performed two experiments. The first experiment is performed with default preprocessing settings in PyCaret (missing value imputation, categorical encoding, etc). The second experiment has some additional preprocessing tasks such as scaling and normalization, automatic feature engineering, and binning continuous data into intervals. See the setup example for the second experiment: In this study, we first build the model using  different python tools and libraries, and their details are as follows 

 1.1 - Tools 

We used the following python tools to build the machine learning modes that predict positive cases.

  Python   

Python is one of the most widely used languages by Data Scientists and Machine Learning experts across the world. Python is a programming language that is easy to understand and it also contains a lot of ML libraries. Its best for building fast prototyping ML models. 

 Sk-learn

Sk-learn is an open-source library of python which contain machine learning supervised and unsupervised algorithm. scikit-learn has become the de-facto standard for many of the machine learning tasks. Developed as part of the Google Summer of Code project, it has now become a widely contributed open-source project with over 1000 contributors.


 Pycart

Pycaret is an open-source library of Machine learning, which automates the entire process of training machine learning models. it automatically chooses the best model for your dataset. Pycaret is an open-source, low-code machine learning library in Python to train and deploy machine learning pipelines and models in production. Paret can be installed easily using pip.

# for Jupyter notebook on your local computer
pip install pycaret
# for azure notebooks and google colab
!pip install pycaret

1.2-  Train and Validate the Model

In our study, first, we collected typhoid and malaria patient data for the years 2017–2020 from Ayub Medical Hospital. The collected data set has seven important input features. In the current study, different ML models were first trained and tested on the current study dataset using the tenfold cross-validation method. Second, we investigated the importance of input features in waterborne disease-positive case detection.

1.2.1-  Malaria Disease Prediction  ( Github Link)

1.2.1- Typhoid Disease Prediction  ( Github Link)

2- Model for Deployment.

Build Web Application ( Dashboard)(GitHub link)

Tools: Flask, Python , Sklearn

The deployment of machine learning models is the process of making models available in production where web applications are, Normally machine learning models are built so that they can be used to predict an outcome (binary value i.e. 1 or 0 for Classification, continuous values for Regression, labels for Clustering, etc. There are two broad ways of generating predictions (i) predict by batch; and (ii) predict in real-timeNow that our machine learning pipeline and model are ready we will start building a web application that can connect to them and generate predictions on new data in real-time. There are two parts of this application: To build a web application where demographic and health information of a patient is entered in a web form to predict positive cases of water-borne diseases.

Hosting

            GitHub

GitHub is a cloud-based service that is used to host, manage and control code. Imagine you are working in a large team where multiple people (sometimes hundreds of them) are making changes. PyCaret is itself an example of an open-source project where hundreds of community developers are continuously contributing to source code. If you haven’t used GitHub before, you can sign up for a free account.

            Hercuko

Heroku is a platform as a service (PaaS) that enables the deployment of web apps based on a managed container system, with integrated data services and a powerful ecosystem. In simple words, this will allow you to take the application from your local machine to the cloud so that anybody can access it using a Web URL. In this tutorial, we have chosen Heroku for deployment as it provides free resource hours when you sign up for a new account.

Reference

[1]  Build and deploy your first machine learning web app

[2]  How to Create and Deploy a Machine Learning App to Heroku

Host Machine Learning App Free On Heroku

 

Last modified: Saturday, 18 March 2023, 2:51 PM