您的位置:首页 > 其它

A Brief Tour of the Trees and Forests

2017-01-15 17:11 393 查看
Tree methods such as CART (classification and regression trees) can be used as alternatives to logistic regression. It is a way that can be used to show the probability of being in any hierarchical group. The following is a compilation of many of the key R
packages that cover trees and forests. The goal here is to simply give some brief examples on a few approaches on growing trees and, in particular, the visualization of the trees. These packages include classification and regression trees, graphing and visualization,
ensemble learning using random forests, as well as evolutionary learning trees. There are a wide array of package in R that handle decision trees including trees for longitudinal studies. I have found that when using several combinations of these packages
simultaneously that some of the function begin to fail to work.The concept of trees and forests can be applied in many different setting and is often seen in machine learning and data mining settings or other settings where there is a significant amount of data. The examples below are by no means comprehensive and exhaustive.
However, there are several examples given using different datasets and a variety of R packages. The first example uses some data obtain from the Harvard Dataverse Network. For reference the data can be obtain from http://dvn.iq.harvard.edu/dvn/.
The study was recently released on April 22nd, 2013 and the raw data as well as the documentation is available on the Dataverse web site and the study ID is hdl:1902.1/21235. The other examples use data that are shipped with the R packages.rpartThis package includes several example sets of data that can be used for recursive partitioning and regression trees. Categorical or continuous variables can be used depending on whether one wants classification trees or regression trees. This package as well
at the tree package are probably the two go-to packages for trees. However, care should be taken as the tree package and the rpart package can produce very different results.


treeThis is the primary R package for classification and regression trees. It has functions to prune the tree as well as general plotting functions and the mis-classifications (total loss). The output from tree can be easier to compare to the General
Linear Model (GLM) and General Additive Model (GAM) alternatives.


partyThis is another package for recursive partitioning. One of the key functions in this package is ctree. As the package documention indicates it can be used for continuous, censored, ordered, nominal and multivariate response variable in a conditional inference
framework. The party package also implements recursive partitioning for survival data.


maptreemaptree is a very good at graphing, pruning data from hierarchical clustering, and CART models. The trees produced by this package tend to be better labeled and higher quality and the stock plots from rpart.


partykitThis contains a re-implementation of the ctree function and it provides some very good graphing and visualization for tree models. It is similar to the party package. The example below uses data from airquality dataset and the famous species data
available in R and can be found in the documentation.
evtreeThis package uses evolutionary algorithms. The idea behind this approach is that is will reduce the a priori bias. I have seen trees of this sort in the area of environmental research, bioinformatics, systematics, and marine biology. Though there
are many other areas than that of phylogentics.


randomForestRandom forests are very good in that it is an ensemble learning method used for classification and regression. It uses multiple models for better performance that just using a single tree model. In addition because many sample are selected in the process
a measure of variable importance can be obtain and this approach can be used for model selection and can be particularly useful when forward/backward stepwise selection is not appropriate and when working with an extremely high number of candidate variables
that need to be reduced.
>importance(rf1)
%IncMSEIncNodePurity
x130.301468657.963
x27.7391633675.853
x30.586905240.275
x4-0.82209381.6304
x50.583622253.3885


varSelRFThis can be used for further variable selection procedure using random forests. It implements both backward stepwise elimination as well as selection based on the importance spectrum. This data uses randomly generated data so the correlation matrix can set
so that the first variable is strongly correlated and the other variables are less so.


oblique.treeThis package grows an oblique decision tree (a general form of the axis-parallel tree). This example uses the crab dataset (morphological measurements on Leptograpsus crabs) available in R as a stock dataset to grow the oblique tree.


CORElearnThis is a great package that contain many different machine learning algorithms and functions. It include trees, forests, naive Bayes, locally weighted regression, among others.


longRPartThis provides an implementation for recursive partitioning for longitudinal data. It uses the rules from rpart and the mixed effects models from nlme to grow regression trees. This can be a little resource intensive on some slower computers.


REEMtreeThis package is useful for longitudinal studies where random effects exist. This example uses the pbkphData dataset available in the longRPart package.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  decision tree