SlideShare a Scribd company logo
1 of 7
Prof. Neeraj Bhargava
Vishal Dutt
Department of Computer Science, School of
Engineering & System Sciences
MDS University, Ajmer
Cost-Complexity Pruning
 Definition: Cost-Complexity Criterion
Rα= MC + αL
 MC = misclassification rate
 Relative to # misclassifications in root node.
 L = # leaves (terminal nodes)
 You get a credit for lower MC.
 But you also get a penalty for more leaves.
 Let T0 be the biggest tree.
 Find sub-tree of Tα of T0 that minimizes Rα.
 Optimal trade-off of accuracy and complexity.
Weakest-Link Pruning
 Let’s sequentially collapse nodes that result in the
smallest change in purity.
 This gives us a nested sequence of trees that are all
sub-trees of T0.
T0 » T1 » T2 » T3 » … » Tk » …
 Theorem: the sub-tree Tα of T0 that minimizes Rα is in
this sequence!
 Gives us a simple strategy for finding best tree.
 Find the tree in the above sequence that minimizes CV
misclassification rate.
What is the Optimal Size?
 Note that α is a free parameter in:
Rα= MC + αL
 1:1 correspondence betw. α and size of tree.
 What value of α should we choose?
 α=0  maximum tree T0 is best.
 α=big  You never get past the root node.
 Truth lies in the middle.
 Use cross-validation to select optimal α (size)
Finding α
 Fit 10 trees on the “blue” data.
 Test them on the “red” data.
 Keep track of
miss classification rates for
different values of α.
 Now go back to the full
dataset and choose the α-
tree.
model P1 P2 P3 P4 P5 P6 P7 P8 P9 P10
1 train train train train train train train train train test
2 train train train train train train train train test train
3 train train train train train train train test train train
4 train train train train train train test train train train
5 train train train train train test train train train train
6 train train train train test train train train train train
7 train train train test train train train train train train
8 train train test train train train train train train train
9 train test train train train train train train train train
10 test train train train train train train train train train
How to Cross-Validate
 Grow the tree on all the data: T0.
 Now break the data into 10 equal-size pieces.
 10 times: grow a tree on 90% of the data.
 Drop the remaining 10% (test data) down the nested trees
corresponding to each value of α.
 For each α add up errors in all 10 of the test data sets.
 Keep track of the α corresponding to lowest test error.
 This corresponds to one of the nested trees Tk«T0.
Just Right
 Relative error: proportion of
CV-test cases misclassified.
 According to CV, the 15-node
tree is nearly optimal.
 In summary: grow the tree
all the way out.
 Then weakest-link prune
back to the 15 node tree.
cp
X-valRelativeError
0.20.40.60.81.0
Inf 0.059 0.035 0.0093 0.0055 0.0036
1 2 3 5 6 7 8 10 13 18 21
size of tree

More Related Content

Similar to 17 Simple CART

1 Computer Assignment 3 --- Hypothesis tests about m.docx
1 Computer Assignment 3     ---   Hypothesis tests about m.docx1 Computer Assignment 3     ---   Hypothesis tests about m.docx
1 Computer Assignment 3 --- Hypothesis tests about m.docx
mercysuttle
 
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docxDr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
madlynplamondon
 
Importance Sampling Report Report a (1)
Importance Sampling Report Report a (1)Importance Sampling Report Report a (1)
Importance Sampling Report Report a (1)
Kevin Danser
 
1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx
paynetawnya
 

Similar to 17 Simple CART (20)

1 Computer Assignment 3 --- Hypothesis tests about m.docx
1 Computer Assignment 3     ---   Hypothesis tests about m.docx1 Computer Assignment 3     ---   Hypothesis tests about m.docx
1 Computer Assignment 3 --- Hypothesis tests about m.docx
 
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docxDr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
Dr. Oner CelepcikayCS 4319CS 4319Machine LearningW.docx
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?
 
Project1
Project1Project1
Project1
 
Statistics.pdf
Statistics.pdfStatistics.pdf
Statistics.pdf
 
Importance Sampling Report Report a (1)
Importance Sampling Report Report a (1)Importance Sampling Report Report a (1)
Importance Sampling Report Report a (1)
 
Random Forest and KNN is fun
Random Forest and KNN is funRandom Forest and KNN is fun
Random Forest and KNN is fun
 
Common Mistakes with MTBF
Common Mistakes with MTBFCommon Mistakes with MTBF
Common Mistakes with MTBF
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework Help
 
1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx
 
Cross validation
Cross validationCross validation
Cross validation
 
Presentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informaticePresentation for blast algorithm bio-informatice
Presentation for blast algorithm bio-informatice
 
Blast Algorithm
Blast AlgorithmBlast Algorithm
Blast Algorithm
 
Metody logiczne w analizie danych
Metody logiczne w analizie danych Metody logiczne w analizie danych
Metody logiczne w analizie danych
 
Library design and series selection by Pareto ranking
Library design and series selection by Pareto rankingLibrary design and series selection by Pareto ranking
Library design and series selection by Pareto ranking
 
K fold validation
K fold validationK fold validation
K fold validation
 
Basic Inference Analysis
Basic Inference AnalysisBasic Inference Analysis
Basic Inference Analysis
 
Data Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptxData Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptx
 
Data communication & computer networking: Huffman algorithm
Data communication & computer networking:  Huffman algorithmData communication & computer networking:  Huffman algorithm
Data communication & computer networking: Huffman algorithm
 

More from Vishal Dutt

Python decision making_loops_control statements part9
Python decision making_loops_control statements part9Python decision making_loops_control statements part9
Python decision making_loops_control statements part9
Vishal Dutt
 
Python decision making_loops part7
Python decision making_loops part7Python decision making_loops part7
Python decision making_loops part7
Vishal Dutt
 
Python decision making_loops part6
Python decision making_loops part6Python decision making_loops part6
Python decision making_loops part6
Vishal Dutt
 

More from Vishal Dutt (20)

Grid computing components
Grid computing componentsGrid computing components
Grid computing components
 
Python files / directories part16
Python files / directories  part16Python files / directories  part16
Python files / directories part16
 
Python Classes and Objects part14
Python Classes and Objects  part14Python Classes and Objects  part14
Python Classes and Objects part14
 
Python Classes and Objects part13
Python Classes and Objects  part13Python Classes and Objects  part13
Python Classes and Objects part13
 
Python files / directories part15
Python files / directories  part15Python files / directories  part15
Python files / directories part15
 
Python functions part12
Python functions  part12Python functions  part12
Python functions part12
 
Python functions part11
Python functions  part11Python functions  part11
Python functions part11
 
Python functions part10
Python functions  part10Python functions  part10
Python functions part10
 
List view5
List view5List view5
List view5
 
Python decision making_loops_control statements part9
Python decision making_loops_control statements part9Python decision making_loops_control statements part9
Python decision making_loops_control statements part9
 
List view4
List view4List view4
List view4
 
List view3
List view3List view3
List view3
 
Python decision making_loops_control statements part8
Python decision making_loops_control statements part8Python decision making_loops_control statements part8
Python decision making_loops_control statements part8
 
Python decision making_loops part7
Python decision making_loops part7Python decision making_loops part7
Python decision making_loops part7
 
Python decision making_loops part6
Python decision making_loops part6Python decision making_loops part6
Python decision making_loops part6
 
List view2
List view2List view2
List view2
 
List view1
List view1List view1
List view1
 
Python decision making part5
Python decision making part5Python decision making part5
Python decision making part5
 
Python decision making part4
Python decision making part4Python decision making part4
Python decision making part4
 
Python operators part3
Python operators part3Python operators part3
Python operators part3
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

17 Simple CART

  • 1. Prof. Neeraj Bhargava Vishal Dutt Department of Computer Science, School of Engineering & System Sciences MDS University, Ajmer
  • 2. Cost-Complexity Pruning  Definition: Cost-Complexity Criterion Rα= MC + αL  MC = misclassification rate  Relative to # misclassifications in root node.  L = # leaves (terminal nodes)  You get a credit for lower MC.  But you also get a penalty for more leaves.  Let T0 be the biggest tree.  Find sub-tree of Tα of T0 that minimizes Rα.  Optimal trade-off of accuracy and complexity.
  • 3. Weakest-Link Pruning  Let’s sequentially collapse nodes that result in the smallest change in purity.  This gives us a nested sequence of trees that are all sub-trees of T0. T0 » T1 » T2 » T3 » … » Tk » …  Theorem: the sub-tree Tα of T0 that minimizes Rα is in this sequence!  Gives us a simple strategy for finding best tree.  Find the tree in the above sequence that minimizes CV misclassification rate.
  • 4. What is the Optimal Size?  Note that α is a free parameter in: Rα= MC + αL  1:1 correspondence betw. α and size of tree.  What value of α should we choose?  α=0  maximum tree T0 is best.  α=big  You never get past the root node.  Truth lies in the middle.  Use cross-validation to select optimal α (size)
  • 5. Finding α  Fit 10 trees on the “blue” data.  Test them on the “red” data.  Keep track of miss classification rates for different values of α.  Now go back to the full dataset and choose the α- tree. model P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 1 train train train train train train train train train test 2 train train train train train train train train test train 3 train train train train train train train test train train 4 train train train train train train test train train train 5 train train train train train test train train train train 6 train train train train test train train train train train 7 train train train test train train train train train train 8 train train test train train train train train train train 9 train test train train train train train train train train 10 test train train train train train train train train train
  • 6. How to Cross-Validate  Grow the tree on all the data: T0.  Now break the data into 10 equal-size pieces.  10 times: grow a tree on 90% of the data.  Drop the remaining 10% (test data) down the nested trees corresponding to each value of α.  For each α add up errors in all 10 of the test data sets.  Keep track of the α corresponding to lowest test error.  This corresponds to one of the nested trees Tk«T0.
  • 7. Just Right  Relative error: proportion of CV-test cases misclassified.  According to CV, the 15-node tree is nearly optimal.  In summary: grow the tree all the way out.  Then weakest-link prune back to the 15 node tree. cp X-valRelativeError 0.20.40.60.81.0 Inf 0.059 0.035 0.0093 0.0055 0.0036 1 2 3 5 6 7 8 10 13 18 21 size of tree

Editor's Notes

  1. 2
  2. 3
  3. 4
  4. 5
  5. 6
  6. 7