SlideShare a Scribd company logo
Random Forest
Training Data
Age Income Student Credit_Rating Buy_NoBuy
Youth High no fair no
Youth High no excellent no
Middle_Aged High no fair yes
Senior Medium no fair yes
Senior Low yes fair yes
Senior Low yes excellent no
Middle_Aged Low yes excellent yes
Youth Medium no fair no
Youth Low yes fair yes
Senior Medium yes fair yes
Youth Medium yes excellent yes
Middle_Aged Medium no excellent yes
Middle_Aged High yes fair yes
Senior Medium no excellent no
To predict if a person will buy a Computer or Not
Prediction using Decision Tree
We want to predict the Buy or NoBuy decision of a person, given
that we know his/her:
• Age
• Income
• Student or Not
• Credit_Rating
Prediction with Decision Tree
• Decision trees are powerful and popular tools for classification
and prediction.
• We first make a list of attributes that we can measure. In our
case those are Age, Income, Student or Not, & Credit_Rating.
• We then choose a target attribute that we want to predict, in
our case it is the “Buy_NoBuy” decision.
Algorithms
Commonly Used Algorithms
• ID3 (Iterative Dichotomiser 3): developed in early 1980s: good
for discrete attributes
• C4.5 (improved from ID3) : Handling both continuous and
discrete attributes
• CART (Classification and Regression Tree) : developed in 1984:
good for continuous and discrete attribute
ID3 Algorithm
• Information gain is used to select most useful attribute for
classification/splitting
• To calculate Information Gain, we need to know Entropy
2
1
2 2
( _ ) log
9 9 5 5
log log
14 14 14 14
0.94
c
i i
i
Entropy Buy NoBuy p p

 
  


Buy_NoBuy
no
no
yes
yes
yes
no
yes
no
yes
yes
yes
yes
yes
no
Yes 9
No 5
Total 14
ID3 Algorithm
.
( _ , ) ( ) ( )
( ) (2,3) ( ) (4,0)
( ) (3,2)
c Age
Entropy Buy NoBuy Age P c Entropy c
P Youth Entropy P Middle Entropy
P Senior Entropy


 


Weather Buy NoBuy Total
Youth 2 3 5
Middle_Aged 4 0 4
Senior 3 2 5
Total 14
Age Buy_NoBuy
Youth no
Youth no
Middle_Aged yes
Senior yes
Senior yes
Senior no
Middle_Aged yes
Youth no
Youth yes
Senior yes
Youth yes
Middle_Aged yes
Middle_Aged yes
Senior no
ID3 Algorithm
2 2 2 2
2 2
5 2 2 3 3 4 4 4 0 0
( _ , ) ( log log ) ( log log )
14 5 5 5 5 14 4 4 4 4
5 3 3 2 2
( log log )
14 5 5 5 5
0.694
Entropy Buy NoBuy Age      
  

( _ , )
( _ ) ( _ , )
0.94 0.694 0.246
InformationGain Buy NoBuy Age
Entropy Buy NoBuy Entropy Buy NoBuy Age


  
ID3 Algorithm
Similarly:
( _ , ) 0.246
( _ , ) 0.029
( _ , ) 0.151
( _ , _ ) 0.048
InformationGain Buy NoBuy Age
InformationGain Buy NoBuy Income
InformationGain Buy NoBuy Student
InformationGain Buy NoBuy Credit Rating




Highest Information
Gain
Attribute with highest information gain (here Age), will be selected as
splitting attribute.
Final Decision Tree Using ID3
Using this tree, we can predict that a young person who is also a
student will buy a computer
Random Forest
• First proposed by Tin Kam Ho of Bell Labs in 1995.
• Random forest is an ensemble/group classifier that consists of
a large number of decision trees.
• Each Decision Tree gives their predicted value, but the final
prediction is made by a majority vote.
Step 1
• Take a random sample of size N with replacement from the
data (bootstrap sample).
Selected Age Income Student Credit_Rating Buy_NoBuy
X Youth High no fair no
X Middle_Aged High no fair yes
X Senior Low yes excellent no
X Middle_Aged Low yes excellent yes
X Senior Medium yes fair yes
X Youth Medium yes excellent yes
.
.
Nth Senior Medium no excellent no
Step 2
• At each node, take a random sample of attributes of size m
(without replacement). M being total number of attributes,
such that m<M.
• Generally m=sqrt(M)
• Let’s say Age &
Credit_Rating are the
attributes selected
Selected X X Prediction
Age Income Student Credit_Rating Buy_NoBuy
X Youth High no fair no
X Middle_Aged High no fair yes
X Senior Low yes excellent no
X Middle_Aged Low yes excellent yes
X Senior Medium yes fair yes
X Youth Medium yes excellent yes
.
.
Nth Senior Medium no excellent no
Information Gain
• From Age
• From Credit_Rating
Step 3
• Construct a split by using the m attributes selected in Step 2,
• Let’s say “Age” is selected for the split, can
be done by Information Gain method.
Selected X X Prediction
Age Credit_Rating Buy_NoBuy
X Youth fair no
X Middle_Aged fair yes
X Senior excellent no
X Middle_Aged excellent yes
X Senior fair yes
X Youth excellent yes
.
.
X Senior excellent no
Age
Youth Senior
Middle
Step 4
• Repeat Steps 2 and 3 for each subsequent split until the tree is
complete.
• Say, for Age = Youth, let Income
& Credit_Rating are the
attributes selected at random.
Selected X X X Prediction
Age Income Credit_Rating Buy_NoBuy
X Youth High fair no
X
X
X
X
X Youth Medium excellent yes
.
.
Nth
Age
Youth Senior
Middle
Information Gain
• From Income
• From Credit_Rating
Step 4
• Out of Income & Credit_Rating, say Income is selected for the
split, as in step 3, using information Gain method.
Selected X X X Prediction
Age Income Credit_Rating Buy_NoBuy
X Youth High fair no
X
X
X
X
X Youth Medium excellent yes
.
.
Nth
Age
Income
Youth Senior
Middle
High Medium
Step 5
• Repeat steps 1 to 4 to create a large number of decision trees,
let’s say we create 4 trees.
• Make prediction using each decision tree.
• Make final prediction by a majority vote over the set of trees.
Prediction
• Predict using random forest if a young student with low
income and fair credit rating will buy a computer or not.
Tree # Predicted (Buy_NoBuy)
1 Buy
2 Buy
3 NoBuy
4 Buy
Final Prediction on the basis of
majority vote
Buy
Supply Chain Example

More Related Content

What's hot

Text extraction From Digital image
Text extraction From Digital imageText extraction From Digital image
Text extraction From Digital image
Kaushik Godhani
 
Next word Prediction
Next word PredictionNext word Prediction
Next word Prediction
KHUSHISOLANKI3
 
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Mahbubur Rahman
 
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
Simplilearn
 
Meta-Learning with Memory Augmented Neural Networks
Meta-Learning with Memory Augmented Neural NetworksMeta-Learning with Memory Augmented Neural Networks
Meta-Learning with Memory Augmented Neural Networks
홍배 김
 
Aspect Extraction Performance With Common Pattern of Dependency Relation in ...
Aspect Extraction Performance With Common Pattern of  Dependency Relation in ...Aspect Extraction Performance With Common Pattern of  Dependency Relation in ...
Aspect Extraction Performance With Common Pattern of Dependency Relation in ...
Nurfadhlina Mohd Sharef
 
Machine Learning Interview Questions and Answers | Machine Learning Interview...
Machine Learning Interview Questions and Answers | Machine Learning Interview...Machine Learning Interview Questions and Answers | Machine Learning Interview...
Machine Learning Interview Questions and Answers | Machine Learning Interview...
Edureka!
 
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite PreviewMachine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Modulabs
 
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Simplilearn
 
AI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax AlgorithmAI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax Algorithm
Kiran Shahi
 
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
JungHyun Hong
 
K Nearest Neighbors
K Nearest NeighborsK Nearest Neighbors
Emotion Detection in text
Emotion Detection in text Emotion Detection in text
Emotion Detection in text
kashif kashif
 
Predicting Emotions through Facial Expressions
Predicting Emotions through Facial Expressions  Predicting Emotions through Facial Expressions
Predicting Emotions through Facial Expressions
twinkle singh
 
DiscoGAN
DiscoGANDiscoGAN
DiscoGAN
Il Gu Yi
 
Random number generator
Random number generatorRandom number generator
Random number generator
Syed Atif Naseem
 
Automated parameter optimization should be included in future 
defect predict...
Automated parameter optimization should be included in future 
defect predict...Automated parameter optimization should be included in future 
defect predict...
Automated parameter optimization should be included in future 
defect predict...
Chakkrit (Kla) Tantithamthavorn
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
zekeLabs Technologies
 
Proximal Policy Optimization (Reinforcement Learning)
Proximal Policy Optimization (Reinforcement Learning)Proximal Policy Optimization (Reinforcement Learning)
Proximal Policy Optimization (Reinforcement Learning)
Thom Lane
 
2.4 rule based classification
2.4 rule based classification2.4 rule based classification
2.4 rule based classification
Krish_ver2
 

What's hot (20)

Text extraction From Digital image
Text extraction From Digital imageText extraction From Digital image
Text extraction From Digital image
 
Next word Prediction
Next word PredictionNext word Prediction
Next word Prediction
 
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
 
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
What is Machine Learning | Introduction to Machine Learning | Machine Learnin...
 
Meta-Learning with Memory Augmented Neural Networks
Meta-Learning with Memory Augmented Neural NetworksMeta-Learning with Memory Augmented Neural Networks
Meta-Learning with Memory Augmented Neural Networks
 
Aspect Extraction Performance With Common Pattern of Dependency Relation in ...
Aspect Extraction Performance With Common Pattern of  Dependency Relation in ...Aspect Extraction Performance With Common Pattern of  Dependency Relation in ...
Aspect Extraction Performance With Common Pattern of Dependency Relation in ...
 
Machine Learning Interview Questions and Answers | Machine Learning Interview...
Machine Learning Interview Questions and Answers | Machine Learning Interview...Machine Learning Interview Questions and Answers | Machine Learning Interview...
Machine Learning Interview Questions and Answers | Machine Learning Interview...
 
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite PreviewMachine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
 
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
 
AI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax AlgorithmAI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax Algorithm
 
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
[GomGuard] 뉴런부터 YOLO 까지 - 딥러닝 전반에 대한 이야기
 
K Nearest Neighbors
K Nearest NeighborsK Nearest Neighbors
K Nearest Neighbors
 
Emotion Detection in text
Emotion Detection in text Emotion Detection in text
Emotion Detection in text
 
Predicting Emotions through Facial Expressions
Predicting Emotions through Facial Expressions  Predicting Emotions through Facial Expressions
Predicting Emotions through Facial Expressions
 
DiscoGAN
DiscoGANDiscoGAN
DiscoGAN
 
Random number generator
Random number generatorRandom number generator
Random number generator
 
Automated parameter optimization should be included in future 
defect predict...
Automated parameter optimization should be included in future 
defect predict...Automated parameter optimization should be included in future 
defect predict...
Automated parameter optimization should be included in future 
defect predict...
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Proximal Policy Optimization (Reinforcement Learning)
Proximal Policy Optimization (Reinforcement Learning)Proximal Policy Optimization (Reinforcement Learning)
Proximal Policy Optimization (Reinforcement Learning)
 
2.4 rule based classification
2.4 rule based classification2.4 rule based classification
2.4 rule based classification
 

Similar to Decision Tree and Random forest

scrib.pptx
scrib.pptxscrib.pptx
scrib.pptx
BhavanaMU012
 
Machine learning
Machine learningMachine learning
Machine learning
Vatsal Gajera
 
Ranking scales
Ranking scalesRanking scales
Ranking scales
zeeshan3434
 
Family fun night.pptx
Family fun night.pptxFamily fun night.pptx
Family fun night.pptx
AniluMendiola
 
Loan Eligibility Checker
Loan Eligibility CheckerLoan Eligibility Checker
Loan Eligibility Checker
KiranVodela
 
Statistics assignment on statistical inference
Statistics assignment on statistical inferenceStatistics assignment on statistical inference
Statistics assignment on statistical inference
sadiakarim8
 
Research trends in data warehousing and data mining
Research trends in data warehousing and data miningResearch trends in data warehousing and data mining
Research trends in data warehousing and data mining
Er. Nawaraj Bhandari
 
Decision Trees
Decision TreesDecision Trees
Decision Trees
amitpraseed
 
Preparing your Training Leads to Run Gamification Programs
Preparing your Training Leads to Run Gamification ProgramsPreparing your Training Leads to Run Gamification Programs
Preparing your Training Leads to Run Gamification Programs
SeriousGamesAssoc
 
Chemistry Lab Manual 2012-13
Chemistry Lab Manual 2012-13Chemistry Lab Manual 2012-13
Chemistry Lab Manual 2012-13
Stephen Taylor
 
Ppt on decision theory
Ppt on decision theoryPpt on decision theory
Ppt on decision theory
Bhuwanesh Rajbhandari
 
Statistics
StatisticsStatistics
Adjusting Entries Practice...
Adjusting Entries Practice...Adjusting Entries Practice...
Adjusting Entries Practice...
National University of Modern Languages NUML
 
VSSML18. Evaluations
VSSML18. EvaluationsVSSML18. Evaluations
VSSML18. Evaluations
BigML, Inc
 
Why You're a Terrible PM: Cognitive Biases in Project Management notes
Why You're a Terrible PM: Cognitive Biases in Project Management notesWhy You're a Terrible PM: Cognitive Biases in Project Management notes
Why You're a Terrible PM: Cognitive Biases in Project Management notes
Carson Pierce
 
Unit-1.pdf
Unit-1.pdfUnit-1.pdf
Unit-1.pdf
SwarnaKumariChinni
 
MO NRCS Area Training - Generational Intelligence
MO NRCS Area Training - Generational IntelligenceMO NRCS Area Training - Generational Intelligence
MO NRCS Area Training - Generational Intelligence
Amy Hays
 
Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)
Laguna State Polytechnic University
 
Csis 5420 week 8 homework answers (13 jul 05)
Csis 5420 week 8 homework   answers (13 jul 05)Csis 5420 week 8 homework   answers (13 jul 05)
Csis 5420 week 8 homework answers (13 jul 05)
Thắng Tạ Bảo
 
Foundation principles Emerge Education
Foundation principles   Emerge EducationFoundation principles   Emerge Education
Foundation principles Emerge Education
Founder-Centric
 

Similar to Decision Tree and Random forest (20)

scrib.pptx
scrib.pptxscrib.pptx
scrib.pptx
 
Machine learning
Machine learningMachine learning
Machine learning
 
Ranking scales
Ranking scalesRanking scales
Ranking scales
 
Family fun night.pptx
Family fun night.pptxFamily fun night.pptx
Family fun night.pptx
 
Loan Eligibility Checker
Loan Eligibility CheckerLoan Eligibility Checker
Loan Eligibility Checker
 
Statistics assignment on statistical inference
Statistics assignment on statistical inferenceStatistics assignment on statistical inference
Statistics assignment on statistical inference
 
Research trends in data warehousing and data mining
Research trends in data warehousing and data miningResearch trends in data warehousing and data mining
Research trends in data warehousing and data mining
 
Decision Trees
Decision TreesDecision Trees
Decision Trees
 
Preparing your Training Leads to Run Gamification Programs
Preparing your Training Leads to Run Gamification ProgramsPreparing your Training Leads to Run Gamification Programs
Preparing your Training Leads to Run Gamification Programs
 
Chemistry Lab Manual 2012-13
Chemistry Lab Manual 2012-13Chemistry Lab Manual 2012-13
Chemistry Lab Manual 2012-13
 
Ppt on decision theory
Ppt on decision theoryPpt on decision theory
Ppt on decision theory
 
Statistics
StatisticsStatistics
Statistics
 
Adjusting Entries Practice...
Adjusting Entries Practice...Adjusting Entries Practice...
Adjusting Entries Practice...
 
VSSML18. Evaluations
VSSML18. EvaluationsVSSML18. Evaluations
VSSML18. Evaluations
 
Why You're a Terrible PM: Cognitive Biases in Project Management notes
Why You're a Terrible PM: Cognitive Biases in Project Management notesWhy You're a Terrible PM: Cognitive Biases in Project Management notes
Why You're a Terrible PM: Cognitive Biases in Project Management notes
 
Unit-1.pdf
Unit-1.pdfUnit-1.pdf
Unit-1.pdf
 
MO NRCS Area Training - Generational Intelligence
MO NRCS Area Training - Generational IntelligenceMO NRCS Area Training - Generational Intelligence
MO NRCS Area Training - Generational Intelligence
 
Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)
 
Csis 5420 week 8 homework answers (13 jul 05)
Csis 5420 week 8 homework   answers (13 jul 05)Csis 5420 week 8 homework   answers (13 jul 05)
Csis 5420 week 8 homework answers (13 jul 05)
 
Foundation principles Emerge Education
Foundation principles   Emerge EducationFoundation principles   Emerge Education
Foundation principles Emerge Education
 

Recently uploaded

一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
bopyb
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
ihavuls
 
UofT毕业证如何办理
UofT毕业证如何办理UofT毕业证如何办理
UofT毕业证如何办理
exukyp
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
mkkikqvo
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
bmucuha
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
ElizabethGarrettChri
 
Monthly Management report for the Month of May 2024
Monthly Management report for the Month of May 2024Monthly Management report for the Month of May 2024
Monthly Management report for the Month of May 2024
facilitymanager11
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
hyfjgavov
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
AndrzejJarynowski
 

Recently uploaded (20)

一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
UofT毕业证如何办理
UofT毕业证如何办理UofT毕业证如何办理
UofT毕业证如何办理
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
 
Monthly Management report for the Month of May 2024
Monthly Management report for the Month of May 2024Monthly Management report for the Month of May 2024
Monthly Management report for the Month of May 2024
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
 

Decision Tree and Random forest

  • 2. Training Data Age Income Student Credit_Rating Buy_NoBuy Youth High no fair no Youth High no excellent no Middle_Aged High no fair yes Senior Medium no fair yes Senior Low yes fair yes Senior Low yes excellent no Middle_Aged Low yes excellent yes Youth Medium no fair no Youth Low yes fair yes Senior Medium yes fair yes Youth Medium yes excellent yes Middle_Aged Medium no excellent yes Middle_Aged High yes fair yes Senior Medium no excellent no To predict if a person will buy a Computer or Not
  • 3. Prediction using Decision Tree We want to predict the Buy or NoBuy decision of a person, given that we know his/her: • Age • Income • Student or Not • Credit_Rating
  • 4. Prediction with Decision Tree • Decision trees are powerful and popular tools for classification and prediction. • We first make a list of attributes that we can measure. In our case those are Age, Income, Student or Not, & Credit_Rating. • We then choose a target attribute that we want to predict, in our case it is the “Buy_NoBuy” decision.
  • 5. Algorithms Commonly Used Algorithms • ID3 (Iterative Dichotomiser 3): developed in early 1980s: good for discrete attributes • C4.5 (improved from ID3) : Handling both continuous and discrete attributes • CART (Classification and Regression Tree) : developed in 1984: good for continuous and discrete attribute
  • 6. ID3 Algorithm • Information gain is used to select most useful attribute for classification/splitting • To calculate Information Gain, we need to know Entropy 2 1 2 2 ( _ ) log 9 9 5 5 log log 14 14 14 14 0.94 c i i i Entropy Buy NoBuy p p         Buy_NoBuy no no yes yes yes no yes no yes yes yes yes yes no Yes 9 No 5 Total 14
  • 7. ID3 Algorithm . ( _ , ) ( ) ( ) ( ) (2,3) ( ) (4,0) ( ) (3,2) c Age Entropy Buy NoBuy Age P c Entropy c P Youth Entropy P Middle Entropy P Senior Entropy       Weather Buy NoBuy Total Youth 2 3 5 Middle_Aged 4 0 4 Senior 3 2 5 Total 14 Age Buy_NoBuy Youth no Youth no Middle_Aged yes Senior yes Senior yes Senior no Middle_Aged yes Youth no Youth yes Senior yes Youth yes Middle_Aged yes Middle_Aged yes Senior no
  • 8. ID3 Algorithm 2 2 2 2 2 2 5 2 2 3 3 4 4 4 0 0 ( _ , ) ( log log ) ( log log ) 14 5 5 5 5 14 4 4 4 4 5 3 3 2 2 ( log log ) 14 5 5 5 5 0.694 Entropy Buy NoBuy Age           ( _ , ) ( _ ) ( _ , ) 0.94 0.694 0.246 InformationGain Buy NoBuy Age Entropy Buy NoBuy Entropy Buy NoBuy Age     
  • 9. ID3 Algorithm Similarly: ( _ , ) 0.246 ( _ , ) 0.029 ( _ , ) 0.151 ( _ , _ ) 0.048 InformationGain Buy NoBuy Age InformationGain Buy NoBuy Income InformationGain Buy NoBuy Student InformationGain Buy NoBuy Credit Rating     Highest Information Gain Attribute with highest information gain (here Age), will be selected as splitting attribute.
  • 10.
  • 11. Final Decision Tree Using ID3 Using this tree, we can predict that a young person who is also a student will buy a computer
  • 12. Random Forest • First proposed by Tin Kam Ho of Bell Labs in 1995. • Random forest is an ensemble/group classifier that consists of a large number of decision trees. • Each Decision Tree gives their predicted value, but the final prediction is made by a majority vote.
  • 13. Step 1 • Take a random sample of size N with replacement from the data (bootstrap sample). Selected Age Income Student Credit_Rating Buy_NoBuy X Youth High no fair no X Middle_Aged High no fair yes X Senior Low yes excellent no X Middle_Aged Low yes excellent yes X Senior Medium yes fair yes X Youth Medium yes excellent yes . . Nth Senior Medium no excellent no
  • 14. Step 2 • At each node, take a random sample of attributes of size m (without replacement). M being total number of attributes, such that m<M. • Generally m=sqrt(M) • Let’s say Age & Credit_Rating are the attributes selected Selected X X Prediction Age Income Student Credit_Rating Buy_NoBuy X Youth High no fair no X Middle_Aged High no fair yes X Senior Low yes excellent no X Middle_Aged Low yes excellent yes X Senior Medium yes fair yes X Youth Medium yes excellent yes . . Nth Senior Medium no excellent no
  • 15. Information Gain • From Age • From Credit_Rating
  • 16. Step 3 • Construct a split by using the m attributes selected in Step 2, • Let’s say “Age” is selected for the split, can be done by Information Gain method. Selected X X Prediction Age Credit_Rating Buy_NoBuy X Youth fair no X Middle_Aged fair yes X Senior excellent no X Middle_Aged excellent yes X Senior fair yes X Youth excellent yes . . X Senior excellent no Age Youth Senior Middle
  • 17. Step 4 • Repeat Steps 2 and 3 for each subsequent split until the tree is complete. • Say, for Age = Youth, let Income & Credit_Rating are the attributes selected at random. Selected X X X Prediction Age Income Credit_Rating Buy_NoBuy X Youth High fair no X X X X X Youth Medium excellent yes . . Nth Age Youth Senior Middle
  • 18. Information Gain • From Income • From Credit_Rating
  • 19. Step 4 • Out of Income & Credit_Rating, say Income is selected for the split, as in step 3, using information Gain method. Selected X X X Prediction Age Income Credit_Rating Buy_NoBuy X Youth High fair no X X X X X Youth Medium excellent yes . . Nth Age Income Youth Senior Middle High Medium
  • 20. Step 5 • Repeat steps 1 to 4 to create a large number of decision trees, let’s say we create 4 trees. • Make prediction using each decision tree. • Make final prediction by a majority vote over the set of trees.
  • 21. Prediction • Predict using random forest if a young student with low income and fair credit rating will buy a computer or not. Tree # Predicted (Buy_NoBuy) 1 Buy 2 Buy 3 NoBuy 4 Buy Final Prediction on the basis of majority vote Buy