1. Home
  2. Data Science
  3. Scikit-learn
  4. Why would you construct StandardScaler(with_mean=False)?

Added 30 Nov -0001

Why would you construct StandardScaler(with_mean=False)?

  1. Because without centring the transformed features are always positive and therefore easier to interpret
  2. Because with_mean=False switches to median and interquartile scaling instead of the ordinary mean
  3. Centring would densify a sparse matrix, so scaling by the standard deviation alone preserves sparsity Correct answer
  4. Sparse matrices cannot be divided by a scalar, so only centring is available for them in practice

Correct answer

C. Centring would densify a sparse matrix, so scaling by the standard deviation alone preserves sparsity

18 views

MCQSEXAM

Explanation

Sparse-aware scaling: subtracting the mean converts every implicit zero into a stored non-zero, destroying the memory advantage of a sparse matrix, so with_mean=False scales each feature by its standard deviation only. RobustScaler can be configured the same way, and MaxAbsScaler never centres at all. For sparse text features, MaxAbsScaler is often the better default.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs