winsorize – Cap observations at user-supplied quantile thresholds.#
Back to outlier_policy axis | Back to L2 | Browse all options
Operational op under axis
outlier_policy, sub-layerl2_c, layerl2. Standalone callable:mf.functions.winsorize_clean.
Function signature#
mf.functions.winsorize_clean(
panel: pd.DataFrame,
) -> pd.DataFrame
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
|
— |
— |
Input panel. Each column is a variable; rows are time periods. Series is promoted to a single-column DataFrame internally. |
Returns#
pd.DataFrame — scalar result.
Behavior#
Truncates each series at leaf_config.winsorize_lower_quantile (default 0.01) and leaf_config.winsorize_upper_quantile (default 0.99). Less aggressive than the McCracken-Ng IQR rule and preserves more of the tail.
When to use
Studies that want a bounded but non-NaN outlier handler; alternative-rule comparisons.
In recipe context#
Set params.outlier_policy = "winsorize" in the relevant layer to activate this op within a recipe:
# Layer L2 recipe fragment
params:
outlier_policy: winsorize
References#
macroforecast design Part 2, L2: ‘preprocessing is the only layer with a strict A→B→C→D→E execution order; every cell follows the same pipeline.’
Tukey (1977) ‘Exploratory Data Analysis’, Addison-Wesley.