随机森林模式评分

数据挖掘 随机森林 决策树 计分
2022-03-03 17:07:40

我们正在使用随机森林算法,但在理解它使用的评分方法时遇到了一些麻烦。

以测试集的以下 CM 为例:

Threshold 45 cm is: 
[[67969 48031]
 [ 3321 11120]] and the prescion is: 0.18799344051632602
Threshold 50 cm is: 
[[77642 38358]
 [ 4785  9656]] and the prescion is: 0.2011080101632834
Threshold 55 cm is: 
[[88825 27175]
 [ 6796  7645]] and the prescion is: 0.2195577254445159
Threshold 60 cm is: 
[[100411  15589]
 [  9629   4812]] and the prescion is: 0.2358707906463611
Threshold 65 cm is: 
[[112421   3579]
 [ 13098   1343]] and the prescion is: 0.2728565623674755
Threshold 70 cm is: 
[[115895    105]
 [ 14371     70]] and the prescion is: 0.3999999997714286
Threshold 75 cm is: 
[[115998      2]
 [ 14440      1]] and the prescion is: 0.3333333222222226
Threshold 80 cm is: 
[[116000      0]
 [ 14441      0]] and the prescion is: 0.0
Threshold 85 cm is: 
[[116000      0]
 [ 14441      0]] and the prescion is: 0.0
Threshold 90 cm is: 
[[116000      0]
 [ 14441      0]] and the prescion is: 0.0

这就是我们使用 RF 并打印它的分数的方式:

grid_clf = RandomizedSearchCV(clf, param_grid, cv=tscv, verbose=10,n_iter=20,n_jobs=-1,scoring='roc_auc')
grid_clf.fit(X_train, y_train)
print(grid_clf.score(X_test,y_test))

我们为这个模型得到的分数是 0.7350173458471928

据我了解,使用 roc_auc 时的得分在 0.5 到 1 之间。

这么差的模型怎么能拿到这么好的分数呢?

这个分数是怎么计算的?

如果我们预测了足够多的真阳性,我们不介意遗漏“1”并预测假阳性。我们当然介意预测真阴性

我可以更改评分以适应我认为更好的结果吗?

谢谢

1个回答

用于分类的评估指标.score是准确度。

您的模型具有较高的准确度和较低的精度。查看您的混淆矩阵,您有可能导致该结果的类别不平衡。

您不应更改评估指标以获得更好的结果。最好选择对问题最有意义的评估。然后通过收集更多数据、设计更好的特征、更改算法或调整超参数来改进模型。