Using a transformer (evaluator) to convert target shortcuts to sklearn.pipeline

I understand that it is possible to link several ratings that implement the conversion method for converting X (a set of functions) to sklearn.pipeline. However, I have a use case in which I would also like to convert the target labels (for example, convert the labels to [1 ... K] instead of [0, K-1], and I would like to do this as a component in my pipeline Is it possible is this generally when using sklearn.pipeline.?

+5
source share
2 answers

No, pipelines will always run y unchanged. Make the conversion outside the pipeline.

(This is a known design flaw in scikit-learn, but it never clicked enough to change or extend the API.)

+11
source

You can add a label column to the end of the training data, then apply the transformation and delete this column before training your model. This is not very pro, but enough.

0
source

Source: https://habr.com/ru/post/1500398/


All Articles