Todo:
例如:
如果模式i的错误是l_i,
我想考虑一个错误l_i * c_i,其中c_i是输入标量
答案 0 :(得分:0)
def customloss(y_true, y_pred):
c_i = ...
loss = ...(only use tensor operations on y_true and y_pred or use built in keras losses)
return c_i*loss
现在通过损失函数编译模型。
model.compile(loss = customloss)