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

A classification tree is built now for the German credit data by using the rpart function. The approach of train, validate, and test is implemented, and the ROC curves are obtained too.

  1. The following code has been used earlier in the book, and hence there won't be an explanation of it:
    set.seed(1234567)
    data_part_label <- c("Train","Validate","Test")
    indv_label = sample(data_part_label,size=1000,replace=TRUE,prob=c(0.6,0.2,0.2))
    library(ROCR)
    data(GC)
    GC_Train <- GC[indv_label==»Train»,]
    GC_Validate <- GC[indv_label==»Validate»,]
    GC_Test <- GC[indv_label=="Test",]
  2. Create the classification tree for the German credit data, and visualize the tree. We will also extract the rules from this classification ...

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