我使用Python 2.7和Jupyter筆記本來做一些基本的機器學習。我在本教程下面一起:Keras:無法導入名稱np_utils
http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/
我只是試圖從Keras導入不同的東西,所以我可以運行該教程。具體來說,我這樣做:
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
,並卡住在第一進口,給我的這個回溯:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-28-aae66d0fdaee> in <module>()
----> 1 from keras.models import Sequential
2 from keras.layers import Dense
3 from keras.wrappers.scikit_learn import KerasRegressor
4 from sklearn.model_selection import cross_val_score
5 from sklearn.model_selection import KFold
/Users/newscred/anaconda/lib/python2.7/site-packages/keras/__init__.py in <module>()
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
/Users/newscred/anaconda/lib/python2.7/site-packages/keras/utils/__init__.py in <module>()
1 from __future__ import absolute_import
----> 2 from . import np_utils
3 from . import generic_utils
4 from . import data_utils
5 from . import io_utils
ImportError: cannot import name np_utils
我GOOGLE了四周,但似乎無法找出原因我遇到了這個問題/如何解決。有任何想法嗎?
謝謝!
你使用的是什麼Keras版本? –
使用2.0.6與TensorFlow後端 – bclayman
這很奇怪,Keras 2.0.6包含該文件,你有什麼 /Users/newscred/anaconda/lib/python2.7/site-packages/keras/utils/? –