Why would you construct StandardScaler(with_mean=False)?
Correct answer
C. Centring would densify a sparse matrix, so scaling by the standard deviation alone preserves sparsity
18 views
C. Centring would densify a sparse matrix, so scaling by the standard deviation alone preserves sparsity
18 views
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.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.