tf.keras.metrics.BinaryAccuracy

Calculates how often predictions matches binary labels.

Used in the notebooks

Used in the guide Used in the tutorials

This metric creates two local variables, total and count that are used to compute the frequency with which y_pred matches y_true. This frequency is ultimately returned as binary accuracy: an idempotent operation that simply divides total by count.

If sample_weight is None, weights default to 1. Use sample_weight of 0 to mask values.

name (Optional) string name of the metric instance.
dtype (Optional) data type of the metric result.
threshold (Optional) Float representing the threshold for deciding whether prediction values are 1 or 0.

Standalone usage:

m = tf.keras.metrics.BinaryAccuracy()