Definition

The R-squared test measures the coefficient of determination, which quantifies the proportion of the variance in the dependent variable that is predictable from the independent variables. R-squared indicates how well the regression model explains the variability of the target variable.

Taxonomy

  • Task types: Tabular regression.
  • Availability: and .

Why it matters

  • R-squared provides an intuitive measure of model performance as a percentage of variance explained.
  • Values range from 0 to 1 (or negative for very poor models), where 1 indicates perfect prediction and 0 indicates the model performs no better than predicting the mean.
  • Higher R-squared values indicate better model performance and stronger explanatory power.
  • R-squared is scale-independent, making it useful for comparing models across different datasets and target variables.

Required columns

To compute this metric, your dataset must contain the following columns:
  • Predictions: The predicted values from your regression model
  • Ground truths: The actual/true target values

Test configuration examples

If you are writing a tests.json, here are a few valid configurations for the R-squared test:
[
  {
    "name": "R-squared above 0.8",
    "description": "Ensure that the R-squared score is above 0.8",
    "type": "performance",
    "subtype": "metricThreshold",
    "thresholds": [
      {
        "insightName": "metrics",
        "insightParameters": null,
        "measurement": "r2",
        "operator": ">",
        "value": 0.8
      }
    ],
    "subpopulationFilters": null,
    "mode": "development",
    "usesValidationDataset": true,
    "usesTrainingDataset": false,
    "usesMlModel": true,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
  }
]