你的第一個 pipeline
你的同事在信用評分資料集上使用了 AdaBoostClassifier。你也想嘗試隨機森林分類器。在本練習中,你會將這個分類器套用到資料上,並與 AdaBoostClassifier 比較。請務必使用訓練/測試資料切分來避免過度擬合。資料已預先載入並轉換為所有特徵皆為數值。特徵為 X,標籤為 y。模組 RandomForestClassifier 也已預先載入。
本練習屬於課程
在 Python 設計機器學習工作流程
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Split the data into train and test, with 20% as test
X_train, ____, ____, y_test = train_test_split(
X, y, ____=0.2, random_state=1)