jaxopt.loss.multiclass_sparsemax_loss

jaxopt.loss.multiclass_sparsemax_loss(label, scores)[source]

Multiclass sparsemax loss.

Parameters
  • label (int) – ground-truth integer label, between 0 and n_classes - 1.

  • scores (Array) – scores produced by the model, shape = (n_classes, ).

Return type

float

Returns

loss value

References

From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification. André F. T. Martins, Ramón Fernandez Astudillo. ICML 2016.