IT13122256 Ranawaka R.A.S.M IT13122256 Ranawaka R.A.S.M - 5 months ago 29
Python Question

calculate accuracy using r value

I'm using a linear regression model to predict the weather data for one year. Prediction is done using Python's

sklearn
library. The problem is that I need to find the accuracy of the prediction. After a quick internet search I found out that r^2 is the way to find out the accuracy. I calculated the r value as follows:

r value
0.0919309031356
Coefficients:
[-20.01071429 0. ]
Residual sum of squares: 19331.78
Variance score: -0.23


The problem is that I need to show the accuracy as a percentage. How do I do that? Do I need use a tool to find out the accuracy?

Answer

Maybe this question is more complicated than I think, but why not just

r = str((r**2) * 100) + '%'