1. Learn
  2. /
  3. Courses
  4. /
  5. Winning a Kaggle Competition in Python

Connected

Exercise

Model stacking II

OK, what you've done so far in the stacking implementation:

  1. Split train data into two parts
  2. Train multiple models on Part 1
  3. Make predictions on Part 2
  4. Make predictions on the test data

Now, your goal is to create a second level model using predictions from steps 3 and 4 as features. So, this model is trained on Part 2 data and then you can make stacking predictions on the test data.

part_2 and test DataFrames are already available in your workspace. Gradient Boosting and Random Forest predictions are stored in these DataFrames under the names "gb_pred" and "rf_pred", respectively.

Instructions

100 XP
  • Train a Linear Regression model on the Part 2 data using Gradient Boosting and Random Forest models predictions as features.
  • Make predictions on the test data using Gradient Boosting and Random Forest models predictions as features.