How to set cutoff while training the data in Random Forest in Spark

放肆的年华 提交于 2019-12-12 06:01:09

问题


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.

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/packages/randomForest/randomForest.pdf

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.


回答1:


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.



来源:https://stackoverflow.com/questions/30569201/how-to-set-cutoff-while-training-the-data-in-random-forest-in-spark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!