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.41k stars 395 forks source link

if y is bool convert it into numerical #431

Closed mausam3407 closed 1 year ago

mausam3407 commented 1 year 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 1 year 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 1 year 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 1 year ago

nice idea, LGTM & merging