Session Ready
Exercise

Predicting on test data

The stacked ensemble's performance on the training data was encouraging, wasn't it? Let's try predicting again with each base learner and then with the stacked model, but this time on the test data. In a Machine Learning interview, you will need to decide whether the extra complexity brought by your ensemble model is justified based on the performance gains with respect to the set of individual base learners. This exercise caps off all the efforts you have been doing in the last few exercises.

A custom function named evaluateModel() has been written for you, which takes in the training object and test data, and returns the model accuracy and AUC score. You can check out its source code by typing evaluateModel in the console.

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Apply the evaluateModel() custom function to each base learner in stack.glm$models on the testing dataset. Store the result in the baseLearnerStats matrix.
  • Convert the above matrix to the baseLearnerDF data frame.