我不能把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发布于 2018-12-29 02:19:55
您需要使用Anaconda prompt安装imblearn,而不是使用传统的pip方法。我自己也面临着同样的问题,不得不去寻找解决方案。
https://stackoverflow.com/questions/51031235
复制相似问题