Integrating SHAP Library Explanations with BigML Predictions
Interpreting machine learning models can be a challenging task, especially when it comes to understanding the reasons behind a particular prediction. Fortunately, tools like SHAP (SHapley Additive exPlanations) provide a way to explain the impact of each feature on a model’s prediction.
At BigML, we have recently integrated the SHAP library with our platform, making it easier for our users to leverage this powerful tool. In a recent interaction with an academic user, we were asked about integrating our local model predictions with SHAP’s explanation plots. This prompted us to provide a more streamlined path for handling such scenarios, leading to the development of the ShapWrapper class in our Python bindings.
In this blog post, we dive into the details of using SHAP with BigML’s supervised models. From creating interpretable decision tree models to handling classification tasks with categorical features, we walk you through the steps of building, training, and interpreting your machine learning models.
We start with a regression example using the California House Pricing dataset, demonstrating how SHAP can be used to explain the contributions of each feature to the predicted housing prices. We then move on to a classification example, where we predict churn using a model trained on categorical data. We showcase how one-hot encoding is automatically applied to categorical fields when creating the Numpy array for SHAP explanations.
Finally, we explore how SHAP can be used to explain probabilities, using a logistic regression model on the Diabetes dataset as an example. We show how the force plot can be used to visualize the contributions of each feature to the predicted probability of a diabetic diagnosis.
By integrating SHAP with BigML’s Python bindings, we aim to empower our users to gain deeper insights into their machine learning models and make more informed decisions. We hope that these examples will help you better understand the predictions of your models and make machine learning more accessible to everyone.
If you’re interested in trying out SHAP with BigML, check out the jupyter notebook provided in this post for step-by-step instructions. And as always, feel free to reach out to our chat support team if you have any questions or need assistance. Happy modeling!