Ejemplo n.º 1
0
 def _loss_function(model, prediction, target):
     loss = _theano.T.nnet.categorical_crossentropy(prediction, target)
     pred = T.argmax(prediction)
     targ = T.argmax(target)
     indices = T.and_(T.neq(pred, targ), T.eq(targ, 1.0))
     loss_ = loss * 5.0
     loss = T.where(indices, loss_, loss)
     return loss
Ejemplo n.º 2
0
 def _loss_function(model, prediction, target):
     loss = _theano.T.nnet.categorical_crossentropy(prediction, target)
     pred = T.argmax(prediction)
     targ = T.argmax(target)
     indices = T.and_(T.neq(pred, targ), T.eq(targ, 1.0))
     loss_ = loss * 5.0
     loss = T.where(indices, loss_, loss)
     return loss
Ejemplo n.º 3
0
 def _loss_function(model, prediction, target):
     inner_loss = T.abs_(target - prediction)
     outer_loss = 1.0 - inner_loss
     combined_loss = T.stack([inner_loss, outer_loss], axis=1)
     return T.min(combined_loss, axis=1)
Ejemplo n.º 4
0
 def _loss_function(model, prediction, target):
     inner_loss = T.abs_(target - prediction)
     outer_loss = 1.0 - inner_loss
     combined_loss = T.stack([inner_loss, outer_loss], axis=1)
     return T.min(combined_loss, axis=1)