Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Preprocessing

solow-preprocessing covers every day-one feature transformation: scalers, encoders, power and quantile transforms, discretization, polynomial and spline expansions, binarizers, target encoding, and function transformers.

Every transformer implements fit, transform, fit_transform, and inverse_transform where invertible. The inverse round-trip is exact to machine precision on well-scaled data.

Scalers

TransformerWhat it does
StandardScalerZero-mean, unit-variance per column via one-pass Welford variance.
MinMaxScalerRange projection onto arbitrary [a, b].
RobustScalerMedian / IQR scaling, outlier-immune.
MaxAbsScalerDivide each column by its max absolute value. Sparsity-preserving.
NormalizerRow-wise L1 or L2 unit normalization.

Power and quantile transforms

TransformerWhat it does
PowerTransformerYeo-Johnson (works with negatives) or Box-Cox (positive only) with maximum-likelihood λ per column.
QuantileTransformerEmpirical-CDF Gaussianization or uniform mapping via quantile lookup.

Discretization and binarization

TransformerWhat it does
KBinsDiscretizerBin numeric features with uniform, quantile, or k-means strategy. Output as ordinal or one-hot.
BinarizerThreshold-based binary indicator.

Categorical encoders

TransformerWhat it does
OneHotEncoderOne-hot with drop_first and handle_unknown options.
OrdinalEncoderInteger encoding with per-column category lookup.
LabelEncoderSingle-column label to integer.
LabelBinarizerBinary indicator per unique label.
MultiLabelBinarizerMulti-label indicator matrix.
TargetEncoderSmoothed target-mean encoding of categorical features.

Feature construction

TransformerWhat it does
PolynomialFeaturesGraded-lex polynomial expansion up to configurable degree, with interaction_only and include_bias.
SplineTransformerB-spline basis expansion with configurable degree and knot placement.
FunctionTransformerWrap an arbitrary closure as a pipeline transformer.

Example

#![allow(unused)]
fn main() {
use solow_preprocessing::StandardScaler;

let mut sc = StandardScaler::new();
sc.fit(&x)?;
let x_std = sc.transform(&x)?;
let x_back = sc.inverse_transform(&x_std)?;
Ok::<_, solow_core::Error>(())
}

Correctness

Every transformer is cross-verified against committed golden reference fixtures on every CI run. Inverse transforms round-trip exact to machine precision on well-scaled data.