📜  如何在 keras 中使用 rmse 作为损失函数 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:16.460000             🧑  作者: Mango

代码示例1
from keras import backend as K

def root_mean_squared_error(y_true, y_pred):
        return K.sqrt(K.mean(K.square(y_pred - y_true), axis=-1)) 

  model.compile(optimizer = "rmsprop", loss = root_mean_squared_error, 
              metrics =["accuracy"])