First time here? Checkout the FAQ!
x
0 votes
4k views
asked in Machine Learning by (116k points)  

Given the following sample dataset with 5 samples and 2 features:

Sample Feature 1 Feature 2 Actual Value Predicted Value
1 2 3 4 6
2 3 4 5 7
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9


Calculate the residual errors, mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE) using a sample model.

  

1 Answer

0 votes
answered by (116k points)  

     1. First, we need to calculate the residual errors. Residual errors are the difference between the actual values and predicted values.

Sample Feature 1 Feature 2 Actual Value Predicted Value Residual Error (Actual - Predicted)
1 2 3 4 6 -2
2 3 4 5 7 -2
3 4 5 6 7 -1
4 5 6 7 8 -1
5 6 7 8 9 -1
  1. Next, we can calculate the MSE by taking the average of the squared residual errors.

$MSE = ((-2)^2 + (-1)^2 + (-1)^2 + (-1)^2 + (-1)^2) / 5 = 10 / 5 = 2$

  1. To calculate the MAE, we take the average of the absolute residual errors.

$MAE = (|-2| + |-1| + |-1| + |-1| + |-1|) / 5 = 6 / 5 = 1.2$

  1. Finally, to calculate the RMSE, we take the square root of the MSE.

$RMSE = sqrt(2) = 1.41$

Therefore, the residual errors are [-2, -1, -1, -1, -1], the MSE is 2, the MAE is 1.2, and the RMSE is 1.41.

commented by (100 points)  
For the second sample, the residual error should be 2 since 7-5 = 2. Correct?
commented by (100 points)  
I believe that the 2nd sample for the residual part is correct, which is actual
- predicted (5-7 = -2). However in the second & third question, I think it's incorrect because the second sample in each is "-1" rather than "-2".
The answers should be:
MSE: 2.2
MAE: 1.4
RMSE: 1.4832

Feel free to let me know I'm incorrect in my assumptions.
...