# NOT RUN {
task = mlr_tasks$get("iris")
learner = mlr_learners$get("classif.rpart")
learner$predict_type = "prob"
learner$train(task)
p = learner$predict(task)
p$predict_types
head(as.data.table(p))
# confusion matrix
p$confusion
# change threshold
th = c(0.05, 0.9, 0.05)
names(th) = task$class_names
# new predictions
p$set_threshold(th)$response
p$score(measures = "classif.ce")
# }
Run the code above in your browser using DataLab