Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metrics/r_squared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions metrics/r_squared/r_squared.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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")
Expand Down