針對應用程式評分的堆疊預測
建立好 stacking 估計器後,你就可以把它擬合到訓練集。接著就能進行步驟 5:使用堆疊式集成進行預測。
stacking 分類器已以 clf_stack 提供給你。
讓我們產生最終預測,看看在 stacking 的加持下,效能是否有所提升。
本練習屬於課程
Python 的 Ensemble 方法
練習說明
- 在訓練集上擬合 stacking 分類器。
- 在測試集上,從 stacking 估計器計算最終預測。
- 使用 accuracy 分數在測試集上評估效能。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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(____))