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