Create a Web-based Application using XGBoost
The implementation uses six features which are important to classify the stages of the disease and XGBoost to develop the web-based application. The features are CDRSB, Alzheimer’s Disease Assessment Scale (ADAS11), Rey Auditory Verbal Learning Test (RAVLT) immediate, MRI of whole brain and age of the subject at the time of the visit to the clinic. This is a continuation from here.
Implementation, Evaluation and Result of XGBoost
XGBoost library is used for implementation and function used to implement is XGBClassiﬁer() with 100 estimators. It is trained on the training data and evaluated on test data. It resulted in predicting normal with AUROC score of 0.62 against dementia and MCI, MCI with AUROC score of 0.54 against normal and dementia and classify dementia with AUROC score of 0.90 against normal and MCI. Therefore, it is not a good model for the selected features and requires more training to improve the performance of the model. The project implements the application as a proof of concept.
Interpreting Machine Learning Model
In the figure, red means feature has a high impact and blue means feature has a low impact on the model.
After plotting the sum of SHAP value magnitude over all samples for each feature, it is observed that CDRSB and ADAS11 push the prediction higher while MMSE, RAVLT immediate and MRI of the whole brain push the predictions lower. CDRSB has a big impact on the model output with a value of 0.6. ADAS11 has a small impact on the model.
The figure takes the absolute mean value of the SHAP values for each feature. CDRSB is the most important feature followed by MRI of whole brain and MMSE.
The impact of CDRSB is increased to a mean SHAP value to 0.42 when the number of selected features is reduced than in implementation in section 4.8.3. ADAS11 and age at the time of the visit to the clinic have a small contribution to the model.
Implementation, Design and Deployment of Web-based Application
The components of the web-based application are deployed on Heroku platform using Flask framework, Hypertext Markup Language (HTML) and Cascading Style Sheets (CSS). The process of deploying the application is as follows:
- Download git and install it to send local ﬁles to the online web server or cloud.
- Sign up for a free account on Heroku website.
- Download and install Heroku Toolbelt. Heroku Toolbelt is a package that allows interacting with the Heroku cloud through computer command.
- Make a git repository for the app by typing: “git init”
Start interacting with Heroku account by typing: “heroku login”
- Create a custom Heroku app: “heroku create ad-model”
- Generate the required Heroku ﬁles:
- Create a Procﬁle by typing: “web: gunicorn app:app”
- Create a requirements.txt ﬁle to tell Heroku which packages to install for web app by typing: “Flask”, “Pandas”, “gunicorn”, “sklearn”, “xgboost”.
- Add all local ﬁles to the online repository by typing: “git add .”
- Commit your ﬁles by typing: “git commit m First commit”
- Set the remote destination for pushing from git to Heroku : “heroku git:remote -a ad-model”
- Push application to Heroku by typing: “git push heroku master”
12. Ensure at least one instance of the app is running by typing: “heroku ps:scale web=1”
- Check out the deployed web-based application by visiting the link for the responsive application.
- It requires the following inputs to make the prediction:
- CDRSB: minimum value of 0, a maximum value of 18 and step size of 0.5
- ADAS11: minimum value of 0, a maximum value of 70 and step size of 0.33
- MMSE: minimum value of 0, a maximum value of 30 and the step size of 1
- RAVLT immediate: minimum value of 0, a maximum value of 75 and step size of 1
- MRI of whole-brain: minimum value of 649091, a maximum value of 1486040 and step size of 100
- Age: minimum value of 55 and maximum value of 75
The report continues here.