AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’

We Are Going To Discuss About AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’. So lets Start this Python Article.

AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’

  1. How to solve AttributeError: 'SMOTE' object has no attribute 'fit_sample'

    If you import like this
    from imblearn.over_sampling import SMOTE
    you need to do fit_resample()
    oversample = SMOTE() X, y = oversample.fit_resample(X, y)

  2. AttributeError: 'SMOTE' object has no attribute 'fit_sample'

    If you import like this
    from imblearn.over_sampling import SMOTE
    you need to do fit_resample()
    oversample = SMOTE() X, y = oversample.fit_resample(X, y)

Solution 1

If you import like this

from imblearn.over_sampling import SMOTE

you need to do fit_resample()

oversample = SMOTE()
X, y = oversample.fit_resample(X, y)

Original Author Subbu VidyaSekar Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment