We now need to measure the performance of our model to see if we really have any power to predict Sales using TV as in independent variable. To do this, we can load in our test set, make predictions using our trained model for each test example, and then calculate one of the evaluation metrics discussed in Chapter 3, Evaluation and Validation.
For this problem, let's use the Mean Absolute Error (MAE) as our evaluation metric. This seems reasonable, because it results in something directly comparable with our Sales values and we do not have to be too worried about outliers or extreme values.
To calculate the predicted Sales values using our trained regression.Regression value, we just need to parse the values in ...