Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started