Search code examples
rclassificationdata-miningpredictionc5.0

How to get the actual class and the prediction class for all data in R?


I create the model and do the predicition with this script in R,

model = C5.0(dataset1[1:100, -7], dataset1[1:100, 7])

if I run summary(model), the output is just confusion matrix and the decision tree. Then, how to know the all prediction result that includes all data that already processed with all attributes, actual class and the prediction class?

Thank you.


Solution

  • You can use pred = predict(model, dataset1[1:100, 7]) to get the predicted classes followed by cbind.data.frame(dataset1[1:100, 7], pred) to get actual class and the prediction class side by side. You can also use plot(model) to get a beautiful decision tree.

    The operations can be performed after installing and loading the library C50.