SlideShare a Scribd company logo
Machine
Learning - IV
Decision Trees
What is decision Tree?
Decision trees are a type of supervised machine learning model or in
simple words a branching method where the data is continuously split
according to a certain parameter.
Rupak Roy
Binary target variable
If the target variable for a decision tree is a binary we will use Binary
Decision tree
Target Variable:
1 for Sales, 0 for No-sales
30%
50%
70%
100%
Adv.= 1K
Sales =10K
Adv. =8,000,
Sales = 91,000
Adv. =6,000,
Sales = 65,000
Adv. =4,500,
Sales = 33,000
Adv. =1500,
Sales = 32000
Adv. =2000,
Sales = 26,000
Adv. =2,000
Sales = 9000
Adv.= 900
Sales = 6310
Rupak Roy
Continuous target variable
IF the target variable is numeric like Income (a continuous variable not
discrete like Yes or No) We will use Regression Tree for prediction.
What happens is the target variable is spitted each in the tree is chosen
to decrease the variance in the values of the target variable within
each child node.
In simple words,,
If Average Income is less than 70K
than categorize it and create a new tree
under 60k. Again if less then 60K than
create new tree under 50 and 10
Avg.
Income
$70k
60K
50 10
49
38
Yes No
Rupak Roy
Continuous target variable
Example: a company wants to impute missing values in the income
field for its customers. The average income of a person is 30K. The
company can assign the missing values using the rules created from
decision trees for an better estimate.
Terminology:
• Base node is also known as root node
• Any node which can be further splitted is called as decision node.
• The node that cannot be further splitted are called as terminal nodes
or leaf nodes.
• The process of cutting down the tree or removing sections of it is
called Pruning.
• The process of adding a whole section to a tree is called as grafting.
Rupak Roy
Data preparation for decision trees
Most decision trees can handle categorical & continuous variables so
there is no need of much data transformation.
Classification trees is used if the target variable is discrete.
Regression trees is used when the target variable is continuous.
Removing the records due to missing values is likely to create a bias
training set because the records with missing values are not likely to be
a random sample of the population. Removing the missing values has
the risk that important information associated will be lost.
And Replacing them with imputed values has the risk of diverting the
important properties/ information which will tend to create a bias
model .
Treating them as separate category is better than assigning them as
average values.
Decision trees
are a non-parametric technique.
What is non-parametric technique?
A parametric statistical test is one that makes assumptions about the parameters
(designing properties)of the population distributions(s) from which one’s data are
drawn, while a non-parametric is the one that makes no such assumptions.
For practical purpose, you can think of “parametric” as referring to tests, such as t-test
and the analysis of variance, that assume the underlying source populations(s) to be
normally distributed; they generally also assume that one’s measures derive from an
equal-interval scale. And you think of “non-parametric” as referring to tests that do
not make on these particular assumptions.
 Examples of non-parametric tests include the various forms of chi-square tests,
 the Fisher Exact Probability test,
 the Mann-Whitney Test,
 the Wilcoxon Signed-Rank Test,
 the Kruskal-Wallis Test and the Friedman Test.
 Non-parametric tests are sometimes spoken of as "distribution-free" tests.
Hence Decision Trees are not effected by outliers.
Rupak Roy
Steps for Decision tree
1. Find the split
- Identify all possible split options
- Choose the best split value for the tree
2. Grow the tree
- Continue growing tree as much as possible
3. Prune the tree
- Stop/Prune the tree using a size based criteria
4. Extract the rules
- Extract the rules generated from the tree.
Finding the right split
The one which creates most homogenous population is considered to be
the Best Split
Poor split Good split (homogenous)
There are various decision tree algorithms that helps to split the data in
smaller & smaller group in a way that each new nodes has greater purity
than its parent nodes with respect to the target variable.
Splits are evaluated based on the node purity in terms of the target variable.
These means the splitting criteria depends on the type of target variable
and not on the type of the input variable.
Rupak Roy
Finding the right split algorithm
1. For Categorical target variable we use
- Gini - Chi-square - Information Gain
2. For Continuous target variable
- Reduction in variance
3. Other methods:
- Information Gain is a improvement over the information gain
measure.
- -F test, t measures the variance in distributions between parent &
child nodes. It is used when the target variable is continuous.
Rupak Roy
Next
Let’s learn each of them in detail
Rupak Roy

More Related Content

PDF
Introduction to Random Forest
PDF
What makes a good decision tree?
PDF
Random Forest / Bootstrap Aggregation
PDF
Machine Learning Decision Tree Algorithms
PDF
Data Preparation with the help of Analytics Methodology
PPTX
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
PDF
Data Science - Part V - Decision Trees & Random Forests
PPTX
Decision Trees for Classification: A Machine Learning Algorithm
Introduction to Random Forest
What makes a good decision tree?
Random Forest / Bootstrap Aggregation
Machine Learning Decision Tree Algorithms
Data Preparation with the help of Analytics Methodology
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
Data Science - Part V - Decision Trees & Random Forests
Decision Trees for Classification: A Machine Learning Algorithm

What's hot (20)

PPTX
Decision tree
PDF
From decision trees to random forests
PPTX
Lect9 Decision tree
PPT
Decision tree and random forest
PPTX
Random forest
PDF
Accelerating the Random Forest algorithm for commodity parallel- Mark Seligman
PPT
CART Classification and Regression Trees Experienced User Guide
PDF
Understanding random forests
DOCX
Krupa rm
PPTX
Introduction to random forest and gradient boosting methods a lecture
PPTX
Classification
PPTX
AI Algorithms
PDF
Types of analytics & the structures of data
PPTX
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
PPT
Covering (Rules-based) Algorithm
PDF
Decision tree
PPTX
PPTX
Decision tree
PDF
Applied machine learning: Insurance
PPT
2.2 decision tree
Decision tree
From decision trees to random forests
Lect9 Decision tree
Decision tree and random forest
Random forest
Accelerating the Random Forest algorithm for commodity parallel- Mark Seligman
CART Classification and Regression Trees Experienced User Guide
Understanding random forests
Krupa rm
Introduction to random forest and gradient boosting methods a lecture
Classification
AI Algorithms
Types of analytics & the structures of data
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Covering (Rules-based) Algorithm
Decision tree
Decision tree
Applied machine learning: Insurance
2.2 decision tree
Ad

Similar to Machine Learning - Decision Trees (20)

PPTX
Machine learning session6(decision trees random forrest)
PPTX
Unit 2-ML.pptx
PPTX
20211229120253D6323_PERT 06_ Ensemble Learning.pptx
PDF
Machine Learning Unit-5 Decesion Trees & Random Forest.pdf
PDF
Decision tree
PPTX
Machine Learning with Python unit-2.pptx
PDF
Causal Random Forest
PPTX
Ai & Machine learning - 31140523010 - BDS302.pptx
PDF
Understanding Decision Trees in Machine Learning: A Comprehensive Guide
PPTX
Decision Tree.pptx
PDF
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
PPTX
Research trends in data warehousing and data mining
PPTX
Store segmentation progresso
PDF
Supervised learning (2)
PPTX
Intro to ml_2021
PPTX
Mini datathon - Bengaluru
PPTX
Decision tree presentation
PDF
Ijaems apr-2016-23 Study of Pruning Techniques to Predict Efficient Business ...
PPTX
Decision Tree Concepts and Problems Machine Learning
PPT
decisiontrees.ppt
Machine learning session6(decision trees random forrest)
Unit 2-ML.pptx
20211229120253D6323_PERT 06_ Ensemble Learning.pptx
Machine Learning Unit-5 Decesion Trees & Random Forest.pdf
Decision tree
Machine Learning with Python unit-2.pptx
Causal Random Forest
Ai & Machine learning - 31140523010 - BDS302.pptx
Understanding Decision Trees in Machine Learning: A Comprehensive Guide
Decision Tree.pptx
Lecture 9 - Decision Trees and Ensemble Methods, a lecture in subject module ...
Research trends in data warehousing and data mining
Store segmentation progresso
Supervised learning (2)
Intro to ml_2021
Mini datathon - Bengaluru
Decision tree presentation
Ijaems apr-2016-23 Study of Pruning Techniques to Predict Efficient Business ...
Decision Tree Concepts and Problems Machine Learning
decisiontrees.ppt
Ad

More from Rupak Roy (20)

PDF
Hierarchical Clustering - Text Mining/NLP
PDF
Clustering K means and Hierarchical - NLP
PDF
Network Analysis - NLP
PDF
Topic Modeling - NLP
PDF
Sentiment Analysis Practical Steps
PDF
NLP - Sentiment Analysis
PDF
Text Mining using Regular Expressions
PDF
Introduction to Text Mining
PDF
Apache Hbase Architecture
PDF
Introduction to Hbase
PDF
Apache Hive Table Partition and HQL
PDF
Installing Apache Hive, internal and external table, import-export
PDF
Introductive to Hive
PDF
Scoop Job, import and export to RDBMS
PDF
Apache Scoop - Import with Append mode and Last Modified mode
PDF
Introduction to scoop and its functions
PDF
Introduction to Flume
PDF
Apache Pig Relational Operators - II
PDF
Passing Parameters using File and Command Line
PDF
Apache PIG Relational Operations
Hierarchical Clustering - Text Mining/NLP
Clustering K means and Hierarchical - NLP
Network Analysis - NLP
Topic Modeling - NLP
Sentiment Analysis Practical Steps
NLP - Sentiment Analysis
Text Mining using Regular Expressions
Introduction to Text Mining
Apache Hbase Architecture
Introduction to Hbase
Apache Hive Table Partition and HQL
Installing Apache Hive, internal and external table, import-export
Introductive to Hive
Scoop Job, import and export to RDBMS
Apache Scoop - Import with Append mode and Last Modified mode
Introduction to scoop and its functions
Introduction to Flume
Apache Pig Relational Operators - II
Passing Parameters using File and Command Line
Apache PIG Relational Operations

Recently uploaded (20)

PDF
How to run a consulting project- client discovery
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
modul_python (1).pptx for professional and student
PPTX
Leprosy and NLEP programme community medicine
PPTX
Pilar Kemerdekaan dan Identi Bangsa.pptx
PPT
Predictive modeling basics in data cleaning process
PDF
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
PPTX
Managing Community Partner Relationships
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PDF
Introduction to Data Science and Data Analysis
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
SAP 2 completion done . PRESENTATION.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PDF
Microsoft Core Cloud Services powerpoint
PDF
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
How to run a consulting project- client discovery
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
modul_python (1).pptx for professional and student
Leprosy and NLEP programme community medicine
Pilar Kemerdekaan dan Identi Bangsa.pptx
Predictive modeling basics in data cleaning process
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
STERILIZATION AND DISINFECTION-1.ppthhhbx
Managing Community Partner Relationships
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Introduction to Data Science and Data Analysis
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
Qualitative Qantitative and Mixed Methods.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
SAP 2 completion done . PRESENTATION.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Microsoft Core Cloud Services powerpoint
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...

Machine Learning - Decision Trees

  • 2. What is decision Tree? Decision trees are a type of supervised machine learning model or in simple words a branching method where the data is continuously split according to a certain parameter. Rupak Roy
  • 3. Binary target variable If the target variable for a decision tree is a binary we will use Binary Decision tree Target Variable: 1 for Sales, 0 for No-sales 30% 50% 70% 100% Adv.= 1K Sales =10K Adv. =8,000, Sales = 91,000 Adv. =6,000, Sales = 65,000 Adv. =4,500, Sales = 33,000 Adv. =1500, Sales = 32000 Adv. =2000, Sales = 26,000 Adv. =2,000 Sales = 9000 Adv.= 900 Sales = 6310 Rupak Roy
  • 4. Continuous target variable IF the target variable is numeric like Income (a continuous variable not discrete like Yes or No) We will use Regression Tree for prediction. What happens is the target variable is spitted each in the tree is chosen to decrease the variance in the values of the target variable within each child node. In simple words,, If Average Income is less than 70K than categorize it and create a new tree under 60k. Again if less then 60K than create new tree under 50 and 10 Avg. Income $70k 60K 50 10 49 38 Yes No Rupak Roy
  • 5. Continuous target variable Example: a company wants to impute missing values in the income field for its customers. The average income of a person is 30K. The company can assign the missing values using the rules created from decision trees for an better estimate. Terminology: • Base node is also known as root node • Any node which can be further splitted is called as decision node. • The node that cannot be further splitted are called as terminal nodes or leaf nodes. • The process of cutting down the tree or removing sections of it is called Pruning. • The process of adding a whole section to a tree is called as grafting. Rupak Roy
  • 6. Data preparation for decision trees Most decision trees can handle categorical & continuous variables so there is no need of much data transformation. Classification trees is used if the target variable is discrete. Regression trees is used when the target variable is continuous. Removing the records due to missing values is likely to create a bias training set because the records with missing values are not likely to be a random sample of the population. Removing the missing values has the risk that important information associated will be lost. And Replacing them with imputed values has the risk of diverting the important properties/ information which will tend to create a bias model . Treating them as separate category is better than assigning them as average values.
  • 7. Decision trees are a non-parametric technique. What is non-parametric technique? A parametric statistical test is one that makes assumptions about the parameters (designing properties)of the population distributions(s) from which one’s data are drawn, while a non-parametric is the one that makes no such assumptions. For practical purpose, you can think of “parametric” as referring to tests, such as t-test and the analysis of variance, that assume the underlying source populations(s) to be normally distributed; they generally also assume that one’s measures derive from an equal-interval scale. And you think of “non-parametric” as referring to tests that do not make on these particular assumptions.  Examples of non-parametric tests include the various forms of chi-square tests,  the Fisher Exact Probability test,  the Mann-Whitney Test,  the Wilcoxon Signed-Rank Test,  the Kruskal-Wallis Test and the Friedman Test.  Non-parametric tests are sometimes spoken of as "distribution-free" tests. Hence Decision Trees are not effected by outliers. Rupak Roy
  • 8. Steps for Decision tree 1. Find the split - Identify all possible split options - Choose the best split value for the tree 2. Grow the tree - Continue growing tree as much as possible 3. Prune the tree - Stop/Prune the tree using a size based criteria 4. Extract the rules - Extract the rules generated from the tree.
  • 9. Finding the right split The one which creates most homogenous population is considered to be the Best Split Poor split Good split (homogenous) There are various decision tree algorithms that helps to split the data in smaller & smaller group in a way that each new nodes has greater purity than its parent nodes with respect to the target variable. Splits are evaluated based on the node purity in terms of the target variable. These means the splitting criteria depends on the type of target variable and not on the type of the input variable. Rupak Roy
  • 10. Finding the right split algorithm 1. For Categorical target variable we use - Gini - Chi-square - Information Gain 2. For Continuous target variable - Reduction in variance 3. Other methods: - Information Gain is a improvement over the information gain measure. - -F test, t measures the variance in distributions between parent & child nodes. It is used when the target variable is continuous. Rupak Roy
  • 11. Next Let’s learn each of them in detail Rupak Roy