我在Windows计算机上使用python=3.5
并尝试使用keras
在hyperas
中创建网格搜索。我一直收到这个错误:
C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\python.exe
Using TensorFlow backend.
Running
Traceback (most recent call last):
File "C:/Users/mmc/pycharmprojects/hha/hta/nn/model_creator.py", line 123, in <module>
main()
File "C:/Users/mmc/pycharmprojects/hha/hta/nn/model_creator.py", line 87, in main
verbose = 0)
File "C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py", line 42, in minimize
notebook_name=notebook_name, verbose=verbose)
C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py
File "C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py", line 62, in base_minimizer
C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py
model_str = get_hyperopt_model_string(model, data, notebook_name, verbose, stack)
C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py
File "C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\optim.py", line 132, in get_hyperopt_model_string
C:/Users/mmc/pycharmprojects/hha/hta/nn/model_creator.py
imports = extract_imports(cleaned_source, verbose)
C:/Users/mmc/pycharmprojects/hha/hta/nn/model_creator.py
File "C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\site-packages\hyperas\utils.py", line 31, in extract_imports
tree = ast.parse(source)
File "C:\Users\mmc\AppData\Local\Continuum\Anaconda3\envs\mmc35\lib\ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 32
act_1 = {{choice(['tanh', 'elu'])}}
^
IndentationError: unindent does not match any outer indentation level
或SyntaxError
我不知道该怎么办。我找到了一些IPython
的引用,但我没有使用它。我要么在pycharm
中运行,要么在cmd.exe
内从激活的conda
环境中运行。
这是我的pip freeze
:
appdirs==1.4.3
better-exceptions==0.1.1
bleach==2.0.0
colorama==0.3.7
cycler==0.10.0
decorator==4.0.11
entrypoints==0.2.2
filelock==2.0.8
future==0.16.0
h5py==2.7.0
hta==1.0
html5lib==0.999999999
hyperas==0.3
hyperopt==0.1
IbPy2==0.8.0
ipykernel==4.6.1
ipython==5.0.0
ipython-genutils==0.2.0
ipywidgets==6.0.0
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.0.1
jupyter-console==5.1.0
jupyter-core==4.3.0
Keras==2.0.3
keras-toolbox==0.1.2
MarkupSafe==1.0
matplotlib==2.0.0
mistune==0.7.4
nbconvert==5.1.1
nbformat==4.3.0
networkx==1.11
nose==1.3.7
notebook==5.0.0
numpy==1.12.1
packaging==16.8
pandas==0.19.2
pandocfilters==1.4.1
pickleshare==0.7.4
prompt-toolkit==1.0.14
protobuf==3.2.0
pydot-ng==1.0.0
Pygments==2.2.0
PyInstaller==3.2.1
pymongo==3.4.0
pyparsing==2.2.0
pypiwin32==219
PyPrind==2.9.9
python-dateutil==2.6.0
pytz==2016.10
PyYAML==3.12
pyzmq==16.0.2
qtconsole==4.3.0
scikit-learn==0.18.1
scipy==0.19.0
simplegeneric==0.8.1
six==1.10.0
sklearn==0.0
sklearn-pandas==1.3.0
tabulate==0.7.7
tensorflow==1.0.1
testpath==0.3
Theano==0.9.0
tornado==4.5.1
tqdm==4.11.2
traitlets==4.3.2
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==2.0.0
win-unicode-console==0.5
答案 0 :(得分:1)
我使用pip
来安装hyperas
,它给了我和旧版本。
我做了pip install git+https://github.com/maxpumperla/hyperas.git@master --upgrade
,它给了我正确的版本。