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

Viewed 10140

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'
1 Answers

Try replacing the 'Ratio' with 'sampling_strategy' :

from imblearn.over_sampling import SMOTE

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