我无法在imblearn中使用SMOTE。以下是我在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
答案 0 :(得分:0)
您需要使用Anaconda提示符而不是使用传统的pip方法来安装imblearn。我本人也面临同样的问题,不得不去寻找解决方案。