Question: In [ 5 3 ] : # Make predictions on the test data pred - predict ( pruned _ model, newdata = test.data 4 ,
In : # Make predictions on the test data
pred predictprunedmodel, newdatatest.data type'class'
# Construct the confusion matrix
conf.matrix tabletestdata$default, predcno 'yes'
rownamesconfmatrix pasteActual default rownamesconfmatrix sep :
colnamesconfmatrix pastPrediction default colnamesconfmatrix sep :
# Print nicely formatted confusion matrix
printConfusion Matrix"
format confmatrix, justify"centre", digit
Error in predict.rpartprunedmodel, newdata test.data type "class": Invalid prediction for "rpart" object
Traceback:
predictprunedmodel, newdata test.data type "class"
predict.rpartprunedmodel, newdata test.data type "class"
stopInvalid prediction for "rpart" object"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
