Calculating prediction accuracy of a tree using rpart's predict method (R programming)
问题 I have constructed a decision tree using rpart for a dataset. I have then divided the data into 2 parts - a training dataset and a test dataset. A tree has been constructed for the dataset using the training data. I want to calculate the accuracy of the predictions based on the model that was created. My code is shown below: library(rpart) #reading the data data = read.table("source") names(data) <- c("a", "b", "c", "d", "class") #generating test and train data - Data selected randomly with a