是否可以使用带有 spark mllib 的 GradientBoostedTrees 获得 class 概率?

Is it possible to obtain class probabilities using GradientBoostedTrees with spark mllib?

我目前正在使用 spark mllib。

我使用梯度提升算法和 class GradientBoostedTrees 创建了一个文本 classifier:

Gradient Boosted Trees

目前我获得了预测以了解新元素的 class 但我想获得 class 概率(硬决策之前的输出值)。

在逻辑回归等其他 mllib 算法中,您可以从 classifier 中删除阈值以获得 class 概率,但我找不到使用 GradientBosstedTrees 执行相同过程的方法。

据我所知,目前还不可能,但随机森林是可能的。

你可以看到这个link...我在这里解释了一个程序 Predicting probabilities of classes in case of Gradient Boosting Trees in Spark using the tree output

为了实现预测的概率和阈值,需要使用来自

的树编写程序
print(model.toDebugString)

输出。我试图了解这棵树如何预测在 Spark 之外是相当简单的。

似乎在 Spark MLLIB 中无法获得 class 概率。

您只能获得最终的class化决定。

很遗憾,因为该信息非常有用(如果您 class将样本确定为阳性且 99.99% 的可能性与 51% 不同)并且获取该信息并不困难模型训练完成后。

另一种方法是使用不同的软件,如 xgboost:https://github.com/dmlc/xgboost