Decision Tree Algorithm in Machine Learning

In this tutorial, we will learn about the decision tree algorithm in machine learning. By Basantjeet Das Last updated : April 16, 2023

What is Decision Tree Algorithm?

A decision tree is a tree-like structure or graph based on decisions and their possible consequences to a situation. In a decision tree, every node represents criteria or a parameter, and every branch directs to the outcome, and the leaf nodes depicting the final outcome (class labels).

What Decision trees do is, it solves the problems by framing a tree on the basis of decisions in a top-down manner from root to the leaf nodes, with each leaf node providing a classification to the problem. Each node corresponds to one of the possible answers to the test case or to another node forwarding to the solutions. For applying decision tree an algorithm should contain conditional statements only.

Decision trees are generally recursive in nature and are performed on every node of the sub-tree.

Example of Decision Tree Algorithm

Let's take an example for better understanding,

Suppose we want to play golf on Sunday, but we want to find if it is suitable to play golf on Sunday or not. Before stepping out we chose to check out the weather forecast first like if it's hot or cold, the speed of the wind, humidity, how the weather is, i.e. is it sunny, cloudy, or rainy.

Suppose the weather forecast says that it will be Sunny with no wind and normal humidity.

Undertaking the following factors into account we can predict if its suitable to play or not.

Let us assume we have data of the last 10 days for the above-discussed factors, shown below.

Decision Tree Algorithm in Machine Learning

Then on applying the Decision Trees algorithm, we can predict that we can play golf on Sunday with the help of the above-discussed factors.

Decision Tree Algorithm in Machine Learning

Similarly, Decision tree could be used to predict the outcomes of many situations which have data split under various parameters & conditions (both nested and unnested).

Advantages of Decision Tree Algorithm Over Others

The following are the advantages of decision tree algorithm over other algorithms:

  • It can be applied to both categorical & numerical data.
  • Doesn't need much of Data Pre-processing.
  • It can recover from outliers.
  • Gives the privilege to add more parameters for better precision and accuracy.
  • Can be used significantly large and complex datasets.




Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.