Before we discuss metrics to evaluate a regression model, let’s recall what a linear regression does:
Regression predicts a continuous dependent element in the presence of various independent elements. Linear regression tries to make a trend line that has the least difference between actual and predicted values. This difference is also known as residual.
Before evaluating the model using evaluation metrics, one should go for a residual plot.
Residuals are significant when figuring the quality of the model. One should look at two things in residuals, their magnitude and whether they form a pattern or not.
The further away the residuals are from 0, the more faulty the model is.
When the residual’s average is not zero, it shows that the model is frequently under or over predicting.
When the residual plot consists of patterns, it shows the model fails to explain a few properties of the data.
Residual plots tell us if the model is biased or not, better than any other performance metric. If the residual plot shows a random distribution of the predicted and actual values and not a particular pattern, then we can evaluate the model with various other metrics.
We have residuals for each and every data point, but we need some summarizing agents to see the overview of the data. That’s where these metrics come in.
The metrics to evaluate regression models are as follows:
It is the mean of the absolute difference between the actual value in the dataset and the value predicted by the model.
Figure 2
N = the count of the data points.
Y = the actual value in the dataset
Y cap = the model’s predicted value.
The absolute values are taken, and if it’s not then the negative and positive difference will cancel out each other. The smaller the MAE, the more accurate the model is. If MAE is zero it shows the model is perfect. If MAE is large then the model is not good.
This is the mean of the squared difference of the actual value in the dataset and the value predicted by the model.
Figure 3
N = the count of data points in the data.
Y = the actual value in the dataset.
Y cap= the model’s predicted value.
The MSE will be large if there are outliers in the dataset, this is not the case with MAE.
MSE focuses on larger errors, as when we are squaring the error the effect of large errors becomes more prominent.
If the errors are low, lower than one, then it leads to underestimating the model’s error.
It is the mean of root squared subtraction between the actual value in the dataset and the value predicted by the model.
It’s the same as MSE, we are just taking the root of it.
The smaller the value of root mean squared error, the more accurate the model is.
Figure 4
**R Square: **
It estimates the ratio of the variance of the dependent element described by the target element.
It’s used for finding the accuracy of the model. It depicts the closeness of the data points to the trend line made by the model. This helps to make a link between the independent element and the target element.
R square is from zero to one. The nearer R square is to one, the more accurate the model.
Figure 5
SSE is the sum of the square difference of the residuals.
Figure 6
SST is the sum of the difference of the actual value of the data and the mean of all the actual values in data.
Figure 7
When we add more elements in the data then R square increases, for this we can use adjusted R square.
I hope you now have ideas of different metrics of evaluating a regression model.