15.071 | Spring 2017 | Graduate

The Analytics Edge

4 Trees

4.4 Location, Location, Location: Regression Trees for Housing Data (Recitation)

Video 2: The Data

In this recitation, Iain will be using the dataset boston (CSV) to predict housing prices in Boston. Please download this dataset to follow along in this recitation. This data comes from the UCI Machine Learning Repository.

An R script file with all of the R commands used in this recitation can be downloaded here: Resource Unit4_Recitation (R).

Video 4: Regression Trees

In this video, Iain shows a different way to plot a CART tree by using the plot and text functions instead of the prp function. This is just another way to visualize the CART tree, and shows the tree in a slightly different way. Both are valid options for plotting your CART trees.

Video 7: Cross-Validation

Syntax Information: In this video, we use (0:10)*0.001 to define the cp values that we want to test in our model. Alternatively, we could replace this with the sequence function seq(0,0.01,0.001) which we learned in Unit 1. For some people, the sequence function is more intuitive, and you should use whichever syntax makes more sense to you personally.

Back: Video 6: The CP Parameter

Course Info

As Taught In
Spring 2017
Level
Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets with Solutions