View source on GitHub |
Computes hamming loss.
tfa.metrics.hamming_loss_fn(
y_true: tfa.types.TensorLike
,
y_pred: tfa.types.TensorLike
,
threshold: Union[FloatTensorLike, None],
mode: str
) -> tf.Tensor
Hamming loss is the fraction of wrong labels to the total number of labels.
In multi-class classification, hamming loss is calculated as the
hamming distance between y_true
and y_pred
.
In multi-label classification, hamming loss penalizes only the
individual labels.
Returns | |
---|---|
hamming loss: float. |