Expand description
Per-column feature scalers, ported from tabfm/src/classifier_and_regressor.py’s
PreprocessingPipeline, applied in this exact order: CustomStandardScaler -> one of 5
optional normalizers (if not "none") -> OutlierRemover (last, not second — verified
against PreprocessingPipeline.fit). Each scaler exposes fit/transform mirroring
sklearn’s split so the same fitted state (from training columns) can be applied to held-out
columns.
Structs§
- Custom
Standard Scaler CustomStandardScaler:clip((x - mean) / (std + eps), -100, 100).- Outlier
Remover OutlierRemover(threshold=4.0default): two-pass mean/std (outliers masked before the second pass), then a smooth log-based soft clip (NOT a hard clip) at the recomputed bounds.- Power
Transformer PowerTransformer(method="yeo-johnson", standardize=True): per-feature MLE-fitlambda(via a portedscipy.optimize.brent), then standardize the transformed values.- Quantile
Transformer QuantileTransformer(output_distribution="normal"): empirical CDF (via linear-interpolated percentiles, sklearn’s defaultn_quantiles=1000capped at the sample count) mapped through the inverse standard-normal CDF.- Robust
Scaler RobustScaler(unit_variance=True):(x - median) / (IQR / 1.349...), where the divisor makes the scale consistent with a standard-normal’s std (1.349... = Φ⁻¹(0.75) - Φ⁻¹(0.25)).- Standard
Scaler - Plain
sklearn.preprocessing.StandardScaler(ddof=0, no epsilon/clip) — used once, globally, on the raw regression target (y_scaler_inTabFMRegressor), separate from the per-memberCustomStandardScalerapplied to features.
Functions§
- apply_
pipeline - One member’s full
PreprocessingPipelinefor a single column: fit ontrain_col, apply to bothtrain_colandtest_col. Order:CustomStandardScaler-> normalizer (if notNormMethod::None) ->OutlierRemover. - norm_
ppf - Inverse standard-normal CDF (
scipy.stats.norm.ppf), via Acklam’s rational approximation with one Halley’s-method refinement step (accurate to ~1e-9). - percentile_
linear - NumPy’s default (“linear”) percentile interpolation on an already-sorted slice.