calculate_r2#
- cinnabar.stats.calculate_r2(y_true: ndarray, y_pred: ndarray) float[source]#
Compute R^2 between true and predicted values.
Note
R^2 is calculated as the square of the Pearson correlation coefficient between true and predicted values.
- Parameters:
y_true (ndarray with shape (N,)) – True values
y_pred (ndarray with shape (N,)) – Predicted values
- Returns:
r2 – R^2 between true and predicted values
- Return type:
float