Question: #Data set reading and directory setting setwd(C:/Datasets) dermatology

#Data set reading and directory setting setwd("C:/Datasets") dermatology<-read.csv("dermatology.csv", header=T, sep = ",", as.is=FALSE) #data structure and Summary preview summary (dermatology) str(dermatology) #Results in a Graph hist(dermatology$familyHistory) plot(dermatology$age) boxplot(dermatology$itching) #Exclusion of age due to missing values dermatology$age<-NULL #training and test data set set.seed(1234) ind <- sample(2, nrow(dermatology), replace = TRUE, prob = c(0.7, 0.3)) train.data <- dermatology [ind == 1, ] test.data <- dermatology [ind == 2, ] # model from node 2 results model<-ctree(itching~., train.data) model nodes(model, 2) #Model plotting plot(model) plot(model,type="simple") plot(model,type="extended") #Confusion matrix # Training the model and Classification accuracy and pattern comparison table(predict(model), train.data$itching) table(predict(model), train.data$itching, dnn=c("predicted", "actual")) prop.table(table(predict(model), train.data$itching)) sum(predict(model)== train.data$itching)/length(train.data$itching) #Data test and Model processing testPred <- predict(model, newdata = test.data, method="class") table (testPred, test.data$itching, dnn=c("predicted", "actual") ) sum(testPred== test.data$itching)/length(test.data$itching) #Maximum tree depth modelA<-ctree(itching~., train.data, control=ctree_control(maxdepth = 3)) modelA plot(modelA) modelB<-ctree(itching~., train.data, control=ctree_control(minsplit =400)) modelB plot(modelB) modelC<-ctree(itching~., train.data, control=ctree_control(minbucket =300 )) modelC plot(modelC)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!