I am trying to deal with imbalanced data set using imblearn's random under-sampler. I want to specify the number of labels to be under-sampled manually. Here is my code:
sm = RandomUnderSampler(ratio = {0:142498, 1: 495}, random_state=42)
X_train, y_train = sm.fit_sample(X_tr,encoded_Ytrain)
print(format(Counter(y_train)))
However, this throws the error:
File "first_approach.py", line 56, in < module > X_train, y_train = sm.fit_sample(X_tr,encoded_Ytrain) raise ValueError('Unknown parameter type for ratio.') ValueError: Unknown parameter type for ratio.
What should be the correct syntax for passing the same?