Use K.mean instead of K.sum in loss

This makes the loss actually reasonable rather than something like 132.3
pull/10/head
Matthew D. Scholefield 2018-04-18 17:26:04 -05:00
parent bee65e6c8b
commit 755af134f6
1 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,8 @@ def weighted_log_loss(yt, yp) -> Any:
pos_loss = -(0 + yt) * K.log(0 + yp + K.epsilon())
neg_loss = -(1 - yt) * K.log(1 - yp + K.epsilon())
return weight * K.sum(neg_loss) + (1. - weight) * K.sum(pos_loss)
return weight * K.mean(neg_loss) + (1. - weight) * K.mean(pos_loss)
def weighted_mse_loss(yt, yp) -> Any: