Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In [ 5 3 ] : # Make predictions on the test data pred - predict ( pruned _ model, newdata = test.data 4 ,

In [53]: # Make predictions on the test data
pred - predict(pruned_model, newdata=test.data4, type='class')
# Construct the confusion matrix
conf.matrix - table(test.data3$default, pred)[,c('no', 'yes')]
rownames(conf.matrix)- paste("Actual default ", rownames(conf.matrix), sep =": ")
colnames(conf.matrix)- past("Prediction default ", colnames(conf.matrix), sep =": ")
# Print nicely formatted confusion matrix
print("Confusion Matrix")
format (conf.matrix, justify="centre", digit=2)
Error in predict.rpart(pruned_model, newdata = test.data4, type = "class"): Invalid prediction for "rpart" object
Traceback:
predict(pruned_model, newdata = test.data4, type = "class")
predict.rpart(pruned_model, newdata = test.data4, type = "class")
stop("Invalid prediction for "rpart" object")
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions