在决策树上设置阈值?

Set Thresholds on a Decision Tree?

有人可以向我解释一下 Apache Spark 中梯度提升树和随机森林的 setThresholds() 函数的用途是什么吗? Apache Spark 官方网站上没有使用该功能的文档或示例,我很好奇是否可以将它用于我的特定目的。这个函数是否为树做出的内部决策设置了阈值?例如,对于数字列,使用 setThresholds(5.0) 等同于 if(column < 5.0)?还是我错了?

您似乎没有检查 documentation 的正确部分。

thresholds 值定义如下:

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.

而且您已经注意到,实际上 thresholds 是复数形式,而不仅仅是一个阈值。

您可以使用 setThresholds(foo) 设置阈值,其中 foo 是阈值。