我正在尝试使用RandomUnderSampler
. 我已经正确安装了imblearn
模块。但仍然收到错误:“名称'RandomUnderSampler”未定义`。这有什么具体原因吗?有人可以帮忙吗
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')
实际方法名