如何在 Spark 随机森林中训练数据时设置截止 [英] How to set cutoff while training the data in Random Forest in Spark

查看:31
本文介绍了如何在 Spark 随机森林中训练数据时设置截止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Spark Mlib 训练数据以使用随机森林算法进行分类.MLib 提供了一个 RandomForest 类,该类具有 trainClassifier 方法,可以执行所需的操作.

I am using Spark Mlib to train the data for classification using Random Forest Algorithm. The MLib provides a RandomForest Class which has trainClassifier Method which does the required.

我可以在训练数据集时设置阈值吗,类似于 R 的 randomForest 包中提供的 cutoff 选项.

Can I set a threshold value while training the data set, similar to the cutoff option provided in R's randomForest Package.

http://cran.r-project.org/web/包/randomForest/randomForest.pdf

我发现 MLib 的 RandomForest 类仅提供传递树数、杂质、类数等的选项,但没有像 thresholdcut 那样的选项关闭选项可用.可以通过任何方式完成吗.

I found the RandomForest Class of MLib provides options only to pass number of trees, impurity, number of classes etc but there is nothing like threshold or cut off option available. Can it be done by any way.

推荐答案

简短的版本是没有,如果我们查看 RandomForestClassifier.scala 你会发现它总是简单地选择最大值.您可以覆盖 predict 函数 if,但它不是超级干净.我添加了一个 jira 来跟踪添加这个.

The short version is no, if we look at RandomForestClassifier.scala you can see that it always simply selects the max. You could override the predict function if, but its not super clean. I've added a jira to track adding this.

这篇关于如何在 Spark 随机森林中训练数据时设置截止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆