1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning for Finance in Python

Exercise

Visualize the results

We've fit our model with the custom loss function, and it's time to see how it is performing. We'll check the R\(^2\) values again with sklearn's r2_score() function, and we'll create a scatter plot of predictions versus actual values with plt.scatter(). This will yield some interesting results!

Instructions

100 XP
  • Create predictions on the test set with .predict(), model_2, and scaled_test_features.
  • Evaluate the R\(^2\) score on the test set predictions using test_preds and test_targets.
  • Plot the test set targets vs actual values with plt.scatter(), and label it 'test'.