A black-box model produces predictions without offering a directly understandable account of how inputs became outputs. Its internal structure or parameters may be unavailable, or available but too complex to translate into an intuitive input–output relationship. Deep neural networks are common examples; random forests, AdaBoost, gradient boosting, and Newton boosting can also become black boxes because ensembling creates complex feature interactions. section 9.1.1
Black-box status is about interpretability, not predictive quality. Two models can perform similarly while differing sharply in how readily people can inspect them: a polynomial classifier may be opaque, while a decision tree can express its behavior as understandable decision rules. Glass-box models expose an intuitively comprehensible structure; black-box models generally need specialized explainers. section 9.0 section 9.1.1
Figure 9.1 With black-box machine-learning models, we can only use the input-output pairs to analyze and explain model behavior. The model internals in a black box are either unavailable or aren’t directly interpretable. With glass-box machine-learning models, in addition to input-output pairs, the model internals are also intuitively interpretable.
Compare the information available for explanation: black-box analysis works from input–output pairs, whereas glass-box analysis can also inspect interpretable internals. section 9.1.1
Explain a black box at two complementary scopes:
- Global explanation describes the model’s general decision-making behavior and broadly relevant factors across many examples. Model-agnostic global methods use inputs and outputs rather than internals, so they can apply to any machine-learning model. section 9.3
- Local explanation focuses on why the model made a particular prediction for one example, supporting a decision about what to do next. section 9.3
Explanation matters when a prediction must be acted on or trusted. In diabetes diagnosis, understanding a specific diagnosis can inform prescriptions, preventative care, or palliative care. More generally, explanation supports trust, model debugging, failure-case discovery, performance improvement, and detection of bias or data problems. section 9.0
Explaining an XGBoost model with a surrogate tree
A global surrogate turns an opaque model into an inspectable approximation. Collect examples representative of the original problem distribution, obtain the black box’s predictions for them, and train a glass-box model—such as a decision tree or GLM—to predict those outputs. If surrogate predictions closely match black-box predictions, inspect the surrogate to describe the black box’s behavior. Balance fidelity, meaning how well the surrogate mimics the black box, against interpretability: a more complex tree may match better but be harder to understand. For Bank Marketing, a 14-leaf decision tree is trained on predictions from an XGBoost ensemble. section 9.3.3 section 9.6
Figure 9.11 The procedure to train a global surrogate model from the predictions of a black-box model. Both models are trained on the same surrogate training examples. However, the surrogate model is trained on the predictions of the black-box model, so that it can learn to mimic its predictions. If the black box and surrogate make the same prediction, then the surrogate can be used to explain the black-box model’s prediction.
Follow the surrogate workflow: train the interpretable model on the black box’s predictions, then compare their outputs before using the surrogate as an explanation. section 9.3.3





