Data Science Desktop Survival Guide
by Graham Williams |
|||||
Regression Trees |
The discussion so far has dwelt on classification trees. Regression trees are similarly well catered for in R.
We can plot regression trees as with classification trees, but the node information will be different and some options will not make sense. For example, extra= only makes sense for 100 and 101.
First we will build regression tree:
target <- "risk_mm"
vars <- c(inputs, target) form <- formula(paste(target, "~ .")) (model <- rpart(formula=form, data=ds[tr, vars]))
|