Measure to compare true observed response with predicted response in regression tasks.
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")
Task type: “regr”
Range: \((-\infty, 1]\)
Minimize: FALSE
Average: macro
Required Prediction: “response”
Required Packages: mlr3
Empty ParamSet
mlr3::Measure
-> mlr3::MeasureRegr
-> MeasureRSQ
new()
Creates a new instance of this R6 class.
MeasureRegrRSQ$new(pred_set_mean = TRUE)
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.
clone()
The objects of this class are cloneable with this method.
MeasureRegrRSQ$clone(deep = FALSE)
deep
Whether to make a deep clone.
R Squared is defined as $$ 1 - \frac{\sum_{i=1}^n w_i \left( t_i - r_i \right)^2}{\sum_{i=1}^n w_i \left( t_i - \bar{t} \right)^2}, $$ where \(\bar{t} = \frac{1}{n} \sum_{i=1}^n t_i\) and \(w_i\) are weights.
Also known as coefficient of determination or explained variation. It compares the squared error of the predictions relative to a naive model predicting the mean.
Note that weights are used to scale the squared error of individual predictions (both in the numerator and in the denominator), but the "plug in" value \(\bar{t}\) is computed without weights.
This measure is undefined for constant \(t\).
Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-eval
Package mlr3measures for the scoring functions.
Dictionary of Measures: mlr_measures
as.data.table(mlr_measures)
for a table of available Measures in the running session (depending on the loaded packages).
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
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_regr.pinball
,
mlr_measures_selected_features