Now, let's see how we did by making predictions on the test data of the Duto-Mpg dataset. Remember, our model has never seen the test data that we scaled previously! This process is the same process that you would use on brand-new data.
Let's look at the test data that we've just analyzed:
test_predictions = model.predict(normed_test_data).flatten()
plt.scatter(test_labels, test_predictions)
plt.xlabel('True Values [MPG]')
plt.ylabel('Predictions [MPG]')
plt.axis('equal')
plt.axis('square')
plt.xlim([0,plt.xlim()[1]])
plt.ylim([0,plt.ylim()[1]])
_ = plt.plot([-100, 100], [-100, 100])
plt.show()
The scatter plot between the predicted and true values shows the error in the model:
Fig 3.11: True values versus predicted values
In the next section, we will evaluate the performance of the model.