P11Feature EngineeringIntermediateInterpret10 min

Should You Scale Features Before KNN?

Decide whether scaling is necessary when distance drives a model's predictions.

#KNN#feature scaling#distance

Scenario

A K-nearest-neighbors model predicts customer segments using annual income in dollars and website visits per month.

Problem statement

Explain whether to scale the features before KNN and why, including one important caveat about the pipeline.

Your Task

  1. Compare the raw feature scales.
  2. Explain how distance is affected.
  3. Describe where scaling belongs when evaluating the model.

Feature ranges

annual_income: 25,000 to 250,000 monthly_visits: 0 to 90

Related Concepts

StandardizationPipelinesData leakage

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.