Session Ready
Exercise

Measure performance

Now that we've fit our neural net, let's check performance to see how well our model is predicting new values. There's not a built-in .score() method like with sklearn models, so we'll use the r2_score() function from sklearn.metrics. This calculates the R\(^2\) score given arguments (y_true, y_predicted). We'll also plot our predictions versus actual values again. This will yield some interesting results soon (once we implement our own custom loss function).

Instructions
100 XP
  • Obtain predictions from model_1 on the scaled test set data (scaled_test_features and test_targets).
  • Print the R\(^2\) score on the test set (test_targets and test_preds).
  • Plot the test_preds versus test_targets in a scatter plot with plt.scatter().