If you like what we're working on, please  star us on GitHub. This enables us to continue to give back to the community.

Decision Tree

In machine learning, classification is a two-step process that includes both learning and prediction. The model is built based on the training data in the learning process. The model is used to forecast the response for provided data in the prediction stage. The Decision Tree is one of the most straightforward and often used classification techniques.

  • The Decision Tree algorithm is part of the supervised learning algorithms family.

The decision tree approach may also be utilized to solve regression and classification issues.

By learning basic decision rules inferred from past data, the purpose of employing a Decision Tree is to develop a training model that can be used to predict the class or value of the target variable

When utilizing Decision Trees to forecast a record’s class label, we start at the root. The contents of the root and the record’s attribute are compared. We follow the branch that corresponds to that value and goes to the next node based on the comparison.

Types of Decision Tree

The type of decision trees we have is determined by the type of target variable we have. There are two sorts of it:

  • Categorical Variable Decision Tree: A Categorical Variable Decision Tree is a decision tree with a categorical target variable.
  • Continuous Variable Decision Tree: A Continuous Variable Decision Tree is one that has a continuous goal variable.

The examples are classified using decision trees by sorting them along the tree from the root to a leaf/terminal node, with the leaf/terminal node providing the classification.

Each node in the tree represents a test case for some property, with each edge descending from the node corresponding to the test case’s potential solutions. This is a cyclical procedure that occurs for each subtree rooted at the new node.

How does it work?

The decision to make strategic splits has a significant impact on a tree’s accuracy. The decision criteria for classification and regression trees are different.

To decide whether to break a node into multiple sub-nodes, decision trees utilize a variety of techniques. With each generation of sub-nodes, the uniformity of the created sub-nodes rises. When the target variable increases, the node’s purity improves. Based on all relevant parameters, the decision tree separates the nodes into sub-nodes, then picks the split that creates the most homogeneous sub-nodes.

The kind of target variables is also taken into account while choosing an algorithm.

Advantages of Decision Tree

  • Complex processes are efficiently communicated via decision trees – Decision trees graphically depict cause-and-effect links, offering a simplified understanding of a potentially complex process. Even if you’ve never constructed one before, decision trees are simple and easy to grasp.
  • Decision trees give a balanced perspective of the decision-making process by accounting for both risk and reward. Although consulting with others can be beneficial when making a major choice, leaning too much on the opinions of coworkers, friends, or family can be problematic. For instance, they might not have all of the facts. Instead of facts or likelihood, their advice to you may be impacted by their prejudices.
  • Rewards and risks are all clarified by decision trees, which have a predictive framework that allows you to map out many options and finally determine which course of action has the best chance of success. As a result, you can protect your selections against unwarranted risks or unfavorable effects.
  • Decision trees are adaptable – Because decision trees are non-linear, they allow you to explore, prepare, and forecast several alternative outcomes for your decisions, regardless of when they occur.


Your decision-making abilities can be greatly enhanced by using decision trees. The process of defining your key choice- root, various courses of action- branches, and prospective outcomes- leaves have as well as weighing the risks, benefits, and chances of success—will provide you a bird’s-eye view of the decision-making process.

Open source package for ml validation

Build Test Suites for ML Models & Data with Deepchecks

Get StartedOur GithubOur Github

Identifying and Preventing Key ML PitfallsDec 5th, 2022    06:00 PM PST

Register NowRegister Now