candle.uq_keras_utils.sparse_abstention_loss

candle.uq_keras_utils.sparse_abstention_loss#

candle.uq_keras_utils.sparse_abstention_loss(alpha, mask)#

Function to compute abstention loss. It is composed by two terms: (i) original loss of the multiclass classification problem, (ii) cost associated to the abstaining samples. Assumes y_true is not one-hot encoded.

Parameters:
  • alpha – Keras variable. Weight of abstention term in cost function

  • mask (ndarray) – Numpy array to use as mask for abstention: it is 1 on the output associated to the abstention class and 0 otherwise