Tuning Parameter
set.seed(2023)
idTrain <- createDataPartition(y = sent$Rating.Class, p = 0.8, list = FALSE)
trainset <- sent[idTrain,]
testset <- sent[-idTrain,]
nrow(trainset); nrow(testset)
## [1] 23535
## [1] 5883
makeatree <- makeLearner("classif.rpart", predict.type = "response")
set_cv <- makeResampleDesc("CV", iters = 10L)
gs <- makeParamSet(
makeIntegerParam("minsplit", lower = 30, upper = 50),
makeIntegerParam("minbucket", lower = 20, upper = 25),
makeNumericParam("cp", lower = 0.0001, upper = 0.0002)
)
gscontrol <- makeTuneControlRandom(maxit = 35)
trainTask <- makeClassifTask(data = trainset,target = "Rating.Class", positive = "pos")
stune <- tuneParams(learner = makeatree, resampling = set_cv, task = trainTask, par.set = gs, control = gscontrol, measures = acc)
## [Tune] Started tuning learner classif.rpart for parameter set:
## Type len Def Constr Req Tunable Trafo
## minsplit integer - - 30 to 50 - TRUE -
## minbucket integer - - 20 to 25 - TRUE -
## cp numeric - - 0.0001 to 0.0002 - TRUE -
## With control class: TuneControlRandom
## Imputation value: -0
## [Tune-x] 1: minsplit=43; minbucket=25; cp=0.000183
## [Tune-y] 1: acc.test.mean=0.7521142; time: 0.6 min
## [Tune-x] 2: minsplit=36; minbucket=23; cp=0.000182
## [Tune-y] 2: acc.test.mean=0.7519442; time: 0.6 min
## [Tune-x] 3: minsplit=39; minbucket=24; cp=0.000134
## [Tune-y] 3: acc.test.mean=0.7518168; time: 0.6 min
## [Tune-x] 4: minsplit=37; minbucket=22; cp=0.000179
## [Tune-y] 4: acc.test.mean=0.7516042; time: 0.6 min
## [Tune-x] 5: minsplit=50; minbucket=21; cp=0.000149
## [Tune-y] 5: acc.test.mean=0.7510094; time: 0.6 min
## [Tune-x] 6: minsplit=36; minbucket=23; cp=0.000108
## [Tune-y] 6: acc.test.mean=0.7509245; time: 0.6 min
## [Tune-x] 7: minsplit=36; minbucket=22; cp=0.000177
## [Tune-y] 7: acc.test.mean=0.7516042; time: 0.6 min
## [Tune-x] 8: minsplit=42; minbucket=20; cp=0.000105
## [Tune-y] 8: acc.test.mean=0.7483325; time: 0.6 min
## [Tune-x] 9: minsplit=39; minbucket=21; cp=0.000155
## [Tune-y] 9: acc.test.mean=0.7498198; time: 0.6 min
## [Tune-x] 10: minsplit=49; minbucket=24; cp=0.000113
## [Tune-y] 10: acc.test.mean=0.7518168; time: 0.6 min
## [Tune-x] 11: minsplit=31; minbucket=25; cp=0.00017
## [Tune-y] 11: acc.test.mean=0.7521142; time: 0.6 min
## [Tune-x] 12: minsplit=46; minbucket=22; cp=0.000138
## [Tune-y] 12: acc.test.mean=0.7507120; time: 0.6 min
## [Tune-x] 13: minsplit=46; minbucket=22; cp=0.000184
## [Tune-y] 13: acc.test.mean=0.7511792; time: 0.6 min
## [Tune-x] 14: minsplit=44; minbucket=25; cp=0.00013
## [Tune-y] 14: acc.test.mean=0.7520293; time: 0.6 min
## [Tune-x] 15: minsplit=48; minbucket=21; cp=0.000151
## [Tune-y] 15: acc.test.mean=0.7507969; time: 0.6 min
## [Tune-x] 16: minsplit=45; minbucket=23; cp=0.000171
## [Tune-y] 16: acc.test.mean=0.7519442; time: 0.6 min
## [Tune-x] 17: minsplit=30; minbucket=23; cp=0.000157
## [Tune-y] 17: acc.test.mean=0.7517742; time: 0.6 min
## [Tune-x] 18: minsplit=39; minbucket=23; cp=0.000108
## [Tune-y] 18: acc.test.mean=0.7509245; time: 0.6 min
## [Tune-x] 19: minsplit=49; minbucket=20; cp=0.000107
## [Tune-y] 19: acc.test.mean=0.7489699; time: 0.6 min
## [Tune-x] 20: minsplit=35; minbucket=20; cp=0.000165
## [Tune-y] 20: acc.test.mean=0.7499048; time: 0.6 min
## [Tune-x] 21: minsplit=50; minbucket=25; cp=0.000193
## [Tune-y] 21: acc.test.mean=0.7522841; time: 0.5 min
## [Tune-x] 22: minsplit=49; minbucket=25; cp=0.000157
## [Tune-y] 22: acc.test.mean=0.7521142; time: 0.5 min
## [Tune-x] 23: minsplit=45; minbucket=20; cp=0.000166
## [Tune-y] 23: acc.test.mean=0.7501172; time: 0.6 min
## [Tune-x] 24: minsplit=30; minbucket=22; cp=0.000106
## [Tune-y] 24: acc.test.mean=0.7500320; time: 0.6 min
## [Tune-x] 25: minsplit=30; minbucket=25; cp=0.000172
## [Tune-y] 25: acc.test.mean=0.7521142; time: 0.5 min
## [Tune-x] 26: minsplit=47; minbucket=20; cp=0.000173
## [Tune-y] 26: acc.test.mean=0.7510094; time: 0.6 min
## [Tune-x] 27: minsplit=34; minbucket=25; cp=0.000158
## [Tune-y] 27: acc.test.mean=0.7521142; time: 0.5 min
## [Tune-x] 28: minsplit=45; minbucket=24; cp=0.000192
## [Tune-y] 28: acc.test.mean=0.7522841; time: 0.5 min
## [Tune-x] 29: minsplit=37; minbucket=24; cp=0.00016
## [Tune-y] 29: acc.test.mean=0.7519017; time: 0.5 min
## [Tune-x] 30: minsplit=45; minbucket=22; cp=0.000152
## [Tune-y] 30: acc.test.mean=0.7506695; time: 0.6 min
## [Tune-x] 31: minsplit=47; minbucket=21; cp=0.000129
## [Tune-y] 31: acc.test.mean=0.7499897; time: 0.6 min
## [Tune-x] 32: minsplit=41; minbucket=24; cp=0.000138
## [Tune-y] 32: acc.test.mean=0.7518168; time: 0.5 min
## [Tune-x] 33: minsplit=39; minbucket=20; cp=0.000154
## [Tune-y] 33: acc.test.mean=0.7494799; time: 0.6 min
## [Tune-x] 34: minsplit=37; minbucket=20; cp=0.000159
## [Tune-y] 34: acc.test.mean=0.7499048; time: 0.6 min
## [Tune-x] 35: minsplit=47; minbucket=25; cp=0.000121
## [Tune-y] 35: acc.test.mean=0.7520293; time: 0.5 min
## [Tune] Result: minsplit=50; minbucket=25; cp=0.000193 : acc.test.mean=0.7522841
stune
## Tune result:
## Op. pars: minsplit=50; minbucket=25; cp=0.000193
## acc.test.mean=0.7522841
clas_tree <- rpart(data = trainset, Rating.Class~., control = rpart.control(cp = 0.000193, minsplit = 50, minbucket = 25),
method = 'class')
rpart.plot(clas_tree, extra = 'auto', box.palette="RdBu", shadow.col="gray", nn=TRUE)

fancyRpartPlot(clas_tree, palettes="RdPu")

clas_pred <- predict(clas_tree, trainset)
clas_predict <- ifelse(clas_pred[,2] > 0.5, "pos", "neg")
clas_conf <- confusionMatrix(as.factor(clas_predict), as.factor(trainset$Rating.Class), positive = "pos", mode = 'everything')
clas_conf
## Confusion Matrix and Statistics
##
## Reference
## Prediction neg pos
## neg 18 13
## pos 5811 17693
##
## Accuracy : 0.7525
## 95% CI : (0.747, 0.758)
## No Information Rate : 0.7523
## P-Value [Acc > NIR] : 0.4734
##
## Kappa : 0.0035
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.999266
## Specificity : 0.003088
## Pos Pred Value : 0.752765
## Neg Pred Value : 0.580645
## Precision : 0.752765
## Recall : 0.999266
## F1 : 0.858675
## Prevalence : 0.752326
## Detection Rate : 0.751774
## Detection Prevalence : 0.998683
## Balanced Accuracy : 0.501177
##
## 'Positive' Class : pos
##
clas_pred <- predict(clas_tree, testset)
clas_predict <- ifelse(clas_pred[,2] > 0.5, "pos", "neg")
clas_conf <- confusionMatrix(as.factor(clas_predict), as.factor(testset$Rating.Class), positive = "pos", mode = 'everything')
clas_conf
## Confusion Matrix and Statistics
##
## Reference
## Prediction neg pos
## neg 2 6
## pos 1455 4420
##
## Accuracy : 0.7517
## 95% CI : (0.7404, 0.7627)
## No Information Rate : 0.7523
## P-Value [Acc > NIR] : 0.555
##
## Kappa : 0
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.998644
## Specificity : 0.001373
## Pos Pred Value : 0.752340
## Neg Pred Value : 0.250000
## Precision : 0.752340
## Recall : 0.998644
## F1 : 0.858169
## Prevalence : 0.752337
## Detection Rate : 0.751317
## Detection Prevalence : 0.998640
## Balanced Accuracy : 0.500009
##
## 'Positive' Class : pos
##
Tuning 2
clas_hyper <- expand.grid(
cp = seq(0.0001, 0.0002, 0.00002),
minsplit = seq(30, 50, 5),
minbucket = seq(30, 50, 5),
sensitivity = 0,
specificity = 0,
f1 = 0,
accuracy = 0)
nrow(clas_hyper)
## [1] 150
for(i in 1:nrow(clas_hyper)) {
set.seed(i*250)
id <- createDataPartition(y = trainset$Rating.Class, p = 0.8, list = FALSE)
tr <- trainset[id,]
ts <- trainset[-id,]
clas.tune <- rpart(data = tr, Rating.Class~.,
control = rpart.control(cp = clas_hyper$cp[i],
minsplit = clas_hyper$minsplit[i],
minbucket = clas_hyper$minbucket[i]),
method = 'class')
clas_pred <- predict(clas.tune, ts)
clas_predict <- ifelse(clas_pred[,2] > 0.5, "pos", "neg")
clas_conf <- confusionMatrix(as.factor(clas_predict), as.factor(ts$Rating.Class), positive = "pos", mode = 'everything')
clas_hyper$sensitivity[i] <- clas_conf$byClass["Sensitivity"]
clas_hyper$specificity[i] <- clas_conf$byClass["Specificity"]
clas_hyper$f1[i] <- clas_conf$byClass["F1"]
clas_hyper$accuracy[i] <- clas_conf$overall["Accuracy"]
print(i)
}
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 1
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 2
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 3
## [1] 4
## [1] 5
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 6
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 7
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 8
## [1] 9
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 10
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 11
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 12
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 13
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 14
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 15
## [1] 16
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 17
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 18
## [1] 19
## [1] 20
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 21
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 22
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 23
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 24
## [1] 25
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 26
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 27
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 28
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 29
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 30
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 31
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 32
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 33
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 34
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 35
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 36
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 37
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 38
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 39
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 40
## [1] 41
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 42
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 43
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 44
## [1] 45
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 46
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 47
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 48
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 49
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 50
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 51
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 52
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 53
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 54
## [1] 55
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 56
## [1] 57
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 58
## [1] 59
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 60
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 61
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 62
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 63
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 64
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 65
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 66
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 67
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 68
## [1] 69
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 70
## [1] 71
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 72
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 73
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 74
## [1] 75
## [1] 76
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 77
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 78
## [1] 79
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 80
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 81
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 82
## [1] 83
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 84
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 85
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 86
## [1] 87
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 88
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 89
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 90
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 91
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 92
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 93
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 94
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 95
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 96
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 97
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 98
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 99
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 100
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 101
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 102
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 103
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 104
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 105
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 106
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 107
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 108
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 109
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 110
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 111
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 112
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 113
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 114
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 115
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 116
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 117
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 118
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 119
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 120
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 121
## [1] 122
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 123
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 124
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 125
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 126
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 127
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 128
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 129
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 130
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 131
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 132
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 133
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 134
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 135
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 136
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 137
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 138
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 139
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 140
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 141
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 142
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 143
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 144
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 145
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 146
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 147
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 148
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 149
## Warning in confusionMatrix.default(as.factor(clas_predict),
## as.factor(ts$Rating.Class), : Levels are not in the same order for reference
## and data. Refactoring data to match.
## [1] 150
clas_hyper
## cp minsplit minbucket sensitivity specificity f1 accuracy
## 1 0.00010 30 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 2 0.00012 30 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 3 0.00014 30 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 4 0.00016 30 30 0.9937871 0.0051502146 0.8563086 0.7490438
## 5 0.00018 30 30 0.9966111 0.0034334764 0.8574900 0.7507437
## 6 0.00020 30 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 7 0.00010 35 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 8 0.00012 35 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 9 0.00014 35 30 0.9980232 0.0008583691 0.8578711 0.7511687
## 10 0.00016 35 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 11 0.00018 35 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 12 0.00020 35 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 13 0.00010 40 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 14 0.00012 40 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 15 0.00014 40 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 16 0.00016 40 30 0.9977408 0.0025751073 0.8579407 0.7513812
## 17 0.00018 40 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 18 0.00020 40 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 19 0.00010 45 30 0.9977408 0.0017167382 0.8578366 0.7511687
## 20 0.00012 45 30 0.9974583 0.0000000000 0.8574897 0.7505312
## 21 0.00014 45 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 22 0.00016 45 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 23 0.00018 45 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 24 0.00020 45 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 25 0.00010 50 30 0.9977408 0.0008583691 0.8577325 0.7509562
## 26 0.00012 50 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 27 0.00014 50 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 28 0.00016 50 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 29 0.00018 50 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 30 0.00020 50 30 1.0000000 0.0000000000 0.8587365 0.7524437
## 31 0.00010 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 32 0.00012 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 33 0.00014 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 34 0.00016 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 35 0.00018 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 36 0.00020 30 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 37 0.00010 35 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 38 0.00012 35 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 39 0.00014 35 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 40 0.00016 35 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 41 0.00018 35 35 0.9977408 0.0008583691 0.8577325 0.7509562
## 42 0.00020 35 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 43 0.00010 40 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 44 0.00012 40 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 45 0.00014 40 35 0.9974583 0.0008583691 0.8575938 0.7507437
## 46 0.00016 40 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 47 0.00018 40 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 48 0.00020 40 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 49 0.00010 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 50 0.00012 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 51 0.00014 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 52 0.00016 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 53 0.00018 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 54 0.00020 45 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 55 0.00010 50 35 0.9946343 0.0025751073 0.8564134 0.7490438
## 56 0.00012 50 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 57 0.00014 50 35 0.9974583 0.0017167382 0.8576979 0.7509562
## 58 0.00016 50 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 59 0.00018 50 35 0.9988704 0.0008583691 0.8582868 0.7518062
## 60 0.00020 50 35 1.0000000 0.0000000000 0.8587365 0.7524437
## 61 0.00010 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 62 0.00012 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 63 0.00014 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 64 0.00016 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 65 0.00018 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 66 0.00020 30 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 67 0.00010 35 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 68 0.00012 35 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 69 0.00014 35 40 0.9974583 0.0017167382 0.8576979 0.7509562
## 70 0.00016 35 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 71 0.00018 35 40 0.9983056 0.0017167382 0.8581138 0.7515937
## 72 0.00020 35 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 73 0.00010 40 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 74 0.00012 40 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 75 0.00014 40 40 0.9974583 0.0008583691 0.8575938 0.7507437
## 76 0.00016 40 40 0.9971759 0.0000000000 0.8573510 0.7503187
## 77 0.00018 40 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 78 0.00020 40 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 79 0.00010 45 40 0.9974583 0.0008583691 0.8575938 0.7507437
## 80 0.00012 45 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 81 0.00014 45 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 82 0.00016 45 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 83 0.00018 45 40 0.9977408 0.0008583691 0.8577325 0.7509562
## 84 0.00020 45 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 85 0.00010 50 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 86 0.00012 50 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 87 0.00014 50 40 0.9968935 0.0034334764 0.8576288 0.7509562
## 88 0.00016 50 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 89 0.00018 50 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 90 0.00020 50 40 1.0000000 0.0000000000 0.8587365 0.7524437
## 91 0.00010 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 92 0.00012 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 93 0.00014 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 94 0.00016 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 95 0.00018 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 96 0.00020 30 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 97 0.00010 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 98 0.00012 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 99 0.00014 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 100 0.00016 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 101 0.00018 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 102 0.00020 35 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 103 0.00010 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 104 0.00012 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 105 0.00014 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 106 0.00016 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 107 0.00018 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 108 0.00020 40 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 109 0.00010 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 110 0.00012 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 111 0.00014 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 112 0.00016 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 113 0.00018 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 114 0.00020 45 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 115 0.00010 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 116 0.00012 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 117 0.00014 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 118 0.00016 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 119 0.00018 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 120 0.00020 50 45 1.0000000 0.0000000000 0.8587365 0.7524437
## 121 0.00010 30 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 122 0.00012 30 50 0.9963287 0.0042918455 0.8574553 0.7507437
## 123 0.00014 30 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 124 0.00016 30 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 125 0.00018 30 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 126 0.00020 30 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 127 0.00010 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 128 0.00012 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 129 0.00014 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 130 0.00016 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 131 0.00018 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 132 0.00020 35 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 133 0.00010 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 134 0.00012 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 135 0.00014 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 136 0.00016 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 137 0.00018 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 138 0.00020 40 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 139 0.00010 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 140 0.00012 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 141 0.00014 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 142 0.00016 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 143 0.00018 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 144 0.00020 45 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 145 0.00010 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 146 0.00012 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 147 0.00014 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 148 0.00016 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 149 0.00018 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
## 150 0.00020 50 50 1.0000000 0.0000000000 0.8587365 0.7524437
library(dplyr)
clas_hyper %>%
arrange(desc(accuracy)) %>%
head(10)
## cp minsplit minbucket sensitivity specificity f1 accuracy
## 1 0.00010 30 30 1 0 0.8587365 0.7524437
## 2 0.00012 30 30 1 0 0.8587365 0.7524437
## 3 0.00014 30 30 1 0 0.8587365 0.7524437
## 4 0.00020 30 30 1 0 0.8587365 0.7524437
## 5 0.00010 35 30 1 0 0.8587365 0.7524437
## 6 0.00012 35 30 1 0 0.8587365 0.7524437
## 7 0.00016 35 30 1 0 0.8587365 0.7524437
## 8 0.00018 35 30 1 0 0.8587365 0.7524437
## 9 0.00020 35 30 1 0 0.8587365 0.7524437
## 10 0.00010 40 30 1 0 0.8587365 0.7524437
clas_tree <- rpart(data = trainset, Rating.Class~., control = rpart.control(cp = 0.0001, minsplit = 30, minbucket = 30),
method = 'class')
rpart.plot(clas_tree, extra = 'auto', box.palette="RdBu", shadow.col="gray", nn=TRUE)

lattice::barchart(sort(clas_tree$variable.importance[1:10]), col = myfillcolors)

data.frame(nama = c("Akmarina", "Fula", "Tari", "Sofy", "Mida"),
urutan = sample(seq(1, 5, 1)))
## nama urutan
## 1 Akmarina 4
## 2 Fula 1
## 3 Tari 3
## 4 Sofy 5
## 5 Mida 2