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:
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
source to share
No one has answered this question yet
Check out similar questions: