Decision Tree
Decision Tree
By
Dr Ravi Prakash Verma
Professor
Department of CSAI
ABESIT
Decision Tree
1. Introduction to Decision Trees
• A Decision Tree is a supervised machine learning algorithm used for
both classification and regression tasks.
• It is structured like a tree, where:
• Each internal node represents a decision on an attribute.
• Each branch represents an outcome of the decision.
• Each leaf node represents a class label (for classification) or a numerical value
(for regression).
• Decision trees are easy to interpret and widely used in AI, finance,
medical diagnosis, and business analytics.
Decision Tree
2. Structure of a Decision Tree
• A decision tree consists of:
• Root Node: The starting point of the tree where the first split occurs.
• Internal Nodes: These nodes represent decisions based on a feature.
• Branches: These represent possible outcomes from an internal node.
• Leaf Nodes: The final classification/output.
• Example of a simple decision tree for a Loan Approval System:
Credit Score > 700?
/ \
Yes No
/ \
Approve? Income > 50K?
/ \ / \
Yes No Yes No
Decision Tree
3. Decision Tree Learning Process
• A decision tree is built using a recursive splitting approach, which
selects the best feature to split the data at each step.
Step 1: Selecting the Best Split (Feature Selection)
• The most important step in building a decision tree is selecting the best feature
to split the data.
• The goal is to choose the feature that maximizes information gain or reduces
impurity the most.
• There are three main criteria used:
1. Gini Impurity
2. Entropy (Information Gain)
3. Variance Reduction (for regression)
Decision Tree
Decision Tree
Decision Tree
Decision Tree
5. Decision Tree Construction Example
• Let’s construct a decision tree using Entropy & Information Gain.
• Dataset (Weather & Play Tennis Decision)