diff --git a/metrics/r_squared/README.md b/metrics/r_squared/README.md index 00c97c6d6..5cd86f0ae 100644 --- a/metrics/r_squared/README.md +++ b/metrics/r_squared/README.md @@ -18,7 +18,7 @@ description: >- ## Metric description -An R-squared value of 1 indicates that the model perfectly explains the variance of the dependent variable. A value of 0 means that the model does not explain any of the variance. Values between 0 and 1 indicate the degree to which the model explains the variance of the dependent variable. +For nonconstant references, a perfect prediction scores 1 and predicting the reference mean scores 0. A negative score means the predictions have greater squared error than the mean baseline. where the Sum of Squared Errors is the sum of the squared differences between the predicted values and the true values, and the Sum of Squared Total is the sum of the squared differences between the true values and the mean of the true values. diff --git a/metrics/r_squared/r_squared.py b/metrics/r_squared/r_squared.py index 75e0f7e00..6ce7351d8 100644 --- a/metrics/r_squared/r_squared.py +++ b/metrics/r_squared/r_squared.py @@ -35,7 +35,7 @@ _DESCRIPTION = """ R^2 (R Squared) is a statistical measure of the goodness of fit of a regression model. It represents the proportion of the variance in the dependent variable that is predictable from the independent variables. -The R^2 value ranges from 0 to 1, with a higher value indicating a better fit. A value of 0 means that the model does not explain any of the variance in the dependent variable, while a value of 1 means that the model explains all of the variance. +For nonconstant references, a perfect prediction scores 1 and predicting the reference mean scores 0. A negative score means the predictions have greater squared error than the mean baseline. R^2 can be calculated using the following formula: @@ -54,7 +54,7 @@ "warn". "warn" acts as 0, but the warning is raised. Returns: - R^2 value ranging from 0 to 1, with a higher value indicating a better fit. + R^2 score, which can be negative and has a maximum of 1 for nonconstant references. Examples: >>> r2_metric = evaluate.load("r_squared")