Learn R Programming

MLmetrics (version 1.0.0)

R2_score: R-Squared (Coefficient of Determination) Regression Score

Description

Compute the R-Squared (Coefficient of Determination) Regression Score.

Usage

R2_score(y_true, y_pred)

Arguments

y_true
Ground truth (correct) target values vector
y_pred
Estimated target values vector

Value

  • R^2 score

Examples

Run this code
data(cars)
reg <- lm(log(dist)~log(speed), data=cars)
R2_score(y_true=log(cars$dist), y_pred=reg$fitted.values)

Run the code above in your browser using DataLab