{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW4_Sol

# HW4_Sol - maxcompete=0 maxsurrogate=0 usesurrogate=0...

This preview shows pages 1–9. Sign up to view the full content.

Homework 4 Solutions 1) Read Chapter 4 (all sections) and Chapter 5 (Section 5.7 only). 2) a) b)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
c) d) e)
3) b) c)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4) b)
c) d)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
e) 5) Here are the correct predictions: Age Number Start Prediction middle 5 10 present young 2 17 absent old 10 6 present young 2 17 absent old 4 15 absent middle 5 15 absent young 3 13 absent old 5 8 present young 7 9 absent middle 3 13 absent

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: maxcompete=0, maxsurrogate=0, usesurrogate=0, xval=0,maxdepth=dep)) train_error[dep]<- 1-sum(y==predict(fit,x,type="class"))/length(y) test_error[dep]<- 1- sum(y_test==predict(fit,x_test,type="class"))/length(y_test) } plot(seq(1,6),test_error,type="o",pch=19,ylim=c(0,.5), ylab="Error Rate", xlab="Tree Depth",main="Rajan Patel's Tree Error Plot") points(train_error,type="o",pch=19,lwd=4,col="blue") legend(4,.5,c("Test Error","Training Error"), col=c("black","blue"),pch=19,lwd=c(1,4)) The plot suggests a depth of 5 is optimal. 1 2 3 4 5 6 0.0 0.1 0.2 0.3 0.4 0.5 Rajan Patel's Tree Error Plot Tree Depth Error Rate Test Error Training Error 7) a) c)...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern