# Evaluation of linear regression model

I want to evaluate the performance of my linear regression model. I have the true values of y (y-true). I am thinking of two way for evaluation but not sure which one is correct.

Let's assume that we have 2 samples and each sample has two outputs as following:

y_true = [[0.5, 0.5],[0.6, 0.3]]
y_pred = [[0.3, 0.7],[0.9, 0.1]]


- Approach#1 :

One way to calculate the sum of the difference between the actual and predicted for each vector and then average all, as follows:

sum_diff_Vector(1) = abs( 0.5 - 0.3 ) + abs( 0.5 - 0.7 ) = 0.4

sum_diff_Vector(2) = abs( 0.6 - 0.9 ) + abs( 0.3 - 0.1 ) = 0.5

Then avg ( sum_diff_Vector(1) , sum_diff_Vector(2) ) = 0.45

- Approach#2 :

Another way to use the mean absolute error provided by sklearn.metrics in python. The thing with this metric, as opposed to the previous method, it calculates the mean absolute error for each output over all samples independently and then average all of them, as follows:

MAE_OUTPUT(1) = abs(( 0.5 - 0.3 ) + ( 0.6 - 0.9 )) / 2 = 0.25

MAE_OUTPUT(1) = abs(( 0.5 - 0.7 ) + ( 0.3 - 0.1 )) /2 = 0.2

Then avg ( MAE_OUTPUT(1) , MAE_OUTPUT(1) ) = 0.225