scikit-learn-contrib / category_encoders

A library of sklearn compatible categorical variable encoders
http://contrib.scikit-learn.org/category_encoders/
BSD 3-Clause "New" or "Revised" License
2.39k stars 393 forks source link

if y is bool convert it into numerical #431

Closed mausam3407 closed 7 months ago

mausam3407 commented 8 months ago

Fixes #

Proposed Changes

We're converting the y to float in _transform function but not in fit function. And for other transforms as well, if we're required to do numerical calculation on y, we first convert it to float. This PR is to maintain the consitency in behaviour

-

PaulWestenthanner commented 8 months ago

Thanks for pointing this out. It would be better to change this in utils.convert_inputs as this is desired for all encoders.
Currently quantile encoder, leave one out encoder implement it on their own, whereas the others are missing it. Do you mind moving this change to the utils?

mausam3407 commented 8 months ago

Hi @PaulWestenthanner I thought instead of force converting y to float type. It'd be better to use label encoder incase of classification problems. I have made the change for same in base_class. Please take a look.

PaulWestenthanner commented 7 months ago

nice idea, LGTM & merging