Question: ) Consider Script 6.2.below in R Set the trials parameter at the value giving the fewest misclassified churners in Exercise 1. Starting with minCases =10,
- ) Consider Script 6.2.below in R Set the trials parameter at the value giving the fewest misclassified churners in Exercise 1. Starting with minCases =10, experiment with alternative settings for minCases in increments of 10 up to and including 100. Make a table to show overall accuracy, and the total number of misclassified churners within the created tree for each value of minCases. Given that your goal is to minimize the misclassification of churners, make a statement about a best choice for minCases. USE R
| minCases | Accuracy % | Yes classified as No |
| 10 | 95.32 | 70 |
| 20 |
|
|
| 30 |
|
|
| 40 |
|
|
| 50 |
|
|
| 60 |
|
|
| 70 |
|
|
| 80 |
|
|
| 90 |
|
|
| 100 |
|
|
The best overall accuracy with the fewest incorrectly identified churners is seen with minCases = _____ and trials set at _____. This gives some support to setting minCases at a higher value thus allowing a more generalized tree.
# Script 6.2 Predicting Customer Churn: C5.0
#PREPROCESSING library(C50) set.seed(100)
# The output attribute for churnTrain & churnTest # must be restructured so yes is associated with factor 1 # and no with factor 2. See the errata file for further # explanation. churnTrain$churn <- factor(churnTrain$churn, order = TRUE, levels = c('yes','no')) churnTest$churn <- factor(churnTest$churn, order = TRUE, levels = c('yes','no'))
# CREATE THE DECISION TREE churn.C50 <-C5.0(churn ~ ., data=churnTrain,trials=1, control=C5.0Control(minCases=50)) churn.C50 summary(churn.C50)
# TEST THE MODEL
churn.pred <- predict(churn.C50, churnTest,type="class") churn.conf <- table(churnTest$churn,churn.pred, dnn=c("Actual","Predicted")) churn.conf confusionP(churn.conf) # PLOT THE MODEL plot(churn.C50,main ="A C5.0 decision tree for customer churn with mincases=50.")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
