<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/metrics/correlation_metrics.py#L8-L45) |

Computes the Pearson coefficient between labels and predictions.

    tf.keras.metrics.pearson_correlation(
        y_true, y_pred, axis=-1
    )

#### Formula:

    loss = mean(l2norm(y_true - mean(y_true) * l2norm(y_pred - mean(y_pred)))

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Pearson Correlation Coefficient tensor. ||

<br />

#### 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()
    [1.         0.99339927]