The quickest way to build Dashboards for Machine Learning models | by Jaswanth Badvelu | Towards Data Science

Using explainerdashboard library for quickly building interactive dashboards for analyzing and explaining the predictions and workings of machine learning models
Most of the data scientist’s job revolves around collecting data and creating machine learning models for business problems. While building complex machine learning models is difficult, conveying the predictions of trained machine learning models to stake holder’s with no technical background is even more cumbersome. This is where python packages like Tabpy and explainerdashboard come in handy. In my previous article, I explained how to integrate trained machine learning models directly with tableau using the Tabpy package.
towardsdatascience.com
In this article, I am going to discuss implementing an excellent python package called explainerdashboard. The explainerdashboard package helps analyzing machine learning models by creating interactive visual dashboards. Beginners that are trying to break into data science or experienced data science professionals looking to better understand different attributes of their model can use this package and it just takes 2 lines of extra code to create basic dashboards.
Just like most other python packages, this package can be installed by using the command pip install explainerdashboard.
The famous Titanic dataset is used here to showcase the features of the random forest classification model in an interactive dashboard format.
After creating the machine learning model, using Randomforestclassifier from the sci-kit package. We can customize the features we want to display in the dashboard using the classifierexplainer .
The below image is the sample dashboard we get after starting the dashboard using the code line ExplainerDashboard(name).run()
To run the dashboard in the inline notebooks like the jupyter notebook we can use inlineexplainer
Now, we can analyze the feature importance and individual decision tree’s with custom metrics in the dashboard to better understand the performance of the ML model. More information about creating custom dashboards can be found in the official documentation of explainerdashboard here.
After analyzing the machine learning models, deploying them into production is also very easy. It is recommended in the official documentation to use robust production servers like gunicorn or waitress to deploy the dashboard instead of the built-in flask development server.
Install gunicorn or waitress using the command pip install gunicorn or pip install waitress.
Before starting the dashboard and deploying the model, we should save our explainer model to the disk this can be done by dumping the model.
After saving the model to the disk, we can load the explainer model from the file and then start the dashboard, and then we can expose the flask server as app:
Here, I saved the file as flaskserver.py Now we can start the gunicorn server by using the following command:
$ waitress-serve --port=8050 dashboard:app
The code and images used in this article are taken from the official documentation and Github repository of the library.
I hope that’s useful! Thank you for reading my article. If you have any questions regarding this article or want to connect and talk, feel free to direct message me on LinkedIn. I will be more than happy to connect with you and help in any way I can.