‹ All MLA-C01 questions

MLA-C01 Practice Question 23: Feature Scaling Distance Algorithm

AWS Certified Machine Learning Engineer – Associate (MLA-C01) · Test 3 · question 3 of 10

Data Preparationeasy

An ML engineer clusters customers with k-means using two numeric features: annual_spend, which ranges from about 200 to 500,000, and orders_per_year, which ranges from 0 to 50. The resulting clusters split customers purely along spend, and orders_per_year appears to have no effect on which cluster a customer lands in. Both features are known to matter to the business.

What should the engineer do to the features before clustering?

Select one answer
Show answer and explanation

Answer:

  • A. Standardize each feature to zero mean and unit variance so both contribute comparably to the distance calculation

k-means assigns points to the nearest centroid by Euclidean distance, so a feature measured in hundreds of thousands swamps a feature measured in tens; the spend difference between two customers is thousands of units while the order-count difference is at most 50. Scaling the columns to a common range, for example with a standard scaler that subtracts the mean and divides by the standard deviation, lets both features carry comparable weight (option A).

- B is wrong because bucketing continuous values into one-hot categories throws away the ordering and magnitude information that distance-based clustering relies on, and it adds many sparse columns. - C is wrong because deleting a feature the business cares about fixes the imbalance by discarding half the signal. The goal is to balance the two features, not to remove one. - D is wrong because more centroids only subdivides the same distorted space. Every split still follows the spend axis, because the distance metric has not changed.

Reference: How linear learner works - Preprocess

Practice Test 3 ›

Study guides for MLA-C01