Measuring the prediction performance of a conditional inference tree
After building a conditional inference tree as a classification model, we can use the treeresponse
and predict
functions to predict categories of the testing dataset, testset
, and further validate the prediction power with a classification table and a confusion matrix.
Getting ready
You need to have the previous recipe completed by generating the conditional inference tree model, ctree.model
. In addition to this, you need to have both trainset
and testset
loaded in an R session.
How to do it...
Perform the following steps to measure the prediction performance of a conditional inference tree:
- You can use the
predict
function to predict the category of the testing dataset,testset
Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.