How to use R Random forests to reduce attributes having no discrete classes?
I want to use Random forests for attribute reduction. One problem I have in my data is that I don't have discrete class - only continuous, which indicates 开发者_运维知识库how example differs from 'normal'. This class attribute is a kind of distance from zero to infinity. Is there any way to use Random forest for such data?
That should be no problem -- RF will just switch to regression mode. Use randomForest
function from the randomForest
package.
To get object similarity with proximity=TRUE
argument, like:
randomForest(Sepal.Length~.,data=iris,proximity=TRUE)$proximity
To get node-purity (Gini-index like) attribute importance:
randomForest(Sepal.Length~.,data=iris)$importance[,"IncNodePurity"]
To get mean MSE increase (accuracy-decrease like) attribute importance:
randomForest(Sepal.Length~.,data=iris,importance=TRUE)$importance[,"%IncMSE"]
精彩评论