dimanche 17 février 2019

Name 'RandomUnderSampler' is not defined

I'm trying to implement RandomUnderSampler. I have correctly installed the imblearn module. But still getting the error,Name 'RandomUnderSampler' is not defined. Any specific reason for this? Can someone please help

from imblearn.under_sampling import RandomUnderSampler

#Random under-sampling and over-sampling with imbalanced-learn
def random_under_sampling(X,Y):

    rus = RandomUnderSampler(return_indices=True)
    X_rus, y_rus, id_rus = rus.fit_sample(X, Y)

    print('Removed indexes:', id_rus)

    plot_2d_space(X_rus, y_rus, 'Random under-sampling')

Aucun commentaire:

Enregistrer un commentaire