Search code examples
rdecision-treerpart

Top n splits of leaf nodes from decision tree


I'm using rpart pacakge of R and I want to extract the top 3 splits for the leaf node instead of just the best. Is it possible to do this without changing the source code of rpart ?


Solution

  • You can access the splits like this:

    fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
    fit$splits