mars – Multivariate Adaptive Regression Splines (Friedman 1991).#
Back to family axis | Back to L4 | Browse all options
Operational op under axis
family, sub-layerL4_A_model_selection, layerl4. Standalone callable:mf.functions.mars_fit.
Function signature#
mf.functions.mars_fit(
X: np.ndarray | pd.DataFrame,
y: np.ndarray | pd.Series,
) -> MARSFitResult
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
`np.ndarray |
pd.DataFrame` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
Returns#
MARSFitResult — frozen dataclass with fit results.
Attribute |
Type |
Description |
|---|---|---|
|
|
Number of MARS basis terms. |
|
|
Number of input features. |
|
|
Predictions for new data X, shape (n_samples,). |
|
|
Table: term count and feature count. |
Behavior#
Greedy forward / backward selection of piecewise-linear hinge basis functions max(0, x - c) and their products. Atomic primitive – sklearn does not provide a MARS implementation. Runtime wraps pyearth as an optional dep; install via pip install macroforecast[mars]. Required as the base learner for the Coulombe (2024) ‘MARSquake’ recipe (bagging(base_family=mars, ...)).
Operational from v0.9.0; raises NotImplementedError with an install hint when pyearth is not present (mirrors the xgboost / lightgbm / catboost optional-dep error pattern).
When to use
Non-linear regression with interpretable basis functions; MARSquake recipe base learner.
When NOT to use
Without [mars] extra installed – raises a clear NotImplementedError.
In recipe context#
Set params.family = "mars" in the relevant layer to activate this op within a recipe:
# Layer L4 recipe fragment
params:
family: mars
References#
macroforecast design Part 2, L4: ‘forecasting model is the layer where every authoring iteration ends – pick family, tune, repeat.’
Friedman (1991) ‘Multivariate Adaptive Regression Splines’, Annals of Statistics 19(1).