Unsupervised feature selection with eigenvalue clipping and PCA

Emanuele Luzio16 Mar 2022

Problem

Mercado Libre's fraud models used more than 4000 features. Each one was added to cover a weakness of an earlier model, so the set is diverse but redundant. Too many features raise overfitting through the bias-variance tradeoff, and models are harder to debug, slower and costlier to run. Projecting the data onto a subspace is not an option because the team must keep the original, explainable features. Selecting by the feature-target relation is costly: the data is large and that relation is non-stationary, while relations between features are almost stationary.

Example from the article: the author's first thought on seeing 4000+ features was that prediction power could improve simply by cutting the overfitting error.

Solution in brief

Look for redundancy between features only, without the target. Estimate which eigenvalues of the feature correlation matrix are signal by comparing them with the eigenvalues of a copy of the dataset where every feature is shuffled independently. Denoise the data with the signal eigenvectors, cluster the features on the denoised correlation matrix, and keep roughly one feature per cluster.

Questions this case answers
  • How to remove redundant features from a very wide tabular model while keeping the original, interpretable features instead of projecting them
  • How to choose the number of independent information groups among correlated features when the feature-target relation drifts and noise is not Gaussian
  • How to cut thousands of features of a fraud model without losing the explainability of the raw features?
  • How to find redundant features when the link between features and the target is non-stationary and the data is too big for wrapper methods?

Tools and methods

  • Eigenvalue clipping — separates signal eigenvalues from noise ones by comparing with a shuffled dataset
  • PCA — denoising filter in the original feature space, not a projection
  • Hierarchical clustering — groups features by distance d=1−|S| on the filtered correlation matrix
  • scikit-learn — PCA transform and inverse_transform implement the filter
Continue reading — it's free

Google or a one-time email code. No password.