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

Connected

Exercise

See how the ensemble performed

Let's check performance of our ensembled model to see how it's doing. We should see roughly an average of the R\(^2\) scores, as well as a scatter plot that is a mix of our previous models' predictions. The bow-tie shape from the custom loss function model should still be a bit visible, but the edges near x=0 should be softer.

Instructions

100 XP
  • Evaluate the R\(^2\) scores on the train and test sets. Use the sklearn r2_score() function (already imported for you) with train_targets and train_preds from the previous exercise.
  • Plot the train and test predictions versus the actual values with plt.scatter().