Monday, May 18, 2020

Error Calculation Techniques For Linear Regression

I hope you and your model are doing good !


There are various methods to calculate the accuracy of our model. In this article I’m going to cover a few of them. In this article we are not going to use python libraries to calculate accuracy of models, but instead we are going to do it from scratch. I hope you guys enjoy it.

In this article I’m going to use a user defined function to calculate the slope and intercept of a regression line. So if you haven’t read my previous article about it’s derivation then I think it’ll be for you to start with that. It won’t take more than 5 mins!!

So let’s get started!

*******

(1) Initialize our data set :

(2) Plot the data on scatterplot :

(3) Main function to calculate the slope and intercept :

(4) Print the slope and intercept values :

(5) Prediction function :

(6) Predicting our value :

(7) Plot the regression line :

Accuracy Of Model :



(1) Residual Sum Of Squares : (RSS)





(2) Mean Absolute Error : (MAE)




    


(3) Mean Squared Error : (MSE)






(4) Mean Absolute percentage Error (MAPE) :






(5) Mean Percentage Error : (MPE)






(6) Root Mean Squared Error : (RMSE)





So, that’s it for this article!


*******

Part 1 : Linear Regression From Scratch.

Part 2 : Linear Regression Line Through Brute Force.

Part 3 : Linear Regression Complete Derivation.

Part 4 : Simple Linear Regression Implementation From Scratch.

Part 5 : Simple Linear Regression Implementation Using Scikit-Learn.

*******

If you have any additional questions; feel free to contact me shuklapratik22@gmail.com

To find more such detailed explanation, visit my blog: patrickstar0110.blogspot.com


No comments:

Post a Comment