Skip to content
Quantoros

Document vectors should be compared by direction rather than total length. Why use Normalizer instead of StandardScaler?

Classic MLLevel: IntermediatePer-sample normalization

Document vectors should be compared by direction rather than total length. Why use Normalizer instead of StandardScaler?

Hints
  • Decide whether rows or columns are normalized.
  • Direction survives positive row rescaling.

Answer

Normalizer rescales each sample to unit norm. StandardScaler rescales columns using population statistics; it does not enforce equal document length.

Source and licence: scikit-learn 1.7.2 — preprocessing · BSD-3-Clause · answer: Quantoros editorial

Related questions