Preproccessors let us change the input data for each model.

Lessons on this topic

Scalar Preprocessors

These tools adjust the scale and distribution of your numeric features to improve model performance.

Model2-Sentence ExplanationLink to sklearn-documentation
MaxAbsScalerIt scales each feature by its maximum absolute value so that the data resides within the range . This is specifically designed to preserve the sparsity of data (like matrices full of zeros).Documentation
MinMaxScalerThis scales features to a user-defined range, usually , based on the minimum and maximum values. It is easy to interpret but can be heavily distorted if your data contains extreme outliers.Documentation
RobustScalerIt removes the median and scales data according to the Interquartile Range (IQR). Because it ignores extreme values, it is the best choice for datasets that contain significant outliers.Documentation
StandardScalerThis transforms data to have a mean of 0 and a standard deviation of 1. It is the most common scaler but assumes your data follows a normal (Gaussian) distribution.Documentation
NormalizerUnlike other scalers, this operates on each sample (row) rather than each feature (column). It ensures each row has a “unit norm,” which is vital for text classification and distance-based clustering.Documentation
PowerTransformerThis applies a power transformation to make data more “Gaussian-like” and stabilize variance across the dataset. It is highly effective for correcting skewed data or non-constant variance (heteroscedasticity).Documentation
QuantileTransformerIt uses quantiles to map data to a uniform or normal distribution, spreading out the most frequent values. This reduces the impact of marginal outliers but may break linear relationships between variables.Documentation

Cluster Preprocessors

These models are used to group data points together, which can then be used as new features for a downstream model.

Model2-Sentence ExplanationDocumentation Link
KMeansIt partitions data into clusters by minimizing the distance between points and their respective cluster centroids. This is a fast, efficient baseline but requires you to choose the number of clusters (K) beforehand.Documentation
BirchThis memory-efficient algorithm builds a tree structure to represent data, making it ideal for very large datasets. It can cluster data in a single pass, which is helpful when computing resources are limited.Documentation
BisectingKMeansA hierarchical variation of KMeans that starts with one cluster and repeatedly splits them into two until the target number is reached. It often produces more stable and well-separated clusters than standard KMeans.Documentation

Feature Generators

These generate new synthetic features based on your existing data to capture more complex patterns.

Model2-Sentence ExplanationDocumentation Link
PolynomialFeaturesThis creates new features by generating all possible polynomial combinations of the original variables up to a set degree. It allows simple linear models to learn “curves” and interactions between different features.Documentation
SplineTransformerIt generates a B-spline basis for features, allowing for flexible non-linear modeling of data. This is often more stable and local than polynomial features, which can behave erratically at the edges of data ranges.Documentation

Would you like me to help you write a code snippet to visualize how these different Scalars affect a specific dataset?