Add worked example: encoding dirty categories with the GapEncoder#1939
Open
Fazel94 wants to merge 2 commits into
Open
Add worked example: encoding dirty categories with the GapEncoder#1939Fazel94 wants to merge 2 commits into
Fazel94 wants to merge 2 commits into
Conversation
Online Gamma-Poisson factorization of character n-gram counts, for encoding messy string categories (hand-typed city names, and the like). It's the one-at-a-time version of skrub's GapEncoder: the n-gram vocabulary and the topics both grow as strings arrive, topic updates use A/B accumulators with a rho forgetting factor, and transform_one is read-only. Passes check_estimator. Closes online-ml#1439
A runnable notebook under docs/examples that shows where the GapEncoder pays off: a stream of hand-typed city names (689 spellings for 9 real cities) where one-hot barely beats chance (57% ROC AUC) while the GapEncoder recovers almost all the signal (70%, next to the 72% oracle that sees the clean names). Also shows fuzzy variants clustering and the learned per-topic labels. Registered in the docs nav.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A worked example notebook for the
GapEncoder(see #1439), living underdocs/examples.It builds a stream of hand-typed city names — 689 spellings for only 9 real cities — where the label depends on the true city but the model only sees the misspelled version. One-hot encoding barely beats chance (57% ROC AUC) because every typo is a new, unrelated category, while the
GapEncoderrecovers almost all the signal (70%, right next to a 72% oracle that gets to see the clean names). The notebook also shows fuzzy variants clustering by cosine similarity and the labels the topics learn.Stacked on #1938 (which adds the
GapEncoderitself) — this PR should be merged after it. Until then the diff shows both changes; it'll narrow to just the notebook + nav once #1938 lands.