�
Swayam Prabha
Course Title
Multivariate Data Mining- Methods and Applications
Lecture 35
Regression Trees
By
Anoop Chaturvedi
Department of Statistics, University of Allahabad
Prayagraj (India)
Slides can be downloaded from https://sites.google.com/view/anoopchaturvedi/swayam-prabha
Example: Carseats data set ⇒ Simulated data set containing sales of child car seats at 400 different stores. Data frame with 400 observations on the following 11 variables.
Found in the ISLR package of R.
Objective ⇒ Predicting Sales based on the other variables in the data set.
Sales is a continuous variable and recoded as a binary variable.
Binary Sales Variable High ⇒ Yes if the Sales exceed 8, and No otherwise.
High is a binary variable and this is a classification problem and requires the use of a classification tree.
Data Mining_Anoop Chaturvedi
2
11 Variables
Sales: Unit sales (in thousands)
CompPrice: Price charged by competitor
Income: Community income level (thousands of dollars)
Advertising: Local advertising budget (in thousands of dollars)
Population: Population size in region (in thousands)
Price: Price company charges for car seats at each site
ShelveLoc: Quality of the shelving location for car seats Bad, Good and Medium
Age: Average age of local population
Education: Education level at each location
Urban: Store in an urban or rural location (No or Yes)
US: Whether the store is in the US or not (Yes or No)
Data Mining_Anoop Chaturvedi
3
Data Mining_Anoop Chaturvedi
4
Data Mining_Anoop Chaturvedi
5
.
Data Mining_Anoop Chaturvedi
6
Total seven splits
.
Data Mining_Anoop Chaturvedi
7
69% correctly classified, 31% misclassified
Data Mining_Anoop Chaturvedi
8
.
Data Mining_Anoop Chaturvedi
9
.
Data Mining_Anoop Chaturvedi
10
Use the Pruned Tree to Predict the Test Data and Evaluate Tree Performance
60.5% correctly classified, 39.5% misclassified
Regression trees: Key aspects
Data Mining_Anoop Chaturvedi
11
Data Mining_Anoop Chaturvedi
12
Data Mining_Anoop Chaturvedi
13
Data Mining_Anoop Chaturvedi
14
Data Mining_Anoop Chaturvedi
15
Data Mining_Anoop Chaturvedi
16
Data Mining_Anoop Chaturvedi
17
Data Mining_Anoop Chaturvedi
18
Prediction ⇒ Involves drop-down new data to the root node traversing the tree to a leaf node based on the values of the input features.
The predicted value for a new data point is the constant value associated with the leaf node it ends up in.
Example: In Carseats data set, predict Sales based on the other variables. Because Sales is a continuous variable, this is a regression problem. Split data in training and test sets.
Regression tree contains 6 variables with 13 splits. Splits have occurred on the variables ShelveLoc, Price, Advertising, Income, Age, and CompPrice.
Data Mining_Anoop Chaturvedi
19
Data Mining_Anoop Chaturvedi
20
Data Mining_Anoop Chaturvedi
21
Data Mining_Anoop Chaturvedi
22
Data Mining_Anoop Chaturvedi
23
Data Mining_Anoop Chaturvedi
24
Data Mining_Anoop Chaturvedi
25
Data Mining_Anoop Chaturvedi
26
For unpruned regression tree
Data Mining_Anoop Chaturvedi
27