get_r2
get_r2(y_true, y_pred)Calculates the R^2 statistic (coefficient of determination) and return the result.
The R^2 statistics meansures the proportion of variability in Y (the response) that is explained by the linear model.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| y_true | array or list | The actual observed values (ground truth). | required |
| y_pred | array or list | The model predicted values. | required |
Returns
| Name | Type | Description |
|---|---|---|
| float | The calculated R^2 statistic. |
Examples
>>> y_true = [1.0, 2.0, 3.0]
>>> y_pred = [1.0, 2.0, 3.0]
>>> get_r2(y_true, y_pred)
1.0