TF-IDF Versus Embeddings for Matching Raw Merchant Descriptors

Last updated: November 29, 2026

Quick Overview

Card transactions carry raw descriptors like "SQ *BLUE BOTTLE 0423 OAKLAND CA". Compare TF-IDF character n-grams with sentence embeddings for matching these strings to a clean merchant catalog, and say which you would start with.

Capital One
Machine Learning
Data Scientist
Capital One
November 29, 2026
Data Scientist
Phone Screen
Machine Learning
Easy

0

0

0 solved


Card transactions carry raw descriptors like "SQ *BLUE BOTTLE 0423 OAKLAND CA". Compare TF-IDF character n-grams with sentence embeddings for matching these strings to a clean merchant catalog, and say which you would start with.

Clean merchant names power the Capital One app's transaction view, spend categorization and rewards. This NLP fundamentals question checks whether you understand what each representation captures and can pick a pragmatic baseline.

What the Interviewer Expects
  • Explains TF-IDF weighting and why character n-grams suit noisy strings
  • Explains what dense embeddings capture and where they help
  • Picks a baseline with a reason
  • Uses nearest neighbor search with a similarity threshold
  • Evaluates with precision at the threshold on a labeled sample
Key Topics to Cover
TF-IDF
embeddings
string matching
NLP basics
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How would you handle processor prefixes like SQ * or TST *?
  • When would embeddings beat character n-grams here?
  • How would you scale nearest neighbor search to millions of catalog entries?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Descriptors are short, uppercase, truncated, and full of store numbers, city names and processor prefixes. The catalog has clean names and locations. The goal is a match or "no match," with high preci...

Approach
  • TF-IDF: each string becomes a sparse vector where a term's weight is term frequency times log⁡(N/df)\log(N / df), so rare tokens like "bottle" count more than common ones like "CA". With character 3-gra...

Submit Your Answer
Markdown supported