from keras import metrics
model.compile(loss='mean_squared_error',
optimizer='sgd',
参数
- y_true: 真实标签,Theano/Tensorflow 张量。
- y_pred: 预测值。和 y_true 相同尺寸的 Theano/TensorFlow 张量。
返回值
categorical_accuracy(y_true, y_pred)
import keras.backend as K
def mean_pred(y_true, y_pred):
return K.mean(y_pred)
model.compile(optimizer='rmsprop',
metrics=['accuracy', mean_pred])