close

[Solved] AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’

Hello Guys, How are you all? Hope You all Are Fine. Today I face the following error AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’ Error Occurs ?

 I am getting AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’ error.

Here is mycode

from imblearn.over_sampling import SMOTE

How To Solve AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’ Error ?

  1. How To Solve AttributeError: 'SMOTE' object has no attribute 'fit_sample' Error ?

    To Solve AttributeError: 'SMOTE' object has no attribute 'fit_sample' Error If you import SMOTE then you need to do fit_resample().

Solution 1

If you import SMOTE then you need to do fit_resample()

from imblearn.over_sampling import SMOTE
oversample = SMOTE()
X, y = oversample.fit_resample(X, y)

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

1 thought on “[Solved] AttributeError: ‘SMOTE’ object has no attribute ‘fit_sample’”

Leave a Comment