From: Stephen Choularton > > Hi > > I am trying to use randomForest for classification. I am using this > code: > > > set.seed(71) > > rf.model <- randomForest(similarity ~ ., data=set1[1:100,], > importance=TRUE, proximity=TRUE) > Warning message: > The response has five or fewer unique values. Are you sure > you want to > do regression? in: randomForest.default(m, y, ...) > > rf.model > > Call: > randomForest(x = similarity ~ ., data = set1[1:100, ], importance = > TRUE, proximity = TRUE) > Type of random forest: regression > Number of trees: 500 > No. of variables tried at each split: 10 > > Mean of squared residuals: 0.1159130 > % Var explained: 50.8 > > > > As you can see I get a regression model. How can I make sure I get a > classification model?
By making sure your response variable is a factor, e.g., set1$similarity <- as.factor(set1$similarity) Andy > Thanks . > > Stephen > > -- > > > > 2/01/2006 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html