Abstract
Model agnostic tool for decomposition of predictions from black boxes. Supports additive attributions and attributions with interactions. The Break Down Table shows contributions of every variable to a final prediction. The Break Down Plot presents variable contributions in a concise graphical way. This package works for classification and regression models. It is an extension of the 'breakDown' package (Staniak and Biecek 2018), with new and faster strategies for orderings. It supports interactions in explanations and has interactive visuals (implemented with 'D3.js' library). The methodology behind is described in the 'iBreakDown' article (Gosiewska and Biecek 2019). This package is a part of the 'DrWhy.AI' universe (Biecek 2018).
Introduction
As machine learning models like Gradient Boosted Trees or Deep Neural Networks become more complex, they often become "black boxes"—we see the input and the output, but the logic in between is obscured. This is a major hurdle in high-stakes fields like medicine or finance, where understanding why a specific prediction was made is as important as the prediction itself.
Existing tools often struggle with two things: computational efficiency and feature interactions. If a model decides a loan applicant is high-risk because of the combination of their age and debt level (an interaction), a simple additive model might miss the nuance. iBreakDown addresses this by providing a model-agnostic framework to calculate instance-level attributions that account for these complex relationships without requiring the user to understand the internal math of the underlying model.
Methodology: Sequential Variable Conditioning
The package centers on Sequential Variable Conditioning. To explain a prediction, the algorithm calculates how the expected value of the model changes as variables are "fixed" to the values of the specific instance being explained.
Local Attributions and Interaction Detection
Unlike many basic explainers, iBreakDown can identify and attribute value to pairs of variables that influence the model more strongly together than they do separately. The algorithm calculates the contribution of each variable to the final prediction. By using a complexity of $O(2 \cdot p^2)$ for interactions, it provides a computationally feasible way to see how variables team up to sway a model.
As shown in the parameter list above, users can explicitly control whether interactions are included and specify the order of variables, which is crucial for the greedy sequential conditioning approach.
Uncertainty Estimation
Through the break_down_uncertainty function (and its shap wrapper), the tool runs the algorithm across multiple random variable orderings. This helps users see if an attribution is stable or if it’s highly sensitive to the order in which features are processed. This approach bridges the gap to SHAP (Shapley Additive Explanations), treating SHAP as an average of Break Down attributions over random permutations.
The B parameter allows users to define the number of random paths to explore, balancing computational cost with the precision of the uncertainty estimate.
Key Features and Visualization
- The Power of the Waterfall: The "Break Down Plot" uses a waterfall chart format. It starts at the average model prediction and shows, step-by-step, how each variable (or interaction) pushes the prediction toward the final value.
- Natural Language Generation: The
describefunction uses a "claim-support-evidence" framework to generate human-readable text explaining the model's "reasoning." - Interactive Visuals: The inclusion of
plotD3allows for interactive exploration, where users can hover over components to see exact values.
Datasets and Results
The documentation demonstrates the package's versatility using several classic datasets:
- Titanic: Explaining survival predictions in classification tasks.
- HR (Human Resources): Predicting employee attrition.
- Apartments: Explaining real estate price predictions in regression tasks.
The package offers a significant speedup over exhaustive Shapley value calculations. Additive attributions run in $O(2 \cdot p)$ time, where $p$ is the number of features. Because it is model-agnostic, it works equally well on simple linear regressions or complex neural networks.
Conclusion
While iBreakDown is powerful, the "Break Down" algorithm is greedy and dependent on variable ordering. While the package provides faster strategies for orderings, the choice remains a heuristic. Furthermore, while $O(p^2)$ is efficient, models with thousands of features may still face performance bottlenecks. As part of the DrWhy.AI universe, its full potential is realized when used alongside other tools like DALEX for broader model auditing.
Summary updated