导入MLPClassifier时导入错误

时间:2017-03-10 06:23:28

标签: scikit-learn neural-network python-3.5 python-import importerror

我尝试运行时遇到以下错误:

from sklearn.neural_network import MLPClassifier

错误:

from sklearn.neural_network import MLPClassifier
Traceback (most recent call last):

File "<ipython-input-77-6113b65dfa44>", line 1, in <module>
from sklearn.neural_network import MLPClassifier

File "C:\Users\anagha\Anaconda3\lib\site-packages\sklearn\neural_network\__init__.py", line 10, in <module>
from .multilayer_perceptron import MLPClassifier

File "C:\Users\anagha\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py", line 18, in <module>
from ..model_selection import train_test_split

File "C:\Users\anagha\Anaconda3\lib\site-packages\sklearn\model_selection\__init__.py", line 23, in <module>
from ._search import GridSearchCV

File "C:\Users\anagha\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py", line 32, in <module>
from ..utils.fixes import rankdata

**ImportError: cannot import name 'rankdata'**

1 个答案:

答案 0 :(得分:0)

如果您已经安装了numpy和scipy:

pip install -U scikit-learn

否则:

conda install scikit-learn

最后检查更新:

conda update pip