A user has generated a simple tree using the rpart() function, however he would like to be able to stop the second split at Petal.Length < 4.9 before it splits by Petal.Width. How to do that?

745    Asked by IraJoshi in Data Science , Asked on Nov 5, 2019
Answered by Ira Joshi

Below is the code.


There is no such hard and fast rule for this problem but one possible approach is to use the snip argument of rpart.plot

The below code can solve the problem.


This puts the tree on the screen, which we can manually prune with the help of the mouse. 


Your Answer

Interviews

Parent Categories