liveBook · Manning

GapEncoder

As explained in Ensemble Methods for Machine Learning

GapEncoder is a dirty_cat transformer that represents categories using frequently co-occurring substring combinations.

GapEncoder represents noisy, high-cardinality string categories through frequently co-occurring substring combinations. It offers a compact alternative when one-hot encoding would create too many columns. section 8.4

Employee salary prediction

In employee salary data, employee_position_title contains 385 categories. GapEncoder(n_components=100) can transform this high-cardinality feature before an XGBoost regressor predicts salary; the reported R² is 0.8895. section 8.4

How Ensemble Methods for Machine Learning covers it

How deep it goes
Defines substring-based encoding and demonstrates configuration, but does not explain the internal fitting algorithm.
Examples
Uses employee job titles, salary prediction, 100 components, and a reported R² comparison.
What it assumes
Assumes familiarity with categorical features, train-test splitting, pipelines, and regression models.
What you can do after
Apply it via dirty_cat in a scikit-learn pipeline for high-cardinality categorical regression.
How it connects
Connects GapEncoder with categorical features, one-hot encoding, SimilarityEncoder, MinHashEncoder, and XGBoost.

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.