metric_hamming_distance: Hamming distance

Description Usage Arguments Details Value Examples

View source: R/metrics.R

Description

Computes hamming distance.

Usage

1
metric_hamming_distance(actuals, predictions)

Arguments

actuals

actual value

predictions

predicted value

Details

Hamming distance is for comparing two binary strings. It is the number of bit positions in which two bits are different.

Value

hamming distance: float

Examples

1
2
3
4
5
6
7
8
9
## Not run: 

actuals = tf$constant(as.integer(c(1, 1, 0, 0, 1, 0, 1, 0, 0, 1)), dtype=tf$int32)
predictions = tf$constant(as.integer(c(1, 0, 0, 0, 1, 0, 0, 1, 0, 1)),dtype=tf$int32)
result = metric_hamming_distance(actuals, predictions)
paste('Hamming distance: ', result$numpy())


## End(Not run)

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