Open In App

Decision Tree

Last Updated : 17 May, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

A decision tree is one of the most powerful tools of supervised learning algorithms used for both classification and regression tasks. It builds a flowchart-like tree structure where each internal node denotes a test on an attribute, each branch represents an outcome of the test, and each leaf node (terminal node) holds a class label. It is constructed by recursively splitting the training data into subsets based on the values of the attributes until a stopping criterion is met, such as the maximum depth of the tree or the minimum number of samples required to split a node.

During training, the Decision Tree algorithm selects the best attribute to split the data based on a metric such as entropy or Gini impurity, which measures the level of impurity or randomness in the subsets. The goal is to find the attribute that maximizes the information gain or the reduction in impurity after the split.

What is a Decision Tree?

A decision tree is a flowchart-like tree structure where each internal node denotes the feature, branches denote the rules and the leaf nodes denote the result of the algorithm. It is a versatile supervised machine-learning algorithm, which is used for both classification and regression problems. It is one of the very powerful algorithms. And it is also used in Random Forest to train on different subsets of training data, which makes random forest one of the most powerful algorithms in machine learning.

Decision Tree Terminologies

Some of the common Terminologies used in Decision Trees are as follows:

  • Root Node: It is the topmost node in the tree,  which represents the complete dataset. It is the starting point of the decision-making process.
  • Decision/Internal Node: A node that symbolizes a choice regarding an input feature. Branching off of internal nodes connects them to leaf nodes or other internal nodes.
  • Leaf/Terminal Node: A node without any child nodes that indicates a class label or a numerical value.
  • Splitting: The process of splitting a node into two or more sub-nodes using a split criterion and a selected feature.
  • Branch/Sub-Tree: A subsection of the decision tree starts at an internal node and ends at the leaf nodes.
  • Parent Node: The node that divides into one or more child nodes.
  • Child Node: The nodes that emerge when a parent node is split.
  • Impurity: A measurement of the target variable’s homogeneity in a subset of data. It refers to the degree of randomness or uncertainty in a set of examples. The Gini index and entropy are two commonly used impurity measurements in decision trees for classifications task 
  • Variance: Variance measures how much the predicted and the target variables vary in different samples of a dataset. It is used for regression problems in decision trees. Mean squared error, Mean Absolute Error, friedman_mse, or Half Poisson deviance are used to measure the variance for the regression tasks in the decision tree.
  • Information Gain: Information gain is a measure of the reduction in impurity achieved by splitting a dataset on a particular feature in a decision tree. The splitting criterion is determined by the feature that offers the greatest information gain, It is used to determine the most informative feature to split on at each node of the tree, with the goal of creating pure subsets
  • Pruning: The process of removing branches from the tree that do not provide any additional information or lead to overfitting.
Decision Tree -Geeksforgeeks

Decision Tree

Attribute Selection Measures:

Construction of Decision Tree: A tree can be “learned” by splitting the source set into subsets based on Attribute Selection Measures. Attribute selection measure (ASM) is a criterion used in decision tree algorithms to evaluate the usefulness of different attributes for splitting a dataset. The goal of ASM is to identify the attribute that will create the most homogeneous subsets of data after the split, thereby maximizing the information gain. This process is repeated on each derived subset in a recursive manner called recursive partitioning. The recursion is completed when the subset at a node all has the same value of the target variable, or when splitting no longer adds value to the predictions. The construction of a decision tree classifier does not require any domain knowledge or parameter setting and therefore is appropriate for exploratory knowledge discovery. Decision trees can handle high-dimensional data.

Advantages of the Decision Tree:

  •  It is simple to understand as it follows the same process which a human follow while making any decision in real-life.
  •  It can be very useful for solving decision-related problems.
  •  It helps to think about all the possible outcomes for a problem.
  •  There is less requirement of data cleaning compared to other algorithms.

Disadvantages of the Decision Tree:

  •  The decision tree contains lots of layers, which makes it complex.
  •  It may have an overfitting issue, which can be resolved using the Random Forest algorithm.
  •  For more class labels, the computational complexity of the decision tree may increase.

Introduction to Decision Tree:

Implementing Decision Trees:

Decision Tree Algorithms:

Decision Tree Concepts:

Decision Tree Applications:

Decision Tree Evaluation and Improvement:

Comparison with other algorithms:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads