Learn R Programming

tfaddons (version 0.10.0)

metric_hamming_distance: Hamming distance

Description

Computes hamming distance.

Usage

metric_hamming_distance(actuals, predictions)

Arguments

actuals

actual value

predictions

predicted value

Value

hamming distance: float

Details

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

Examples

Run this code
# NOT RUN {
# }
# 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())

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab