Feature Scaling

noun

say it: “FEE-cher SKAY-ling” /ˈfitʃər ˈskeɪlɪŋ/

Changing features so their values fall in similar ranges, so a model doesn't treat one as more important only because its numbers are larger.

What is feature scaling?

Feature scaling puts features on similar ranges before a model that measures distance uses them. Without it, weight in grams (100 to 300) outweighs a sweetness score of 1 to 10 only because its numbers are bigger. Standardization, with StandardScaler, is the usual way.

from sklearn.preprocessing import StandardScaler
fruit = [[120, 3], [180, 9], [150, 6]]    # grams, sweetness 1-10
print(StandardScaler().fit_transform(fruit).round(2))
# [[-1.22 -1.22]
#  [ 1.22  1.22]
#  [ 0.    0.  ]]: both features on the same scale

In a sentence

  • “Feature scaling made a customer's visits and spending count equally in the distance.”
  • “Without feature scaling, weight in grams drowned out the 1-to-10 sweetness score.”

Level: Journeyman · More AI Basics terms at this level

Updated