huber – Huber regression (robust to outliers).#
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.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 |
|---|---|---|---|---|
|
`np.ndarray |
pd.DataFrame` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
|
|
|
>1.0 |
Huber loss transition point. Residuals with |
|
|
|
>=1 |
Maximum number of LBFGS iterations. |
Returns#
HuberFitResult — frozen dataclass with fit results.
Attribute |
Type |
Description |
|---|---|---|
|
|
Fitted coefficient vector, shape (n_features,). |
|
|
Fitted intercept scalar. |
|
|
Huber loss transition point used. |
|
|
Robust scale estimate from the fitted model. |
|
|
Predictions for new data X, shape (n_samples,). |
|
|
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).