一,keras如何自定义损失函数(进阶版,not of the form of f(x_true, x_pred))
1.define your model (typically using the functional API)
采用函数式定义模型,之前说过,keras定义模型有model与K.function两种。一般两者结合使用。
2.define your custom cost,定义自己的损失函数
3.instantiate an optimizer, get weights updates via:
updates = optimizer.get_updates(model.trainable_weights, model.constraints, cost))
使用优化子的training_updates 进行权重及loss更新。
training_updates = Adam(lr=self.lrD*loss_config['lr_factor'], beta_1=