loss_sparsemax: Sparsemax loss

Description Usage Arguments Details Value

View source: R/losses.R

Description

Sparsemax loss function [1].

Usage

1
2
3
4
5
loss_sparsemax(
  from_logits = TRUE,
  reduction = tf$keras$losses$Reduction$SUM_OVER_BATCH_SIZE,
  name = "sparsemax_loss"
)

Arguments

from_logits

Whether y_pred is expected to be a logits tensor. Default is True, meaning y_pred is the logits.

reduction

(Optional) Type of tf$keras$losses$Reduction to apply to loss. Default value is SUM_OVER_BATCH_SIZE.

name

Optional name for the op.

Details

Computes the generalized multi-label classification loss for the sparsemax function. The implementation is a reformulation of the original loss function such that it uses the sparsemax properbility output instead of the internal au variable. However, the output is identical to the original loss function. [1]: https://arxiv.org/abs/1602.02068

Value

A 'Tensor'. Has the same type as 'logits'.


tfaddons documentation built on July 2, 2020, 2:12 a.m.