Hi, I am doing feature selection for my dataset. The following is the extreme case where only one feature is left. But I got the error below. So my question is that do I have to use more than one features? sample.subset udomain.edu hpclass 1 -1.0 not 2 -1.0 not 3 -0.2 not 4 1.0 hp 5 1.0 hp> randomForest(hpclass ~., data=sample.subset, importance=TRUE);Error in if (n == 0) stop("data (x) has 0 rows") : argument is of length zero Best regards, Hui Han Department of Computer Science and Engineering, The Pennsylvania State University University Park, PA,16802 email: hhan at cse.psu.edu homepage: http://www.cse.psu.edu/~hhan
I don't see much why to use random forest with only one predictive variable! Recall that random forest grow trees with a random subset of variables "in competition" for growing each node of the trees in the forest... How do you make such a random subset with only one predictive variable? there is no point here! Philippe Grosjean -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Hui Han Sent: Tuesday, 13 April, 2004 17:16 To: r-help at stat.math.ethz.ch Subject: [R] randomForest: more than one variable needed? Hi, I am doing feature selection for my dataset. The following is the extreme case where only one feature is left. But I got the error below. So my question is that do I have to use more than one features? sample.subset udomain.edu hpclass 1 -1.0 not 2 -1.0 not 3 -0.2 not 4 1.0 hp 5 1.0 hp> randomForest(hpclass ~., data=sample.subset, importance=TRUE);Error in if (n == 0) stop("data (x) has 0 rows") : argument is of length zero Best regards, Hui Han Department of Computer Science and Engineering, The Pennsylvania State University University Park, PA,16802 email: hhan at cse.psu.edu homepage: http://www.cse.psu.edu/~hhan ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
With only one `x' variable, RF will be identical to bagging. This looks like a bug. I will check it out. Andy> From: Hui Han > > I agree with you about the less practical meaning of this sample of > the extreme case. I am just curious about the "grammar" syntax of > randomForest. > > Thanks. > Hui > > On Tue, Apr 13, 2004 at 05:29:06PM +0200, Philippe Grosjean wrote: > > I don't see much why to use random forest with only one > predictive variable! > > Recall that random forest grow trees with a random subset > of variables "in > > competition" for growing each node of the trees in the > forest... How do you > > make such a random subset with only one predictive > variable? there is no > > point here! > > > > Philippe Grosjean > > > > -----Original Message----- > > From: r-help-bounces at stat.math.ethz.ch > > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Hui Han > > Sent: Tuesday, 13 April, 2004 17:16 > > To: r-help at stat.math.ethz.ch > > Subject: [R] randomForest: more than one variable needed? > > > > > > Hi, > > > > I am doing feature selection for my dataset. The following is > > the extreme case where only one feature is left. But I got > > the error below. So my question is that do I have to use > > more than one features? > > > > sample.subset > > udomain.edu hpclass > > 1 -1.0 not > > 2 -1.0 not > > 3 -0.2 not > > 4 1.0 hp > > 5 1.0 hp > > > randomForest(hpclass ~., data=sample.subset, importance=TRUE); > > Error in if (n == 0) stop("data (x) has 0 rows") : > > argument is of length zero > > > > Best regards, > > Hui Han > > Department of Computer Science and Engineering, > > The Pennsylvania State University > > University Park, PA,16802 > > email: hhan at cse.psu.edu > > homepage: http://www.cse.psu.edu/~hhan > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > > http://www.R-project.org/posting-guide.html > > > > > > > > > Hui Han > Department of Computer Science and Engineering, > The Pennsylvania State University > University Park, PA,16802 > email: hhan at cse.psu.edu > homepage: http://www.cse.psu.edu/~hhan > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
On Tue, 13 Apr 2004, Hui Han wrote:> Hi, > > I am doing feature selection for my dataset. The following is > the extreme case where only one feature is left. But I got > the error below. So my question is that do I have to use > more than one features? > > sample.subset > udomain.edu hpclass > 1 -1.0 not > 2 -1.0 not > 3 -0.2 not > 4 1.0 hp > 5 1.0 hp > > randomForest(hpclass ~., data=sample.subset, importance=TRUE); > Error in if (n == 0) stop("data (x) has 0 rows") : > argument is of length zero >no idea about the error message, but there is no need for feature selection before using random forests - give it a try without preselection of variables. best Torsten> Best regards, > Hui Han > Department of Computer Science and Engineering, > The Pennsylvania State University > University Park, PA,16802 > email: hhan at cse.psu.edu > homepage: http://www.cse.psu.edu/~hhan > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >