2017-07-04 53 views
0

當我在Python中使用ELM(極限學習機)時,我遇到了這個問題:ImportError:無法導入名稱atleast2d_or_csr。錯誤的詳細信息如下所示:scikit-learn:ImportError:無法導入名稱atleast2d_or_csr

C:\Users\sherlock\Anaconda2\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. 
"This module will be removed in 0.20.", DeprecationWarning) 
Traceback (most recent call last): 

File "<ipython-input-50-dad0703e9d35>", line 1, in <module> 
runfile('C:/Users/sherlock/Desktop/Ensemble Learnig/Python-ELM-master 
/plot_elm_comparison.py', wdir='C:/Users/sherlock/Desktop/EnsembleLearnig 
/Python-ELM-master') 

File "C:\Users\sherlock\Anaconda2\lib\site-packages\spyder\utils 
\site\sitecustomize.py", line 866, in runfile 
execfile(filename, namespace) 

File "C:\Users\sherlock\Anaconda2\lib\site-packages\spyder\utils 
\site\sitecustomize.py", line 87, in execfile 
exec(compile(scripttext, filename, 'exec'), glob, loc) 

File "C:/Users/sherlock/Desktop/Ensemble Learnig/Python-ELM-master 
/plot_elm_comparison.py", line 75, in <module> 
from elm import ELMClassifier 

File "elm.py", line 34, in <module> 
from random_hidden_layer import SimpleRandomHiddenLayer 

File "random_hidden_layer.py", line 27, in <module> 
from sklearn.utils import check_random_state, atleast2d_or_csr 

ImportError: cannot import name atleast2d_or_csr 

有關聲明可能是:

from sklearn.utils import check_random_state, atleast2d_or_csr 
+0

你可能要檢查了這一點:https://github.com/scikit-learn/scikit-learn/issues/4457 – Deuce

回答

1

替換:

from sklearn.utils import check_random_state, atleast2d_or_csr 

from sklearn.utils import check_random_state, check_array 

參考:link