huber – Huber regression (robust to outliers).#

Back to family axis | Back to L4 | Browse all options

Operational op under axis family, sub-layer L4_A_model_selection, layer l4. Standalone callable: mf.functions.huber_fit.

Function signature#

mf.functions.huber_fit(
    X: np.ndarray | pd.DataFrame,
    y: np.ndarray | pd.Series,
    *,
    epsilon: float = 1.35,
    max_iter: int = 1000,
) -> HuberFitResult

Parameters#

name

type

default

constraint

description

X

`np.ndarray

pd.DataFrame`

y

`np.ndarray

pd.Series`

epsilon

float

1.35

>1.0

Huber loss transition point. Residuals with

max_iter

int

1000

>=1

Maximum number of LBFGS iterations.

Returns#

HuberFitResult — frozen dataclass with fit results.

Attribute

Type

Description

.coef_

np.ndarray

Fitted coefficient vector, shape (n_features,).

.intercept_

float

Fitted intercept scalar.

.epsilon

float

Huber loss transition point used.

.scale_

float

Robust scale estimate from the fitted model.

.predict(X)

np.ndarray

Predictions for new data X, shape (n_samples,).

.summary()

str

Human-readable text table of fit results.

Behavior#

Replaces squared loss with the Huber loss: quadratic for small residuals, linear for large ones. Down-weights outliers without removing them. params.epsilon (default 1.35) sets the transition point.

When to use

Series with sporadic outliers that aren’t worth flagging in L2.

In recipe context#

Set params.family = "huber" in the relevant layer to activate this op within a recipe:

# Layer L4 recipe fragment
params:
  family: huber

References#

  • macroforecast design Part 2, L4: ‘forecasting model is the layer where every authoring iteration ends – pick family, tune, repeat.’

  • Huber (1964) ‘Robust Estimation of a Location Parameter’, Annals of Mathematical Statistics 35(1).