I have one question thats maybe simple, but my brain overfited :)

I wrote a code for simple linear regression in Python and Scikit-Learn, and I calculated score of my model.

        accuracy_test = model.score(x_test, y_test)

I got the score of 0.97. Does that mean that my error is 0.03 (3%)? For example, Is it correct to say, that If i predict some value with model.predict function, and I get result of 100 with that, that I can say that my result will be in range from 97 to 103 because of my 3% error (score of 0.97)?

Can you say this for accuracy_score also?

  • 1
    $\begingroup$ I guess that is accuracy and 3% error signifies that among all the data in test case only 3% were falsely predicted. Your second statement : "and I get result of 100 with that, ... 3% error (score of 0.97)? " is wrong. The error has nothing to do with the range. The error simply says how much of the difference was there in true and predicted. If you run the model again you "might" get different accuracy and error. $\endgroup$ Dec 27 '19 at 16:55

From sklearn's documentation for the score function

Returns the coefficient of determination R^2 of the prediction.

R^2 is a measure of how well the variability of the data is explained by the model. So, at 0.97, the model is able to explain that really well. And yes, it is a measure of accuracy for regression models. However, you cannot construct confidence intervals with that estimate.

accuracy_score is a measure of accuracy for classification models. Again, you cannot construct confidence intervals from the accuracy metric.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.