wrapper - 没有名为“ModelWrapper”的模块
问题描述
我正在尝试比较深度学习模型中激活函数的性能,但下面的编码给出了有关 ModelWrapper 的错误。错误如下:“ModuleNotFoundError:没有名为'ModelWrapper'的模块。知道如何处理它。谢谢!
# Activation functions to try
activations = ['relu', 'leaky_relu', 'sigmoid', 'tanh']
# Loop over the activation functions
activation_results = {}
def get_model(act_function):
if act_function not in ['relu', 'leaky_relu', 'sigmoid', 'tanh']:
raise ValueError('Make sure your activation functions are named correctly!')
print("Finishing with",act_function,"...")
return ModelWrapper(act_function)
for act in activations:
# Get a new model with the current activation
model = get_model(act)
# Fit the model and store the history results
h_callback = model.fit(X_train, y_train, validation_data=(X_test,y_test), epochs=20, verbose=0)
activation_results[act] = h_callback
activation_results
解决方案
推荐阅读
- c# - 使用 EF CodeFirst 与三个表建立映射关系
- python - python UDP套接字客户端recevfrom非常慢
- haskell - 函数接受一个 2-Tuples 列表和一个数字
- dynamics-crm - 本地 Dynamics CRM 2016 保存并关闭不返回打开页面
- python - 生成、遍历和打印二叉树
- laravel - 尝试浏览对象时为 foreach() 提供的参数无效。刀片 - Laravel
- docker - 使用带有 docker-compose 的 redis 时连接被拒绝
- c# - 使用c#读取连接到api的excel单元格
- java - 使用 JZOS 工具包的 JCL 作业中所有 z/OS DD 语句的列表
- css - 如何将组件的 [ngClass] 应用到其子元素