【发布时间】:2018-09-10 04:06:41
【问题描述】:
我遇到了随机森林引发错误的问题。
我有这个数据框,其中包含已经是矩阵形式的推文数据,其中包含我试图预测的情绪列。
'data.frame': 1000 obs. of 2155 variables:
$ anoth : num 1 0 0 0 0 0 0 0 0 0 ...
$ cancel : num 1 0 0 0 0 0 0 0 0 0 ...
$ flight : num 2 1 0 0 0 0 0 0 1 0 ...
$ hold : num 1 0 0 0 0 0 0 0 0 0 ...
$ hour : num 2 0 0 0 0 0 0 0 0 0 ...
$ ive : num 1 0 0 0 0 0 0 0 0 0 ...
这是我抛出错误的随机森林。
model_rf <- randomForest(data = dtm.df[train,],
formula = as.factor(sentiment) ~ .,
importance = T, do.trace = F)
我的情绪列基本上是一个正面和负面值的列表
Factor w/ 2 levels "negative","positive": 1 1 1 1 1 1 1 1 1 1 ...
[1] negative negative negative negative negative negative negative negative
[9] negative negative negative negative negative negative negative negative
我得到的错误是
Error in nrow(x) : argument "x" is missing, with no default
如果有人能帮我解决这个问题,我将不胜感激。我只是卡住了
【问题讨论】:
标签: r random-forest