Let NaNs pass through in OrdinalEncoder

We should allow NaNs to pass-through in OrdinalEncoder. One reason is for supporting categorical features with NaNs in the HistGradientBoosting estimators:

For the native categorical support, we require categories to be encoded as done by OrdinalEncoder. Yet, OrdinalEncoder is unable to be fitted with NaNs. So we can’t use the native categorical support of the Hist-GBDT if the categorical features have NaNs… Which is ironic because we do support NaNs as a native category in the Hist-GBDT code.

In terms of API, we’d need a new handle_missing={'error', 'passthrough'} parameter which would default to ‘error’.

CC @ogrisel @lorentzenchr @thomasjpfan

(Note: This is a subset of the feature request from #17123)
(Marking as “Hard” because anything encoding-related is usually a headache 😉 )

1 possible answer(s) on “Let NaNs pass through in OrdinalEncoder

  1. I’ll work on the nan passthrough support for OrdinalEncoder. (I was waiting for after the release before submitting new feature PRs).