O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – the construction of a classification tree

The getNode function is now defined here to help us identify the best split for the classification problem. For the Kyphosis dataset from the rpart package, we plot the classification tree by using the rpart function. The tree is reobtained by using the getNode function.

  1. Using the option of split="information", construct a classification tree based on the cross-entropy information for the kyphosis data with the following code:
    ky_rpart <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,parms=list(split="information"))
  2. Visualize the classification tree by using plot(ky_rpart); text(ky_rpart):

    Figure 12: Classification tree for the kyphosis problem

  3. Extract rules from ex_rpart by using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required