Accuracy_score

How to check the accuracy for linear regression model.

The R^2 of linear regression model and some other statistics can be obtained using GLM package:

using GLM, DataFrames
x = collect(-10:10)
y = 2.0*x .+ pi .+ rand([-0.1,0.1],length(x))
data = DataFrame(X=x, Y=y)
ols = lm(@formula(Y ~ 1 + X), data)
r2(ols)
2 Likes

Thank you so much.