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}, $$ where \(\bar{t} = \sum_{i=1}^n t_i\).

Also known as coefficient of determination or explained variation. Subtracts the mlr3measures::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\).

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")

Meta Information

  • Task type: “regr”

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

  • Minimize: FALSE

  • Average: macro

  • Required Prediction: “response”

  • Required Packages: mlr3

Parameters

Empty ParamSet

See also

Other Measure: Measure, MeasureClassif, MeasureRegr, MeasureSimilarity, mlr_measures, mlr_measures_aic, mlr_measures_bic, mlr_measures_classif.costs, mlr_measures_debug_classif, mlr_measures_elapsed_time, mlr_measures_internal_valid_score, mlr_measures_oob_error, mlr_measures_selected_features

Super classes

mlr3::Measure -> mlr3::MeasureRegr -> MeasureRSQ

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

MeasureRegrRSQ$new(pred_set_mean = TRUE)

Arguments

pred_set_mean

logical(1)
If TRUE, the mean of the true values is calculated on the prediction set. If FALSE, the mean of the true values is calculated on the training set.


Method clone()

The objects of this class are cloneable with this method.

Usage

MeasureRegrRSQ$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.