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_distance
Computes hamming distance.
tfa.metrics.hamming_distance(
actuals: tfa.types.TensorLike
,
predictions: tfa.types.TensorLike
) -> tf.Tensor
Hamming distance is for comparing two binary strings.
It is the number of bit positions in which two bits
are different.
Args |
actuals
|
actual target value.
|
predictions
|
predicted value.
|
Returns |
hamming distance: float.
|
Usage:
y_true = np.array([1, 1, 0, 0, 1, 0, 1, 0, 0, 1], dtype=np.int32)
y_pred = np.array([1, 0, 0, 0, 1, 0, 0, 1, 0, 1], dtype=np.int32)
hamming_distance(y_true, y_pred).numpy()
0.3
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."],[],[]]