Skip to content
Quantoros

Why can a normal classifier be the last Pipeline step but not an intermediate step?

Classic MLLevel: FoundationPipeline step contract

Why can a normal classifier be the last Pipeline step but not an intermediate step?

Hints
  • Ask what the next step receives.
  • Prediction and feature transformation are different interfaces.

Answer

Intermediate steps must transform data for the next step, exposing fit and transform. The last estimator can instead expose prediction or another final operation.

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

Related questions