anushiya-thevapalan
anushiya-thevapalan

Reputation: 591

TypeError: __init__() got an unexpected keyword argument 'ratio' when using SMOTE

I am using SMOTE to oversample as my dataset is imbalanced. I am getting an unexpected argument error. But in the documentation, the ratio argument is defined for SMOTE. Can someone help me understand where I am going wrong?

Code snippet

from imblearn.over_sampling import SMOTE
sm = SMOTE(random_state=42, ratio=0.6)

Error

TypeError: __init__() got an unexpected keyword argument 'ratio'

Upvotes: 4

Views: 14550

Answers (1)

Vitor K
Vitor K

Reputation: 136

Try replacing the 'Ratio' with 'sampling_strategy' :

from imblearn.over_sampling import SMOTE

sm = SMOTE(random_state=42, sampling_strategy=0.6)

Upvotes: 12

Related Questions