予測精度を確認する
学習済みモデルがどれくらい予測できるかを確認しましょう。テストデータを使って、Decision Tree の model の精度を score() メソッドで評価します。
この演習はコースの一部です
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