Question: In [ 2 4 ] : # Make predictions on the test data pred - predict ( pruned _ model 1 , newdata = test.data
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 pastePrediction default colnamesconfmatrix sep :
# Print nicely formatted confusion matrix
printConfusion Matrix"
format confmatrix, justify"centre", digit
Error in evalpredvars data, env: object 'economy' not found
Traceback:
predictprunedmodel newdata test.data type "class"
predict.rpartprunedmodel newdata test.data type "class"
model.frameTerms newdata, naaction naaction, xlev attrobject
"xlevels"
model.frame.defaultTerms newdata, naaction naaction, xlev attrobject
"xlevels"
evalpredvars data, env
evalpredvars data, env
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
