Keras中的错误:无效的参数'metrics'传递给K.function [英] error in Keras: Invalid argument 'metrics' passed to K.function
问题描述
我正在研究有关机器学习的一些问题,并希望在python中尝试功能强大的软件包Keras(使用Theano后端).当我在此处运行用于数字识别的MLP演示时,它给出以下错误消息:
I am working on some problems about machine learning and want to try the powerful package Keras(using Theano backend) in python. While I am running a demo of MLP for digit recognition here, it gives the follow error message:
Traceback (most recent call last):
File "mlp.py", line 52, in <module>
metrics=['accuracy'])
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 564, in compile
updates=updates, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 459, in function
raise ValueError(msg)
ValueError: Invalid argument 'metrics' passed to K.function
我不知道为什么会显示错误消息,有人可以帮助我修复错误吗?预先谢谢你.
I don't know why it gave the error message, can anyone help me to fix the bug? Thank you in advance.
推荐答案
此错误表示您正在运行Keras版本0(例如0.3.2),但正在运行为Keras版本1编写的代码.您可以升级到Keras 1 ,或从对model.compile()
的函数调用中删除metrics=['accuracy']
.
This error means that you are running Keras version 0 (e.g. 0.3.2) but running code that was written for Keras version 1. You can upgrade to Keras 1, or remove metrics=['accuracy']
from the function call to model.compile()
.
这篇关于Keras中的错误:无效的参数'metrics'传递给K.function的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!