1

我无法将 SMOTE 与 imblearn 一起使用。以下是我在我的 jupyter 笔记本中所做的。有什么建议么?

pip install -U imbalanced-learn
#installs successfully
!python -V
#2.7.6
imblearn.__version__
#0.3.0
from imblearn.over_sampling import SMOTE
sm = SMOTE()

在这里它抛出错误:

    TypeError                                 Traceback (most recent call last)
<ipython-input-73-0715e331ee1b> in <module>()
      1 from imblearn.over_sampling import SMOTE
----> 2 sm = SMOTE()

/home/pradeep/Envs/nyraml/local/lib/python2.7/site-packages/imblearn/over_sampling/smote.pyc in __init__(self, ratio, random_state, k, k_neighbors, m, m_neighbors, out_step, kind, svm_estimator, n_jobs)
    164                  svm_estimator=None,
    165                  n_jobs=1):
--> 166         super(SMOTE, self).__init__(ratio=ratio, random_state=random_state)
    167         self.kind = kind
    168         self.k = k

TypeError: super(type, obj): obj must be an instance or subtype of type
    enter code here
4

1 回答 1

0

您需要使用 Anaconda 提示符安装 imblearn,而不是使用传统的 pip 方法。我自己也面临同样的问题,不得不去寻找解决方案。

于 2018-12-28T18:19:54.947 回答