sklearn labelbinarizer in pipeline

Solutions on MaxInterview for sklearn labelbinarizer in pipeline by the best coders in the world

showing results for - "sklearn labelbinarizer in pipeline"
Luka
01 Jan 2018
1from sklearn.preprocessing import LabelBinarizer
2
3class LabelBinarizerPipelineFriendly(LabelBinarizer):
4    def fit(self, X, y=None):
5        """this would allow us to fit the model based on the X input."""
6        super(LabelBinarizerPipelineFriendly,self).fit(X)
7    def transform(self, X, y=None):
8        return super(LabelBinarizerPipelineFriendly, self).transform(X)
9    def fit_transform(self, X, y=None):
10        return super(LabelBinarizerPipelineFriendly, self).fit(X).transform(X)