TypeError: 'generator' object is not subscriptable
See original GitHub issuefrom hyperas import optim
from hyperopt import Trials, tpe
def data():
return 1, 2, 3, 4
def model(a, b, c, d):
pass
if __name__ == "__main__":
trials = Trials()
bla = optim.minimize(model=model, data=data, algo=tpe.suggest,
max_evals=5,
trials=trials)
C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\python.exe G:/Source/untitled4/main.py
Using TensorFlow backend.
Traceback (most recent call last):
>>> Imports:
File "G:/Source/untitled4/main.py", line 18, in <module>
#coding=utf-8
trials=trials)
try:
from hyperas import optim
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperas\optim.py", line 67, in minimize
except:
pass
verbose=verbose)
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperas\optim.py", line 133, in base_minimizer
try:
return_argmin=True),
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperopt\fmin.py", line 307, in fmin
from hyperopt import Trials, tpe
return_argmin=return_argmin,
except:
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperopt\base.py", line 635, in fmin
pass
return_argmin=return_argmin)
>>> Hyperas search space:
def get_space():
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperopt\fmin.py", line 314, in fmin
return {
}
pass_expr_memo_ctrl=pass_expr_memo_ctrl)
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperopt\base.py", line 786, in __init__
>>> Data
pyll.toposort(self.expr)
1:
2:
File "C:\Users\klein-desk\AppData\Local\Programs\Python\Python35\lib\site-packages\hyperopt\pyll\base.py", line 715, in toposort
3:
4:
assert order[-1] == expr
>>> Resulting replaced keras model:
TypeError: 'generator' object is not subscriptable
1: def keras_fmin_fnct(space):
2:
3: pass
4:
Process finished with exit code 1
Windows Python 3.5.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
"'generator' object is not subscriptable" error - Stack Overflow
You are trying to access it as though it were a list or other Sequence type, which let you access arbitrary elements by...
Read more >TypeError: 'generator' object is not subscriptable in Python
The Python "TypeError: 'generator' object is not subscriptable" occurs when we try to access a generator object at a specific index. To solve...
Read more >Why are generators in python not subscriptable? - Quora
Generators are iterators, but you can only iterate over them once. Its because they do not store all the values in memory, they...
Read more >PYTHON : "'generator' object is not subscriptable" error
PYTHON : "' generator ' object is not subscriptable " error [ Gift : Animated Search Engine : https://www.hows.tech/p/recommended.html ] PYTHON ...
Read more >How to write a generator expression - Python Morsels
Generator expressions give us back new generator objects: ... line 1, in <module> TypeError: 'generator' object is not subscriptable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @maxpumperla As you might know, it’s the temporary solution. Do you have any idea to update Hyperopt to be compatible with this version of netwrokx? As I know you have the full access to modify the hyperopt repo. 😃
try
pip3 install networkx==1.11
I would only do this in virtual env as the current networkx version is 2.0
Doc here: https://networkx.github.io/