我正在尝试对一些数据进行随机森林分类,其中类别变量是二进制的(要么是1,要么是0)。这是我运行的代码:
forest.model <- randomForest(x = ticdata2000[,1:85], y = ticdata2000[,86],
ntree=500,
mtry=9,
importance=TRUE,
norm.votes=TRUE,
na.action=na.roughfix,
replace=FALSE,
)
但是当森林到达末尾时,我会遇到以下错误:
Warning message:
In randomForest.default(x = ticdata2000[, 1:85], y = ticdata2000[, :
The response has five or fewer unique values. Are you sure you want to do regression?
当然不是。我不想进行回归分析。我的单一离散变量只有两个类别。当我用这个模型进行预测时,我得到的是连续的数字,而我想要的是一个由0和1组成的列表。请问有人可以告诉我我哪里做错了,为什么会使用回归而不是分类呢?
Y
参数的信息。 - mccurcio