The R2 Score is a metric of performance for regression algorithms that represents the proportion of variance (here y) that has been explained by the independent variables in the model. More...
Static Public Member Functions
|static double||Evaluate (MLAlgorithm &model, const DataType &data, const ResponsesType &responses)|
|Run prediction and calculate the R squared error. More...|
Static Public Attributes
|static const bool||NeedsMinimization = false|
|Information for hyper-parameter tuning code. More...|
The R2 Score is a metric of performance for regression algorithms that represents the proportion of variance (here y) that has been explained by the independent variables in the model.
It provides an indication of goodness of fit and therefore a measure of how well unseen samples are likely to be predicted by the model, through the proportion of explained variance. As R2 Score is dataset dependent it can have wide range of values. The best possible score is . Values of R2 outside the range 0 to 1 can occur when the model fits the data worse than a horizontal hyperplane. This would occur when the wrong model was chosen, or nonsensical constraints were applied by mistake. A model which predicts exactly the expected value of y, disregarding the input features, gets a R2 Score equals to 0.0. If a model predicts of the -th sample for a true for total n samples, the R2 Score is calculated by
where . For example, a model having R2Score = 0.85, explains 85 % variability of the response data around its mean.
Definition at line 46 of file r2_score.hpp.
Run prediction and calculate the R squared error.
|model||A regression model.|
|data||Column-major data containing test items.|
|responses||Ground truth (correct) target values for the test items, should be either a row vector or a column-major matrix.|
Information for hyper-parameter tuning code.
It indicates that we want to maximize the measurement.
Definition at line 67 of file r2_score.hpp.