How to do it...

Perform the following steps to classify the telecom churn dataset with the boosting method:

  1. You can use the boosting function from the adabag package to train the classification model:
        > set.seed(2)
        > churn.boost = boosting(churn ~.,data=trainset,mfinal=10, 
coeflearn="Freund", boos=FALSE , control=rpart.control(maxdepth=3))
  1. You can then make a prediction based on the boosted model and testing dataset:
        > churn.boost.pred = predict.boosting(churn.boost,newdata=testset)  
  1. Next, you can retrieve the classification table from the predicted results:
        > churn.boost.pred$confusion
        Output
                       Observed Class
        Predicted Class yes  no
                    no   41 858
                    yes 100  19  
  1. Finally, you can obtain the average errors from the predicted results:
        > churn.boost.pred$error
        Output
        [1] 0.0589391  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset