基于该模型生成混淆矩阵:将预测概率阈值设为 0.6,并计算模型的准确率。
Build a confusion matrix for the model where the threshold value for the probability of predicted values is 0.6, and also find the accuracy of the model.
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: medium
分类: Machine Learning
参考答案摘要
答案 准确率的计算公式如下: 准确率 = (真正例 + 真负例) / (真正例 + 真负例 + 假正例 + 假负例) 在编程实现中可以使用内置的列联统计函数来构建混淆矩阵。 这里将预测概率阈值设置为 0.6:当预测概率大于 0.6 时判为 0,小于 0.6 时判为 1。 最后基于混淆矩阵按上述公式计算模型的准确率。 table(test$target, pred_heart>0.6)
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。