Learning outcomes
After completing this lesson, you will be able to:
- Explain the structure of a GAM and the roles of the link function, intercept and feature functions.
- Interpret shape-function plots and distinguish a feature contribution from a causal effect.
- Explain how EBM combines an additive structure, boosting, bagging and constrained pairwise interactions.
- Distinguish a global model explanation from a local explanation of an individual prediction.
- Evaluate predictive quality, stability, complexity and limitations before using GAM/EBM in practice.
How can we build a nonlinear model that remains useful for prediction while allowing people to inspect how each feature contributes?
1. From interpretable nonlinear models to additive models
The previous lessons introduced thresholds, trees and rules as ways to represent nonlinear patterns. Trees create stepwise regions, while long rule lists become difficult to review. Another approach represents a prediction as a sum of separate feature functions. This is the idea behind Generalized Additive Models (GAMs).Instead of assigning one constant coefficient to each feature, a GAM estimates a function describing how that feature contributes across its range. The overall structure remains additive: each contribution can be inspected separately and then summed.Additivity is both a restriction and a source of clarity. Without interactions, the contribution of temperature does not depend on vibration. This is easier to inspect, but may be insufficient when combinations of features carry additional information.2. The structure of a GAM
A typical GAM is written asg(E[y]) = β₀ + f₁(x₁) + f₂(x₂) + … + fₚ(xₚ). Here β₀ is the intercept, fⱼ is the shape function for feature xⱼ, and g is the link function. In Gaussian regression the link may be the identity; logistic classification commonly uses the logit link.Each fⱼ describes a feature contribution on the linear-predictor scale. For example, a temperature function may rise slowly, become steeper, and then level off. The model is not restricted to a constant change in prediction for every one-unit increase in temperature.In practice, shape functions may use smoothing splines, local smoothers or other basis representations. Complexity is controlled through penalties on excessive wiggliness, the number of knots or basis functions, and smoothing settings.3. Reading shape functions
A plot of fⱼ shows a feature contribution on the linear-predictor scale—not necessarily a probability or risk by itself. The horizontal axis usually shows the feature value; the vertical axis shows its estimated contribution. A zero line often serves as a reference after the chosen centering convention.If the curve rises, larger feature values in that range increase the linear predictor; if it falls, they decrease it. A flat segment indicates little change in contribution. A sharp bend may suggest a nonlinear region, but it must be checked against the number and distribution of observations.Data support and uncertainty matter. The edges of a feature range often contain few observations, so estimated shapes can be unstable there. Show a histogram or rug marks, uncertainty bands where available, and avoid claims outside the observed data range.4. Smoothing, regularization and the trade-off
An overly flexible function may follow noise: it looks expressive on training data but changes unpredictably on new observations. Excessive smoothing can hide genuine bends or threshold-like patterns. GAMs require a balance.Spline-based GAMs commonly use a penalty on curvature or another measure of complexity. The smoothing parameter controls how strongly wiggliness is penalized. Choose it through validation or an appropriate selection criterion, without using the test set for tuning.Do not interpret every local bend as a domain law. Compare functions across resamples, time periods and subgroups; inspect data density; and account for correlated features. With strong correlation, different fits may distribute shared signal differently across feature functions.If a temperature curve changes sharply in a range with almost no observations, should that segment be trusted? No: weak data support makes it sensitive to smoothing and extrapolation.
5. Interactions: when separate effects are not enough
An additive GAM assumes that feature effects sum. Sometimes the effect of one feature depends on another. For example, a temperature increase may be especially informative when vibration is already high. Such patterns require interactions.An extended model can include pairwise terms:g(E[y]) = β₀ + Σ fⱼ(xⱼ) + Σ fⱼₖ(xⱼ,xₖ). The function fⱼₖ captures an additional joint contribution that cannot be represented by adding the two individual effects.Interactions increase flexibility and make explanations more demanding. A pair may require a two-dimensional surface, heat map or slices. Limit the number of interactions, justify them using domain knowledge, and check whether the data adequately cover the feature combinations.6. EBM: an additive model trained with boosting
Explainable Boosting Machine (EBM) is a modern GAM/GA²M-family implementation. It preserves an additive structure but learns shape functions using ensembles of shallow trees and gradient boosting. A typical workflow first learns main effects for individual features, then may add selected pairwise interactions.In simplified form, EBM can be written like a GAM:g(E[y]) = β₀ + Σ fⱼ(xⱼ) + Σ fⱼₖ(xⱼ,xₖ). The difference lies in how functions are learned and controlled: binning, sequential or cyclic updates, bagging and regularization are used. Exact details depend on the library version and parameters.EBM is not simply one decision tree, nor is it an ordinary random forest. Many small trees are used to construct separate terms. The final model can still be inspected through feature functions and individual term contributions. InterpretML provides global explanations of effect shapes and local explanations of term contributions to a particular prediction.| EBM component | Role | What to inspect |
|---|---|---|
| Main effects fⱼ | One function per feature | Shape, data range and uncertainty |
| Pairwise terms fⱼₖ | Additional interaction between two features | Justification, complexity and coverage |
| Boosting | Improves functions iteratively | Overfitting and stopping settings |
| Bagging | Fits multiple bags/models to improve robustness and estimate variation | Variation of functions and repeatability |
7. Global and local EBM explanations
A global explanation asks: how does the model use a feature overall? Inspect its shape function, the distribution of observations and term importance. A local explanation asks a different question: which contributions produced this particular prediction?In an additive model, local contributions are summed. For one pump, the model may show that high vibration raises the risk score, normal pressure lowers it, and temperature adds a small positive contribution. This explains the model’s arithmetic; it does not prove that these variables causally affect failure.Interactions can change the local contribution of a feature pair. Therefore, a standalone fⱼ plot is not a complete description of xⱼ in every context when fⱼₖ terms are present. Also consider the link function: the sum usually lives on the linear-predictor scale, and a probability is obtained after the inverse transformation.8. Practical protocol: build and validate a GAM/EBM
Consider ranking industrial pumps by their risk of failure in the next seven days. Available data include vibration, temperature, pressure, operating hours and maintenance history. Compare logistic regression, a GAM and an EBM while preventing future-information leakage.- Define the prediction time and target window. Exclude features recorded after failure or maintenance.
- Split by time. Use train, validation and test sets. Tune smoothing, interaction count and stopping without access to the test set.
- Fit a simple baseline. Logistic regression provides a reference point.
- Fit a GAM. Choose shape functions and smoothing; inspect plots and regions with weak support.
- Fit an EBM. Start with main effects, then compare no-interaction and a small number of justified pairwise terms.
- Compare performance and calibration. Use metrics aligned with false-alarm and missed-failure costs; do not rely on accuracy alone.
- Audit explanations. Inspect global functions, local contributions, uncertainty, temporal stability and subgroup behavior.
- Document boundaries. Record data scope, limitations, library version, parameters and cases requiring expert review.
| Criterion | GAM | EBM |
|---|---|---|
| Effect shape | Often smooth functions such as splines | Functions learned through boosting over bins/trees |
| Interactions | Added explicitly through the model specification | May be detected automatically or specified manually |
| Controls | Basis choice and smoothing penalty | Binning, interaction count, regularization, bagging and stopping |
| Interpretation risks | Complex shapes and correlated features | Too many terms, interactions and fine bins |
9. Limitations and takeaways
GAMs and EBMs make nonlinear models more inspectable, but they do not turn statistical association into causal explanation. Plots may be unstable with sparse data, correlated features, drift or a poor specification. A local sum of contributions explains the model calculation, not necessarily the real-world mechanism.Interactions increase expressiveness and complexity at the same time. With many features and pairs, a global overview may no longer be compact. Complexity control, repeated checks, an independent test set and domain-expert review remain important.In summary: a GAM represents nonlinearity as a sum of feature functions. An EBM uses a related additive structure and learns it with boosting, bagging and, when appropriate, pairwise interactions. Both support global shape inspection and local contribution analysis—provided these explanations are validated against data and the task context.Can we explain which functions and interactions formed a prediction, show where data are insufficient, and verify that performance holds on new observations?
Next learning step
Module 6.2 is complete. The curriculum now moves to the next Track A theme; use lesson navigation and the knowledge map to continue.
Open knowledge map ↗References and further reading
- Hastie & Tibshirani (1986), Generalized Additive Models — The foundational article introducing generalized additive models.
- InterpretML: Explainable Boosting Machine — Describes EBM’s additive structure, main effects, interactions, and global/local explanations.
- InterpretML: ExplainableBoostingClassifier API — Training parameters, bagging, binning, smoothing, interactions and controls.
- Lou et al. (2013), Accurate Intelligible Models with Pairwise Interactions — Research foundation for GA²M models with pairwise interactions.
Lesson glossary
A model whose predictor is a sum of feature-specific functions.
A function defining one feature’s contribution to an additive predictor.
A function connecting the target expectation to the linear predictor.
A method for limiting excessive variation in an estimated function.
An additional joint effect of a pair of features.
An additive model that learns shape functions with boosting and can include constrained interactions.
Knowledge check
Choose one answer for each question and check it. Feedback explains the key idea.