Skip to content

This is really an interactive app with various predictions model with various algo. It can predict about your health as much as accurate

License

Notifications You must be signed in to change notification settings

bishal7679/Rancher-MLalgo4Health

Repository files navigation

Deploy to AWS ECS

ML Analysis In Healthcare App


ranchertest This is an interactive Machine Learning Web App "ML in Healthcare" developed using Python and StreamLit. It uses differnet ML algorithms to build powerful and accurate models to predict the risk (High / Low) of the user of having a Heart Attack or Breast Cancer based on the user's specific attributes like age, sex, heart rate, blood sugar, etc.

About the App

The app has 2 major sections, first being Model Building. In this section 7 different models are built using different ML algorithms. They are:

1. Logistic Regression 
2. KNN
3. SVM 
4. Decision Trees 
5. Random Forest 
6. Gradient Boosting 
7. XGBoost

An interactive side-dashboard is created using the streamlit st.sidebar call which enables the user to do the following:

  • Choose dataset - Heart Attack / Breast Cancer

  • Choose algorithm - Logistic Regression , KNN , SVM , Decision Trees , Random Forest , Gradient Boosting , XGBoost.

  • Change the important parameters for each model - Learning Rate, Random State, Regularization Coeff, Gamma, Kernel, n_estimators etc.

After training using the parameters selected by the user, the tuned model is built and ready to be tested on our testing data. The classification plot and confusion matrix is displayed for the model selected along with the model metrics: Accuracy, Precision, Recall, F1-Score, Mean Squared Error, Execution Time. The user can observe real-time changes in the plots and metrics as they change the model parameters further.

The 7 models (optimum tuning) performed as follows:
Criterion: Accuracy

Model Accuracy (Heart Attack / Breast Cancer)
Logistic Regression 91.803% / 100.0%
KNN 86.89% / 96.49%
SVM 93.44% / 100.0%
Decision Trees 52.56% / 60.53%
Random Forest 90.164% / 98.24%
Gradient Boosting 88.53% / 96.49%
XGBoost 95.08% / 94.737%

The next section being User Prediction. In this section, the user can use any model developed above to predict their status (High Risk / Low Risk) using their own values. (Either for Heart Attack or Breast Cancer)

Screenshots of the web app:

Flow Chart

Data Source

The models are trained using data from https://archive.ics.uci.edu/ml/index.php, particularly the Heart Attack Prediction and Breast Cancer (Wisconsin) datasets.

How-to Guide


Setting up Rancher on existing cluster

  1. Push the Docker image to DockerHub or ECR
  2. Create Your Cluster on EKS using eksctl tool

Mar-03-08-31

Mar-03-08-57

  1. Run Rancher on your local machine or on virtual machine:

Or use:

sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest
  • Check for whether all pods of Rancher are running or not
  • Mar-03-08-54

  • Now access the Web UI of the Rancher: `http://localhost:80`
  • Rancher UI will open:
  • Mar-03-09-09

    Now Run the command to get your bootstrap password or provide it while installing:

    kubectl get secret --namespace cattle-system bootstrap-secret -o -go-template='{{.data.bootstrapPassword | base64decode}}{{"\n"}}'
  • Create new passwords for Rancher
  • Now on this tab we can create our new cluster or can import an existing one
  • Importing EKS cluster
  • Mar-03-09-18

    Mar-03-09-25

Now Deploying the ML app on created EKS cluster

  1. Ensure that you have k8s tools installed, visit here for more details: https://kubernetes.io/docs/tasks/tools/

  2. If you crated EKS cluster using eksctl tool then no need to add the cluster context on .kube/config. You can access your EKS by context-switching

Mar-03-09-43

  1. Create a namespace kubectl create namespace <namespace>
  2. Apply yaml files:
  • service
  • deployment

Mar-03-09-56

Now access the loadbalancer external-ip on your browser to see the app is running on port :8503

Mar-03-09-58

Want to Deploy this ML app on rancher-k3s cluster???

  • Follow along all the steps here

Want to deploy on ECS cluster???

  • Use this ECR image 420235819919.dkr.ecr.us-east-1.amazonaws.com/mlalgo4health:latest

Want to verify wheather the docker image mlalgo4health:2.0 is signed/verified ???

  • use the cosing.pub key to verify!

Mar-03-10-29

Facing any Issues on Rancher agent disconnected or some error while importing Cluster???

REF :-

About

This is really an interactive app with various predictions model with various algo. It can predict about your health as much as accurate

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published