Multiple linear regression assumes each predictor contributes linearly to the outcome:
This is easy to interpret ( is “the effect of ”) but often wrong — real relationships curve, plateau, or have thresholds that a straight line can’t capture.
Generalized Additive Models
GAMs relax the linearity assumption on each predictor individually, while keeping the additive structure:
Each is a smooth function — typically a spline — fit from the data rather than assumed linear. Critically, the model is still additive: no interaction terms between predictors unless explicitly added, which is what keeps GAMs interpretable compared to a full black-box model.
Why not just use a neural network?
You could — but GAMs give you a plot of for each predictor, letting you actually see the shape of the relationship: does risk increase linearly with age, or is there a nonlinear jump after 60? A neural network won’t hand you that visualization for free.
from pygam import LinearGAM, s
gam = LinearGAM(s(0) + s(1) + s(2)).fit(X, y)
gam.summary()
# Plot the learned shape function for predictor 0
XX = gam.generate_X_grid(term=0)
plt.plot(XX[:, 0], gam.partial_dependence(term=0, X=XX))
The tradeoff is real: GAMs are more flexible than linear regression but still far more constrained — and more interpretable — than a fully unconstrained model.