0% found this document useful (0 votes)
45 views10 pages

Decision Tree Classification Overview

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views10 pages

Decision Tree Classification Overview

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Decision Tree Classification Algorithm

o Decision Tree is a Supervised learning technique that can be used for both
classification and Regression problems, but mostly it is preferred for solving
Classification problems. It is a tree-structured classifier, where internal nodes
represent the features of a dataset, branches represent the decision
rules and each leaf node represents the outcome.
o In a Decision tree, there are two nodes, which are the Decision Node and Leaf
Node. Decision nodes are used to make any decision and have multiple branches,
whereas Leaf nodes are the output of those decisions and do not contain any further
branches.
o The decisions or the test are performed on the basis of features of the given dataset.
o It is a graphical representation for getting all the possible solutions to a
problem/decision based on given conditions.
o It is called a decision tree because, similar to a tree, it starts with the root node,
which expands on further branches and constructs a tree-like structure.
o In order to build a tree, we use the CART algorithm, which stands
for Classification and Regression Tree algorithm.
o A decision tree simply asks a question, and based on the answer (Yes/No), it further
split the tree into subtrees.
o Below diagram explains the general structure of a decision tree:

Note: A decision tree can contain categorical data (YES/NO) as well as numeric data.
Why use Decision Trees?
There are various algorithms in Machine learning, so choosing the best algorithm for the
given dataset and problem is the main point to remember while creating a machine
learning model. Below are the two reasons for using the Decision tree:

o Decision Trees usually mimic human thinking ability while making a decision, so it
is easy to understand.
o The logic behind the decision tree can be easily understood because it shows a tree-
like structure.

Decision Tree Terminologies


 Root Node: Root node is from where the decision tree starts. It represents the
entire dataset, which further gets divided into two or more homogeneous sets.
 Leaf Node: Leaf nodes are the final output node, and the tree cannot be segregated
further after getting a leaf node.
 Splitting: Splitting is the process of dividing the decision node/root node into sub-
nodes according to the given conditions.
 Branch/Sub Tree: A tree formed by splitting the tree.
 Pruning: Pruning is the process of removing the unwanted branches from the tree.
 Parent/Child node: The root node of the tree is called the parent node, and other
nodes are called the child nodes.

How does the Decision Tree algorithm Work?

In a decision tree, for predicting the class of the given dataset, the algorithm starts from the
root node of the tree. This algorithm compares the values of root attribute with the record
(real dataset) attribute and, based on the comparison, follows the branch and jumps to the
next node.

For the next node, the algorithm again compares the attribute value with the other sub-
nodes and move further. It continues the process until it reaches the leaf node of the tree.
The complete process can be better understood using the below algorithm:

o Step-1: Begin the tree with the root node, says S, which contains the complete
dataset.

o Step-2: Find the best attribute in the dataset using Attribute Selection Measure
(ASM).

o Step-3: Divide the S into subsets that contains possible values for the best
attributes.

o Step-4: Generate the decision tree node, which contains the best attribute.

o Step-5: Recursively make new decision trees using the subsets of the dataset
created in step -3. Continue this process until a stage is reached where you cannot
further classify the nodes and called the final node as a leaf node.
Example: Suppose there is a candidate who has a job offer and wants to decide whether he
should accept the offer or Not. So, to solve this problem, the decision tree starts with the
root node (Salary attribute by ASM). The root node splits further into the next decision
node (distance from the office) and one leaf node based on the corresponding labels. The
next decision node further gets split into one decision node (Cab facility) and one leaf node.
Finally, the decision node splits into two leaf nodes (Accepted offers and Declined offer).
Consider the below diagram:

Attribute Selection Measures


While implementing a Decision tree, the main issue arises that how to select the best
attribute for the root node and for sub-nodes. So, to solve such problems there is a
technique which is called as Attribute selection measure or ASM. By this measurement,
we can easily select the best attribute for the nodes of the tree. There are two popular
techniques for ASM, which are:

o Information Gain
o Gini Index

Common questions

Powered by AI

The CART algorithm, which stands for Classification and Regression Tree, assists in constructing Decision Trees by starting with the root node containing the complete dataset and using an Attribute Selection Measure (ASM) to find the best attribute . The stages include: starting from the root node, finding the best attribute, dividing data into subsets, generating decision tree nodes with the chosen attributes, and recursively creating new decision trees until reaching leaf nodes .

When using Decision Trees with both categorical and numeric data, the main challenge is managing feature selection and data splits that accommodate both data types effectively. For categorical data, the challenge is determining the optimal categories to split on, while for numeric data, it's about deciding the thresholds to use for intervals . Considerations must include ensuring that the tree can generalize well without overfitting or underfitting due to inappropriate splits . Additionally, attribute selection measures must be carefully applied to handle the diverse nature of data types .

Attribute Selection Measures, such as Information Gain and the Gini Index, play a critical role in building robust Decision Trees by determining the most useful attributes for node splitting . These measures evaluate the effectiveness of different attributes in classifying data accurately, impacting the tree's depth and accuracy by optimizing splits that lead to homogeneity within node subsets, thus enhancing the tree's prediction performance .

Pruning in Decision Trees involves removing branches that have little to no importance in predictive decision-making. The purpose of pruning is to reduce the complexity of the model, which helps prevent overfitting while maintaining or improving model accuracy . By removing these unnecessary branches, the predictive power is retained, and the overall model becomes simpler and more generalizable .

Decision Trees are often used because they mimic human decision-making processes, making them easy to understand and interpret . Additionally, the tree-like structure provides a clear representation of decision paths, which facilitates understanding the logic behind decisions .

Information Gain is a measure used in Decision Trees to determine which feature provides the highest reduction in uncertainty by calculating the difference in entropy before and after the split . In contrast, the Gini Index measures the impurity or variance of a dataset; the goal is to minimize the Gini Index to achieve the purest split . Both methods seek the optimal attribute for node construction but use different calculations to assess attribute contribution .

The Root Node in a Decision Tree is the initial point where the dataset begins to split, and it significantly influences the entire tree structure by setting the first and critical conditions for all subsequent decisions . It represents the feature that best divides the dataset, directing the initial path of decisions and impacting how other nodes will be formed . The choice of the root node affects the complexity and balance of the tree .

Decision Tree structures mimic human decision-making processes by systematically breaking down complex decision scenarios into simpler, sequential, and logical steps, similar to human thought processes which evaluate conditions and consequences . This characteristic implies that Decision Trees can be particularly effective in applications that require transparency and explainable AI, such as medical diagnosis or financial forecasting, where understanding the rationale behind predictions is as important as the predictions themselves .

Decision Nodes in a Decision Tree are where the dataset is split based on specific tests on features, whereas Leaf Nodes represent the final outcomes, and no further splitting occurs . Decision Nodes guide the pathway towards a decision using various branches, while Leaf Nodes provide the end result once the path is completed .

Decision Trees provide a graphical representation of solutions through a tree-like structure with nodes representing decisions and outcomes . This visual format aids in understanding model decisions by clearly showing the path from input features through decision nodes to output predictions, allowing for a straightforward interpretation of how different conditions lead to specific outcomes . This helps stakeholders, including those without technical expertise, to easily follow the logic and assumptions behind the model's predictions .

You might also like