找回密码
 立即注册
查看: 3364|回复: 0

哪位精通的可以花点时间帮我解决一下下面的问题啊,这个问题卡了我好几天了,,万...

[复制链接]
发表于 2014-8-22 17:15:04 | 显示全部楼层 |阅读模式
下面的都是同一个例子,报不同的错,怎么样能算出正确结果啊
(1)> library(randomForest)
randomForest 4.6-10
Type rfNews() to see new features/changes/bug fixes.
>insect<read.csv("d:/data/insects.csv",header=TRUE)
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=10000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1','L2','L3','L4')]?


(2)> library(randomForest)
randomForest 4.6-10
Type rfNews() to see new features/changes/bug fixes.
> insect<-read.csv("D:/data/insects.csv",header=TRUE)
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=3000)
Error in `[.data.frame`(insect, "species") : undefined columns selected
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['Species'],importance=TRUE,ntree=3000)
Error in randomForest.default(insect[c("L1", "L2", "L3", "L4")], insect["Species"],  :
  length of response must be the same as predictors
In addition: Warning message:
In randomForest.default(insect[c("L1", "L2", "L3", "L4")], insect["Species"],  :
  The response has five or fewer unique values.  Are you sure you want to do regression?


> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['Species'],importance=TRUE,ntree=3000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1'?
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=3000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1'?
> RF1<-randomForest(insect [c('L1','L2','L3','L4')],insect ['species'],importance=TRUE,ntree=10000)
Error: unexpected input in "RF1<-randomForest(insect [c('L1'?
>


补充:请问怎么样可以看到随机森林程序的源代码?如果能看到的话,可以进行断点调试么?


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-25 15:34 , Processed in 0.020782 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表