1.8 Normalizing Numerical Features
[video] /api/lesson-media/videos/9b417aa2-5e9f-4ae3-a9db-2a3b7f03f372-1794891207626-e05e17c04faf1fbb.mp4
[markdown] content available only on the platform
[markdown] content available only on the platform
Flashcards · 1.8 Normalizing Numerical Features
Feature scaling — Transforming numerical features to comparable ranges so no feature dominates just because its numbers are larger.
Salary in millions and children in single digits.
Normalization (Min-Max) — Rescales values into a fixed range, usually [0, 1], using the column's minimum and maximum.
x_new = (x - x_min) / (x_max - x_min)
Standardization (z-score) — Rescales values so the feature has mean 0 and standard deviation 1.
x_new = (x - mean) / std
Standard deviation — A measure of how spread out the values of a feature are around their mean.
np.std([6, 1, 8, 0, 3, 10, 2]) is about 3.49
MinMaxScaler — scikit-learn transformer that applies Min-Max normalization to each column.
MinMaxScaler().fit_transform(grade)
StandardScaler — scikit-learn transformer that standardizes each column to mean 0 and standard deviation 1.
StandardScaler().fit_transform(grade)
Bell curve — The shape of a normal distribution; standardization is often preferred when data roughly follows it.
Heights of adults in a large population.
Outlier sensitivity — Min-Max scaling is badly skewed by one extreme value, which squashes the other values together.
Incomes 10, 12, 13 and 110: the normal ones end up near 0.
