開始使用免費開始

檢查預測的準確度

現在是時候檢視你訓練好的模型能多準確地做出預測了!請用測試集,透過 score() 方法來檢查你的決策樹 model 的準確度。

本練習屬於課程

HR 分析:用 Python 預測員工流失

檢視課程

練習說明

  • 在訓練集中,套用決策樹 model,將 features 擬合到 target
  • 檢查訓練集預測的準確度 score()
  • 檢查測試集預測的準確度 score()

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Apply a decision tree model to fit features to the target in the training set
model.fit(____,____)

# Check the accuracy score of the prediction for the training set
model.____(features_train,____)*100

# Check the accuracy score of the prediction for the test set
model.____(____,____)*100
編輯並執行程式碼