Warning: This project is deprecated. TensorFlow Addons has stopped development,
The project will only be providing minimal maintenance releases until May 2024. See the full
announcement here or on
github.
tfa.metrics.hamming_loss_fn
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.
Args |
y_true
|
actual target value.
|
y_pred
|
predicted target value.
|
threshold
|
Elements of y_pred greater than threshold are
converted to be 1, and the rest 0. If threshold is
None, the argmax is converted to 1, and the rest 0.
|
mode
|
multi-class or multi-label.
|
Returns |
hamming loss: float.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-05-25 UTC.
[null,null,["Last updated 2023-05-25 UTC."],[],[]]