A data scientist at an e-commerce company is performing EDA on a product recommendation dataset. A categorical feature 'product_category' has 3,200 unique values (high cardinality). The scientist considers three encoding strategies before training a SageMaker built-in Factorization Machines model. Which statement MOST accurately compares these strategies for this specific scenario?
- A. Ordinal encoding is best because it assigns a unique integer to each category, preserving all category information without increasing dimensionality
- B. One-hot encoding should be preferred because it is always lossless and Factorization Machines handle sparse input efficiently✓ Correct
- C. Target encoding is always the safest choice because it reduces dimensionality to a single column without any risk of overfitting
- D. Hashing (feature hashing) is not suitable for Factorization Machines because it requires dense input vectors
Explanation
One-hot encoding a 3,200-cardinality feature produces a very sparse 3,200-dimensional binary vector per record. The SageMaker Factorization Machines algorithm is specifically designed to work efficiently with sparse input (it accepts data in sparse RecordIO-protobuf format), making one-hot encoding a legitimate and common choice. Ordinal encoding assigns arbitrary integers (e.g., 1–3200) with no ordinal meaning, implying false numeric relationships between unrelated categories — this can mislead distance-based or linear models and is not recommended for nominal high-cardinality features. Target encoding reduces dimensionality to a single numeric column but is prone to target leakage and overfitting when applied naively without proper cross-validation folds, making 'always the safest choice' incorrect. Hashing (feature hashing) maps categories to a fixed-size hash space and produces sparse output compatible with Factorization Machines — the claim that it requires dense input is incorrect.