fit_transform() takes 2 positional arguments but 3 were given with LabelBinarizer

前端 未结 13 1939
时光取名叫无心
时光取名叫无心 2020-12-07 16:35

I am totally new to Machine Learning and I have been working with unsupervised learning technique.

Image shows my sample Data(After all Cleaning) Screenshot : Sample

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 16:54

    I have also faced the same issue. Following link helped me in fixing this issue. https://github.com/ageron/handson-ml/issues/75

    Summarizing changes to be made

    1) Define following class in your notebook

    class SupervisionFriendlyLabelBinarizer(LabelBinarizer):
        def fit_transform(self, X, y=None):
            return super(SupervisionFriendlyLabelBinarizer,self).fit_transform(X)
    
    

    2) Modify following piece of code

    cat_pipeline = Pipeline([('selector', DataFrameSelector(cat_attribs)),
                             ('label_binarizer', SupervisionFriendlyLabelBinarizer()),])
    

    3) Re-run the notebook. You will be able to run now

提交回复
热议问题