How to manually add a rule to a classification tree in R

I have installed two classification trees using the rpart and tree packages in R. I would like to manually add a rule to one of the installed trees, whichever is easiest. Is there a way to do this?

Here is an example (taken from the article A Brief Tour of Trees and Forests ) of what I want to achieve:

library(tree)
tr = tree(frmla, data=raw)
summary(tr)
plot(tr); text(tr)

      

This is what a fitted tree would look like:

The fitted tree

Now, let's say for some reason (i.e. my previous knowledge or based on a different fitted tree for a different dataset), I want to set NM's answer, it is Koc <5. Since this information is not in the training set used to set the above tree. how can i include this in it?

+3
r tree rpart


source to share


No one has answered this question yet

Check out similar questions:

2474
How to make a great R reproducible example
3
Classification tree based on pruning rules (PART algorithm)
2
R with Rpart tree
1
Construction of linear discriminant analysis, classification tree and Naives Bayes curve on one ROC site
1
R using the existing classification system to assign new sites
1
RPART explains forecast output for type matrix
1
Predict response variables from rpart classification tree
0
How to create a learning curve (offset / deviation) from carriage exit :: train
0
Possibly redesigned classification tree, but with persistent prediction error
0
Exploring Classification Tree Modeling in R



All Articles
Loading...
X
Show
Funny
Dev
Pics