Loading model with custom loss + keras

后端 未结 2 1709
情话喂你
情话喂你 2020-11-29 05:38

In Keras, if you need to have a custom loss with additional parameters, we can use it like mentioned on https://datascience.stackexchange.com/questions/25029/custom-loss-fun

2条回答
  •  眼角桃花
    2020-11-29 06:12

    You can try this:

    import keras.losses
    keras.losses.penalized_loss = penalized_loss
    

    (after defining 'penalized_loss' function in your current 'py' file).

提交回复
热议问题