Skip to content
Quantoros

Why is treating implicit sparse zeros as missing dangerous for SimpleImputer?

Classic MLLevel: IntermediateSparse missing markers

Why is treating implicit sparse zeros as missing dangerous for SimpleImputer?

Hints
  • Separate absent entries from missing measurements.
  • Estimate how many zeros would become nonzero.

Answer

Those zeros may denote genuine absence, and replacing them generally destroys sparsity. The documented sparse path requires an explicitly stored missing marker; zero-as-missing requires dense input.

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

Related questions