
Machine Learning Dashboards are a great way to interpret models. These usually describe the inner working of the model and provides interactive plots to discover model performance, feature importances, or "what if" analysis! All this can is generated with a few lines of code plus if you want, you can customize all the elements of the Dashboard and disable the metrics or the tabs you don’t require. Want to know how? Let’s discover!
ExplainerDashBoard
As the name suggests, this Python package enables us to build up a web app or inline notebook based explainable dashboard. What this means is that the various components of the dashboard are self-explanatory and you need not explicitly define each of them. It presents all the interactive components with the help of Dash, for all the plots it uses Ploty and runs on a flask server as a web app. To install it simply use pip:
pip install explainerdashboard
I would suggest doing this in a separate virtual environment as this package has a lot of dependencies and any version conflict should be avoided. After installing this you are ready to generate cool dashboards!
Example DashBoard
To simplify the explanations, I would be using the code provided in the documentation of the explainer dashboard:
Let’s understand the code:
- In the first line, we are simply importing the Scikit-learn machine learning models. For this example, the famous titanic dataset, the Random Forest classifier is chosen.
- Now comes the beast, the explainer dashboard. According to the documentation, any type of model is placed under the explainers category. You can import any of the four explainers: classifier, regressor, xgboost, or random forest. Here we are using the classifier explainer.
- This package comes with an example dataset and that is being imported in the third line. The titanic_survive returns the training and test data whereas the feature_description is a dictionary object with keys as the feature names and values describing what it is. The description is optional but if included will make the dashboard more informative.
- After that, a model is trained with 50 estimators and 10 max_depth of the trees.
- Now we need to create an explainer object that takes in the model, test data, and other optional parameters such as specifying categorical data will allow the dashboard to group them and use it to plot graphs following these columns. You can check the parameters in the documentation.
- The ExplainerDashboard API takes in the explainer created and the run function initiates the process.
See the end product generated by this code:

As you can see all the GUI, plots, web interface has been generated by this package without asking much from the user! But you must be wondering: Can this dashboard be customized according to our needs? The developers of this package have provided amazing modularity to this program which allows customization at every level!
Customizing The DashBoard
Now that our base app is ready, we can choose what things we need to display and change some of the settings. These are the things that can be modified in ExplainerDashboard:
- There are multiple tabs displayed on the dashboard such as importance, model_summary, contributions, what if, shap_dependence, shap_interaction, and decision_trees. You should switch the tabs only if they are required as they can take a lot of computation time. These are simply boolean inputs.
- The title, description, and name of the dashboard can be provided. The header title can be toggled on or off.
- 4 types of modes are there to start the application: Flask, dash, inline, or jupyterlab. The inline mode allows you to run it in the jupyter notebook or Google Colab!
- As the UI of the app is based on Dash Bootstrap Components, you can choose any theme from the official site and pass it in this class, or if you wish you can provide custom CSS.
- Basic Dash Authentication can be provided to secure the dashboard from unwanted access.
- Any component of the dashboard such as toggles, tables, graphs can be controlled via boolean inputs. For instance, hide_treepathtable=True will hide this component in the decision trees tab.
- You can design the whole layout of the DashBoard on your own by inheriting the ExplainerComponent from explainerdashboard.custom.
Here is an example where I customized some of the elements of the dashboard:

Conclusion
This was a brief introduction to ExplainerDashboard and how to set up the apps. This package has a lot of potentials to develop more complicated dashboards. Of course, if you are aiming to develop a sophisticated dashboard with much more interactivity than the default one, then it is not possible within 10 lines of code! To explore more about this package, do check out the documentation and GitHub repo of the same.
If you want to write more of these cool Python and Data Science related stuff then make sure to follow me on Medium and I will meet you next time!
My Previous Hits:
Rebuilding My 7 Python Projects
Connect with on:
Kaustubh Gupta – Machine Learning Writer – upGrad | LinkedIn






