tf.keras.metrics.concordance_correlation

Computes the Concordance coefficient between labels and predictions.

Formula:

loss = mean(
    2 * (y_true - mean(y_true) * (y_pred - mean(y_pred)) / (
        var(y_true) + var(y_pred) + square(mean(y_true) - mean(y_pred))
    )
)

y_true Tensor of true targets.
y_pred Tensor of predicted targets.
axis Axis along which to determine similarity. Defaults to -1.

Concordance Correlation Coefficient tensor.

Example:

y_true = [[0, 1, 0.5], [1, 1, 0.2]]
y_pred = [[0.1, 0.9, 0.5], [1, 0.9, 0.2]]
loss = keras.losses.concordance_correlation(
    y_true, y_pred, axis=-1
).numpy()
[0.97560976 0.98765432]