Пример #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
Пример #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