Python 使用optim.minimize from Hyperas时出错

Python 使用optim.minimize from Hyperas时出错,python,tensorflow,hyperas,Python,Tensorflow,Hyperas,我正在尝试使用optim.minimizefromHyperas。正在运行的代码是googlecolab、python3+GPU 当我运行此命令时: best_run, best_model = optim.minimize(model=create_model, data=new_data, algo=tpe.suggest,max_evals=100, trials=Trials(), notebook_name='xxxxxx') 将引发此错误: /usr/lib/python3.6/

我正在尝试使用optim.minimizefromHyperas。正在运行的代码是googlecolab、python3+GPU

当我运行此命令时:

best_run, best_model = optim.minimize(model=create_model, data=new_data, algo=tpe.suggest,max_evals=100, trials=Trials(), notebook_name='xxxxxx')
将引发此错误:

/usr/lib/python3.6/inspect.py in getfile(object)
    664         return object.co_filename
    665     raise TypeError('{!r} is not a module, class, method, '
--> 666                     'function, traceback, frame, or code object'.format(object))
类型错误:

[6743行x 10列]不是模块、类、方法、函数, 回溯、帧或代码对象

有什么不对劲的线索吗


谢谢

optim.Minimum的数据必须是方法, 我猜您使用numpy数组作为optim.minimize('new_data')的输入

新的_数据应更改为以下内容:

def new_data() :

  return x_train, y_train, x_test, y_test

best_run, best_model = optim.minimize(model=create_model, data=new_data, algo=tpe.suggest,max_evals=100, trials=Trials(), notebook_name='xxxxxx')

您能否在colab中提供可复制代码或代码链接?