Machine learning predictive models are widely used in many areas of business and research. Their rising popularity is due to them beeing effective but often lead to problems with explaining their prediction. This has led to development of many Interpretable Machine Learning tools, e.g. DALEX (Biecek 2018) R package, lime (Ribeiro, Singh, and Guestrin 2016) and shap (Lundberg and Lee 2017) Python packages and H2o.ai Driverless AI (Gill, Kurka, and Phan 2017).
Nowadays, we can see a huge demand for automation in many areas. This is how Automated Machine Learning and Automated Exploratory Data Analysis came to existence. AutoML (Truong et al. 2019) and AutoEDA (Staniak and Biecek 2018) tools not only speed up the model development process but also often lead to new discoveries or higher quality of models.
Explaining predictive models might be a time consuming and tedious task. Libraries for interpretable machine learning (Biecek 2018), (Molnar, Casalicchio, and Bischl 2018), (Meudec 2019), (Carme 2019), (Jenkins et al. 2019) require high programing skills and endless exploration of different aspects of a predictive model.
There are tools for automation of the XAI process like modelDown (Romaszko et al. 2019) which generates static HTML site and compares various models and explains them. But such tools generate static reports and are focused on global level explanations.
modelStudio packageThe modelStudio R package automates the process of model exploration. It generates advanced interactive and animated model explanations in the form of a serverless HTML site. It combines R (R Core Team 2019) with D3.js (Bostock 2016) to produce plots and descriptions for various local and global explanations. Tools for model exploration unite with tools for EDA to give a broad overview of the model behaviour.
The usage of modelStudio is meant to be intuitive and simple. The computation time needed to produce the output might not be short though. The main goal of this tool is to make model explaining more automated and achieve higher quality explanations by juxtaposition of complementary aspects of a model.
Comparing instance level explanations and model level explanations side by side adds wider context and allows for deeper understanding. modelStudio helps to study relations between various methods for model explanation like Break Down, SHAP, Partial Dependency Plots, Feature Importance and others.
The package modelStudio is available on CRAN. It can be installed using the install.packages('modelStudio') command. This package is based on DALEX explainers created with DALEX::explain(). Below there is a basic code example, which produces demo.
library("modelStudio")
# Create a model
model <- glm(survived ~., data = DALEX::titanic_imputed, family = "binomial")
# Wrap it into an explainer
explainer <- DALEX::explain(model, data = DALEX::titanic_imputed[,-8],
y = DALEX::titanic_imputed[,8], label = "glm")
# Pick some data points
new_observations <- titanic_small[1:4,]
rownames(new_observations) <- c("Lucas", "James", "Thomas", "Nancy")
# Make a studio for the model
modelStudio(explainer, new_observations)
Examplary HTML output layout.
The generated HTML site has many interactive features. One can choose which plots are displayed on the grid and change them at any given moment by clicking the X symbol. A drop down list may be used to pick the observation that will be considered for local explanation plots. One may manipulate plots having a variable-based dimension by selecting corresponding bars on the other plots. Mousing over the D symbol displays a description of the plot. Finally, mousing over lines and bars displays the tooltip.
1. Open in a browser or save as HTML document or PNG image 2. Click on bars to choose which feature will be used for other plots 3. Mouse over the D symbol to display a description of the plot and click X to close the plot 4. Choose which observation will be used for local explanations 5. Mouse over lines and bars to display the tooltip 6. Click on the text to choose the plot 7. Interact with other elements like a slider
Seven possible plots to choose from are implemented. There are three local explanation plots, three global explanation plots and a feature density plot.
Local explanations are designed to better understand model behaviour around a single observation.
Break Down plot and SHAP Values (Lundberg and Lee 2017) plot present variable contributions to a model prediction (Gosiewska and Biecek 2019). Both of them come from the iBreakDown (Biecek, Gosiewska, et al. 2019) R package.
Ceteris Paribus plot presents model responses around a single point in the feature space (Biecek 2019).
Global explanations are designed to allow for better understanding of how the model works in general, for some population of interest.
Feature Importance plot presents permutation based feature importance (Fisher, Rudin, and Dominici 2018).
Partial Dependency plot presents averages from N number of Ceteris Paribus Profiles (Greenwell 2017).
Accumulated Dependency plot presents accumulated local changes in Ceteris Paribus Profiles (Apley 2016).
Detailed overview of these methods can be found in “Predictive Models: Explore, Explain, and Debug” (Biecek and Burzykowski 2019). The last explanations are implemented in the ingredients (Biecek, Baniecki, et al. 2019) R package.
The modelStudio package is easy to use and its output is intuitive to explore. Automation is convenient and interactivity adds another dimension to visualisations. All of this enhance explanation of machine learning predictive models. More features and examples can be found in the vignette: modelStudio - perks and features and on GitHub.
Work on this package was financially supported by the ‘NCN Opus grant 2016/21/B/ST6/02176’.
Apley, Daniel W. 2016. “Visualizing the Effects of Predictor Variables in Black Box Supervised Learning Models.” arXiv Preprint arXiv:1612.08468.
Biecek, Przemyslaw. 2019. CeterisParibus: Ceteris Paribus Profiles. https://CRAN.R-project.org/package=ceterisParibus.
Biecek, Przemyslaw, Hubert Baniecki, Adam Izdebski, and Katarzyna Pekala. 2019. Ingredients: Effects and Importances of Model Ingredients. http://CRAN.R-project.org/package=ingredients.
Biecek, Przemyslaw, and Tomasz Burzykowski. 2019. Predictive Models: Explore, Explain, and Debug. https://pbiecek.github.io/PM_VEE/.
Biecek, Przemyslaw, Alicja Gosiewska, Hubert Baniecki, and Adam Izdebski. 2019. IBreakDown: Model Agnostic Instance Level Variable Attributions. https://CRAN.R-project.org/package=iBreakDown.
Biecek, Przemysław. 2018. “DALEX: explainers for complex predictive models.” http://arxiv.org/abs/1806.08915.
Bostock, Mike. 2016. “D3.js-Data-Driven Documents (2016).” URL: Https://D3js.org.
Carme, Antoine. 2019. Sklearn Explain. https://github.com/antoinecarme/sklearn_explain.
Fisher, Aaron, Cynthia Rudin, and Francesca Dominici. 2018. “All Models Are Wrong but Many Are Useful: Variable Importance for Black-Box, Proprietary, or Misspecified Prediction Models, Using Model Class Reliance.” arXiv Preprint arXiv:1801.01489.
Gill, Navdeep, Megan Kurka, and Wen Phan. 2017. “Machine Learning Interpretability with H 2 O Driverless.” In.
Gosiewska, Alicja, and Przemyslaw Biecek. 2019. “IBreakDown: Uncertainty of Model Explanations for Non-Additive Predictive Models.” arXiv Preprint arXiv:1903.11420.
Greenwell, Brandon M. 2017. “pdp: An R Package for Constructing Partial Dependence Plots.” The R Journal 9 (1): 421–36. http://journal.r-project.org/archive/2017/RJ-2017-016/index.html.
Jenkins, Samuel, Harsha Nori, Paul Koch, and Rich Caruana. 2019. InterpretML. https://github.com/microsoft/interpret.
Lundberg, Scott M, and Su-In Lee. 2017. “A Unified Approach to Interpreting Model Predictions.” In Advances in Neural Information Processing Systems 30, edited by I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, 4765–74. Curran Associates, Inc. http://papers.nips.cc/paper/7062-a-unified-approach-to-interpreting-model-predictions.pdf.
Meudec, Raphael. 2019. Interpretability Methods for Tf.keras Models with Tensorflow 2.0. https://tf-explain.readthedocs.io.
Molnar, Christoph, Giuseppe Casalicchio, and Bernd Bischl. 2018. iml: An R package for Interpretable Machine Learning. Journal of Open Source Software. Vol. 3. https://doi.org/10.21105/joss.00786.
R Core Team. 2019. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Ribeiro, Marco Tulio, Sameer Singh, and Carlos Guestrin. 2016. “"Why Should I Trust You?": Explaining the Predictions of Any Classifier.” In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, ca, Usa, August 13-17, 2016, 1135–44.
Romaszko, Kamil, Magda Tatarynowicz, Mateusz Urbański, and Przemysław Biecek. 2019. “modelDown: Automated Website Generator with Interpretable Documentation for Predictive Machine Learning Models.” Journal of Open Source Software 4 (38): 1444. https://doi.org/10.21105/joss.01444.
Staniak, Mateusz, and Przemysław Biecek. 2018. “Explanations of model predictions with live and breakDown packages.” http://arxiv.org/abs/1804.01955.
Truong, Anh, Austin Walters, Jeremy Goodsitt, Keegan Hines, C. Bayan Bruss, and Reza Farivar. 2019. “Towards Automated Machine Learning: Evaluation and Comparison of Automl Approaches and Tools.” ArXiv abs/1908.05557.