Skip to content

TypeError: 'generator' object is not subscriptable #125

@brunoklein99

Description

@brunoklein99
from 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions