使用bigrf预测概率

时间:2015-06-18 04:34:11

标签: r bigdata

我能够使用bigrf()包构建模型,但是有没有办法预测概率而不是类?对于课堂预测,我使用

predictions <- predict(forest, test, testset$y)

森林是一种模式。我试过type = "prob"但没有做任何事情。有没有办法做到这一点?

我有大数据,所以我需要使用这个软件包才能处理它。

UPD:

library(bigrf)
library(randomForest)

data("iris")
iris <- iris[iris$Species != "virginica",]
x <- iris[,1:4]
y <- iris$Species

vars <- c(1:4)
s = sample(1:nrow(x), 60)
registerDoParallel(cores=detectCores(all.tests=TRUE))
forest <- bigrfc(x[s, ], y[s], ntree=5L, varselect=vars)
predictions <- predict(forest, x[-s, ])

那么,问题是如何获得预测中的概率而不是来自对象类bigrfc的类?

1 个答案:

答案 0 :(得分:1)

根据this post,应该可以通过

获得类概率
predictions_probs <- predictions@testvotes/rowSums(predictions@testvotes)

我还没有测试过它。 HTH。

相关问题