Skip to contents

Measure to compare true observed response with predicted response in regression tasks.

Details

R Squared is defined as $$ 1 - \frac{\sum_{i=1}^n \left( t_i - r_i \right)^2}{\sum_{i=1}^n \left( t_i - \bar{t} \right)^2}. $$ Also known as coefficient of determination or explained variation. Subtracts the rse() from 1, hence it compares the squared error of the predictions relative to a naive model predicting the mean.

This measure is undefined for constant \(t\).

Note

The score function calls mlr3measures::rsq() from package mlr3measures.

If the measure is undefined for the input, NaN is returned. This can be customized by setting the field na_value.

Dictionary

This Measure can be instantiated via the dictionary mlr_measures or with the associated sugar function msr():

mlr_measures$get("regr.rsq")
msr("regr.rsq")

Parameters

Empty ParamSet

Meta Information

  • Type: "regr"

  • Range: \((-\infty, 1]\)

  • Minimize: FALSE

  • Required prediction: response