Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
like image 930
anushiya-thevapalan Avatar asked Sep 06 '25 03:09

anushiya-thevapalan


1 Answers

Try replacing the 'Ratio' with 'sampling_strategy' :

from imblearn.over_sampling import SMOTE

sm = SMOTE(random_state=42, sampling_strategy=0.6)
like image 127
Vitor K Avatar answered Sep 07 '25 23:09

Vitor K