检查预测的准确率
现在是检验已训练模型预测效果的时候了!请使用测试集,通过 score() 方法检查您的决策树 model 的准确率。
本练习是课程的一部分
HR Analytics:用 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