LoslegenKostenlos loslegen

Stacked predictions for app ratings

Once the stacking estimator is built you can fit it to the training set. Then, it will be ready for step 5: use the stacked ensemble for predictions.

The stacking classifier is available to you as clf_stack.

Let's obtain the final predictions and see if there is any improvement in performance thanks to stacking.

Diese Übung ist Teil des Kurses

Ensemble Methods in Python

Kurs anzeigen

Anleitung zur Übung

  • Fit the stacking classifier on the training set.
  • Calculate the final predictions from the stacking estimator on the test set.
  • Evaluate the performance on the test set using the accuracy score.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Fit the stacking classifier to the training set
____

# Obtain the final predictions from the stacking classifier
pred_stack = ____

# Evaluate the new performance on the test set
print('Accuracy: {:0.4f}'.format(____))
Code bearbeiten und ausführen