gpt4 book ai didi

apache-spark - 如何使用 Spark 决策树调整分类阈值

转载 作者:行者123 更新时间:2023-12-03 09:24:05 25 4
gpt4 key购买 nike

我正在使用 Spark 2.0 和新的 spark.ml。包。
有没有办法调整分类阈值,以便减少误报的数量。
如果重要的话,我也在使用 CrossValidator。

我看到 RandomForestClassifier 和 DecisionTreeClassifier 都输出一个概率列(我可以手动使用,但 GBTClassifier 没有。

最佳答案

听起来您可能正在寻找 thresholds 范围:

final val thresholds: DoubleArrayParam

Param for Thresholds in multi-class classification to adjust the probability of predicting each class. Array must have length equal to the number of classes, with values >= 0. The class with largest value p/t is predicted, where p is the original probability of that class and t is the class' threshold.



您需要通过调用 setThresholds(value: Array[Double]) 来设置它。在你的分类器上。

关于apache-spark - 如何使用 Spark 决策树调整分类阈值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39359631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com