Using  sklearn

Without Splitting

Load Libraries

Read Data from csv file

Mean,Variance, Std

sum(x-xbar)^2

Covariance(x,y)

Coefficients(Parameters) using covariance

Separate dependent and independent variables  and convert to array

Without Spliting the Data

Place results in a new Dataframe

meanA  and mean P

Manual summation:

 

Capture results in another dataframe

Mean Absolute Error (MAE),Mean Squared Error(MSE), Root Mean Squared Error

Report

SST – Sum of squares of Total

SSR – Sum 0f Squares of Regression

 

 

SSE – Sum of Squares of Error

R-Square Calculation using SSR,SSE,SST

Adjusted R-Square

With Splitting of given data

Shape of data after spliting

sklearn.leinear_model

Prediction:

sklearn.metrics

Actual and Predicted using dataframe

Plot using matplotlib