Multivariate Adaptive Regression Splines (MARS)

Machine Learning
Introduced by
Jerome H. Friedman
Year
1991
Type
Adaptive piecewise-linear regression

What does it do?

Multivariate adaptive regression splines (MARS), introduced by Jerome Friedman in 1991, is a nonparametric regression method that automatically models nonlinear effects and interactions by combining piecewise-linear 'hinge' functions.

It builds the model in a forward pass that adds the basis functions that most reduce the residual sum of squares, then prunes the overgrown model backward using generalized cross-validation (GCV). The result is a sum of hinge-based terms whose complexity is set from the data.

The intuition behind the method

Instead of assuming a global shape, MARS builds a curve from simple bent lines. Each hinge function is flat on one side of a knot and rises linearly on the other; a mirror-image hinge at the same knot lets the fitted function change slope at that point. Stacking many such hinges, and multiplying hinges from different variables to form interactions, lets MARS approximate nonlinear surfaces while keeping the model a sum of identifiable pieces. The forward pass chooses the knots and the interaction terms greedily, and the backward pass removes the terms that do not improve the fit enough to justify their complexity.

History

Jerome Friedman introduced MARS in a 1991 paper in The Annals of Statistics. He presented it as a flexible, data-driven method for high-dimensional regression that is motivated by recursive partitioning but produces continuous models rather than the discontinuous fits of partitioning methods. The method is also known by the alias 'earth algorithm'.

When to use it

Choose MARS when the response is continuous, several predictors may have nonlinear effects or interactions, and the relationships are not known in advance, but you still want a fitted model that can be read term by term. It is a useful middle ground between generalized additive models, which require the smooth terms and interactions to be specified, and tree ensembles, which are harder to interpret. Avoid MARS when the application requires smooth derivatives, since its fits have kinks at the knots. A spline-based GAM is more suitable when the effects are believed to be additive and smooth. Gradient-boosted trees are often preferable for very large or highly complex predictive tasks where interpretability of the terms is less important than accuracy. If the fitted structure must be stable across resamples, MARS needs explicit checking, because small changes in the data can alter the selected knots.

Limitations and considerations

  • Because the hinge functions are linear between knots, the fitted curve has a change in slope at each knot, which is less smooth than the spline-based fits used in generalized additive models.
  • The greedy forward search can be unstable: small changes in the data can alter the selected knots and the included terms, so the final model may differ between closely related samples. Bagging reduces this variance for MARS less than it does for regression trees (in one published comparison, about 2% RMSE reduction for MARS versus 8.6% for trees).
  • MARS is best suited to nearly additive effects and low-order interactions. In simulation, it recovered a tensor-product structure almost perfectly, but performed substantially worse when the true structure had high-order, neural-network-like interactions.
  • The cost of the forward search grows with the number of candidate variables and the allowed interaction order, which strains the method for high-dimensional problems or high-order interactions.
  • On large and complex predictive problems, gradient-boosted trees are often more accurate than MARS.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Finds nonlinear effects and pairwise or higher-order interactions through the forward search, rather than requiring them to be specified in advance.
  • Produces a continuous fitted function built from hinge pairs, whereas recursive partitioning yields the discontinuous fits the 1991 abstract contrasts it with.
  • The representation can separate additive contributions from the contributions of each multivariable interaction term, which makes the structure of the fit easier to inspect.
  • The GCV-based pruning sets the final number of terms from the data, so the complexity of the model is not chosen by hand.

Applications

  • Regression problems in which the effects are nearly additive and interactions involve only a few variables, the setting the 1991 paper highlights.
  • Exploratory modelling to identify which continuous predictors have nonlinear effects or pairwise interactions.
  • Prediction with a moderate number of continuous predictors when a sum of interpretable basis-function terms is preferred over a black-box model.
  • Separating additive and interaction contributions in a fitted regression model.
  • A comparison model against tree-based ensemble methods on the same regression task.

How it works

How it works

1

The building block is the hinge (truncated linear) function max(0, x − t), together with its mirror image max(0, t − x), defined at a knot t. Each hinge is zero on one side of the knot and linear on the other, so a pair allows the fitted function to change slope at t. The degree-1 hinge form described here is continuous but piecewise linear, with slope changes at the knots. (Friedman's 1991 abstract describes continuous models with continuous derivatives for its product-spline basis; that property depends on using a smoother spline basis than the plain linear hinge.)

Formula
h(x) = \max(0,\ x - t)\ \text{and}\ \max(0,\ t - x)\ \text{(knot at } t)
2

The model is a constant plus a weighted sum of basis functions, where each basis function is either a single hinge or a product of hinges, which may involve different variables. Single hinges represent additive nonlinear effects, and products represent interactions. Because the coefficients enter linearly, the fitted model can be read as a sum of these terms.

Formula
\hat f(x) = \beta_0 + \sum_{m=1}^{M} \beta_m\, B_m(x),\ B_m = \prod_k h_{mk}(x)
3

Starting from a constant, MARS greedily adds the hinge pair (optionally multiplied by an existing basis function to form an interaction) that most reduces the residual sum of squares, searching over candidate variables and knot locations. The forward pass is intentionally generous and produces a large model that captures structure the final model may not need.

Formula
\text{greedily add the hinge pair (and interaction) reducing RSS most}
4

The overgrown model is then pruned by repeatedly removing the basis function whose deletion least increases the error. The subset that minimizes GCV is kept. In the GCV criterion, the term C̃(M) is an effective number of parameters: it grows with the number of basis functions M and includes an additional penalty for each knot selected, controlled by a penalty parameter. GCV divides the residual error per observation by a factor that shrinks as C̃(M) grows, so it penalizes models with many terms and approximates leave-one-out error. The exact form of the penalty is given in Friedman (1991).

Formula
\min \ \text{GCV} = \dfrac{\text{RSS}/n}{(1 - \tilde C(M)/n)^2}

Common pitfalls

  • Allowing a high maximum interaction degree, which increases the risk of overfitting and makes the interaction terms difficult to interpret.
  • Treating a single pruned model as final without assessing how much its selected knots and terms change across resamples.
  • Relying on GCV alone; it is an approximation to leave-one-out error, so cross-validation on held-out data is a useful check where it is feasible.
  • Expecting smooth first derivatives from the degree-1 hinge fit, since the slope changes at each knot.
  • Assuming MARS is automatically the best choice: in one published churn study, logistic regression with stepwise feature selection achieved an AUC about 1.7–1.8% higher than MARS.

Frequently asked questions

What is a hinge function?

A hinge (or truncated linear) function is zero on one side of a knot and increases linearly on the other, like max(0, x − t). Pairing a hinge with its mirror image lets the fitted function change slope at the knot. MARS combines many such hinges, and products of hinges across variables represent interactions.

How does MARS differ from a regression tree?

Both partition the predictor space adaptively, but a regression tree produces piecewise-constant predictions, whereas MARS produces continuous predictions built from spline basis functions. The 1991 abstract presents continuity as the key difference from recursive partitioning, and states that its product-spline models also have continuous derivatives. With the plain degree-1 hinge form used on this page, the fit is continuous but its slope changes at the knots.

How does MARS avoid overfitting?

It deliberately overfits in a forward pass that adds many basis functions, then prunes them in a backward pass. The subset kept is the one that minimizes the generalized cross-validation (GCV) criterion, which penalizes model complexity as an approximation to leave-one-out error. Because GCV is only an approximation, held-out validation or cross-validation should still be used where feasible.

Related methods

Sources

  1. Friedman, J. H. (1991). Multivariate adaptive regression splines. The Annals of Statistics, 19(1), 1–67.

    Open DOI reference