2016-10-12 211 views
1

我使用pip install,conda和github在windows powershell上安裝了https://github.com/glemaitre/imbalanced-learn。但是,當在IPython的筆記本電腦,我嘗試導入使用包IM:在ipython筆記本上導入imblearn python包的問題

from unbalanced_dataset import UnderSampler, OverSampler, SMOTE 

我得到的錯誤:


ImportError Traceback (most recent call last) <ipython-input-9-ad6fd7440a05> in <module>() 
----> 1 from imbalanced_learn import UnderSampler, OverSampler, SMOTE 

ImportError: No module named imbalanced_learn 

新使用Windows的蟒蛇,我一定要安裝的軟件包在某個文件夾中?

謝謝!

回答

2

試試這個:

from imblearn import under_sampling, over_sampling 

爲了導入SMOTE

from imblearn.over_sampling import SMOTE 

或數據集:

from imblearn.datasets import ... 
+0

這不適合我 - 任何其他想法? – Alvis

1

如果不工作,也許你需要安裝「 imblearn「包。

嘗試安裝:

  • PIP:pip install -U imbalanced-learn
  • 水蟒:conda install -c glemaitre imbalanced-learn

然後嘗試在你的文件中導入庫:

  • from imblearn.over_sampling import SMOTE