nerdexam
Amazon

MLA-C01 · Question #197

An ML engineer wants to use Amazon SageMaker Data Wrangler to perform preprocessing on a dataset. The ML engineer wants to use the processed dataset to train a classification model. During…

The correct answer is B. Perform similarity encoding to represent categories of the feature. The key challenge here is that thousands of values differ only by spelling errors - meaning 'sneaker', 'sneeker', and 'sneakar' should be treated as the same category. Similarity encoding represents each category as a vector of character n-gram similarities to all other…

Data Preparation for Machine Learning

Question

An ML engineer wants to use Amazon SageMaker Data Wrangler to perform preprocessing on a dataset. The ML engineer wants to use the processed dataset to train a classification model. During preprocessing, the ML engineer notices that a text feature has a range of thousands of values that differ only by spelling errors. The ML engineer needs to apply an encoding method so that after preprocessing is complete, the text feature can be used to train the model. Which solution will meet these requirements?

Options

  • APerform ordinal encoding to represent categories of the feature.
  • BPerform similarity encoding to represent categories of the feature.
  • CPerform one-hot encoding to represent categories of the feature.
  • DPerform target encoding to represent categories of the feature.

How the community answered

(51 responses)
  • A
    4% (2)
  • B
    73% (37)
  • C
    16% (8)
  • D
    8% (4)

Explanation

The key challenge here is that thousands of values differ only by spelling errors - meaning 'sneaker', 'sneeker', and 'sneakar' should be treated as the same category. Similarity encoding represents each category as a vector of character n-gram similarities to all other categories, so misspelled variants of the same word end up with very similar (nearly identical) encodings. This is precisely designed for high-cardinality, noisy categorical text. One-hot encoding (C) would create thousands of orthogonal binary columns, treating each spelling variation as a completely distinct category - defeating the purpose. Ordinal encoding (A) assigns arbitrary integers with no semantic meaning. Target encoding (D) uses target-variable statistics and does not account for string similarity between category values.

Topics

#SageMaker Data Wrangler#Data preprocessing#Similarity encoding#Text feature engineering

Community Discussion

No community discussion yet for this question.

Full MLA-C01 Practice