Stats 202 - Lecture 7

80k no married no 80k yes 10 training data model

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: tart from the root of tree. Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married NO > 80K YES 8 Applying the Tree Model to Predict the Class for a New Observation Test Data Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married NO > 80K YES 9 Applying the Tree Model to Predict the Class for a New Observation Test Data Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married NO > 80K YES 10 Applying the Tree Model to Predict the Class for a New Observation Test Data Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married NO > 80K YES 11 Applying the Tree Model to Predict the Class for a New Observation Test Data Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married NO > 80K YES 12 Applying the Tree Model to Predict the Class for a New Observation Test Data Refund Marital Status No Refund Taxable Income Cheat 80K Married ? 10 Yes No NO MarSt Single, Divorced TaxInc < 80K NO Married Assign Cheat to “No” NO > 80K YES 13 Decision Trees in R The function rpart() in the library “rpart generates decision trees in R. Be careful: This function also does regression trees which are for a numeric response. Make sure the function rpart() knows your class labels are a factor and not a numeric response. (if y is a factor then method="class" is assumed) 14 In class exercise #24: Below is output from the rpart() function. Use this tree to predict the class of the following observations: a) (Age=middle Number=5 Start=10) b) (Age=young Number=2 Start=17) c) (Age=old Number=10 Start=6) 1) root 81 17 absent (0.79012346 0.20987654) 2) Start>=8.5 62 6 absent (0.90322581 0.09677419) 4) Age=old,young 48 2 absent (0.95833333 0.04166667) 8) Start>=13.5 25 0 absent (1.00000000 0.00000000)...
View Full Document

This note was uploaded on 02/03/2014 for the course STATS 202 taught by Professor Taylor during the Fall '09 term at Stanford.

Ask a homework question - tutors are online