Decision Tree Classification

An introduction to Decision Tree Classifier

Afroz Chakure
Jul 6, 2019 · 4 min read

A Decision Tree is a simple representation for classifying examples. It is a Supervised Machine Learning where the data is continuously split according to a certain parameter.

Decision Tree consists of :

  1. Edges/ Branch : Correspond to the outcome of a test and connect to the next node or leaf.
  2. Leaf nodes : Terminal nodes that predict the outcome (represent class labels or class distribution).
Source: xoriant.com

To understand the concept of Decision Tree consider the above example. Let’s say you want to predict whether a person is fit or unfit, given their information like age, eating habits, physical activity, etc. The decision nodes are the questions like ‘What’s the age?’, ‘Does he exercise?’, ‘Does he eat a lot of pizzas’? And the leaves represent outcomes like either ‘fit’, or ‘unfit’.

There are two main types of Decision Trees:

  1. Regression Trees.

1. Classification trees (Yes/No types) :

Such a tree is built through a process known as binary recursive partitioning. This is an iterative process of splitting the data into partitions, and then splitting it up further on each of the branches.

Example of a Classification Tree

2. Regression trees (Continuous data types) :

Example of Regression Tree

Creation of Decision Tree :

The key idea is to use a decision tree to partition the data space into cluster (or dense) regions and empty (or sparse) regions.

In Decision Tree Classification a new example is classified by submitting it to a series of tests that determine the class label of the example. These tests are organized in a hierarchical structure called a decision tree. Decision Trees follow Divide-and-Conquer Algorithm.

Divide and Conquer

Decision trees are built using a heuristic called recursive partitioning. This approach is also commonly known as divide and conquer because it splits the data into subsets, which are then split repeatedly into even smaller subsets, and so on and so forth until the process stops when the algorithm determines the data within the subsets are sufficiently homogenous, or another stopping criterion has been met.

Basic Divide-and-Conquer Algorithm :

  1. Split instances into subsets. One for each branch extending from the node.
  2. Repeat recursively for each branch, using only instances that reach the branch.
  3. Stop recursion for a branch if all its instances have the same class.

Decision Tree Classifier

  • In an iterative process, we can then repeat this splitting procedure at each child node until the leaves are pure. This means that the samples at each leaf node all belong to the same class.
  • In practice, we may set a limit on the depth of the tree to prevent overfitting. We compromise on purity here somewhat as the final leaves may still have some impurity.
Classifying whether an insect is a Grasshopper or a Katydid based on Antenna Length and Abdomen Length.

Advantages of Classification with Decision Trees:

  1. Extremely fast at classifying unknown records.
  2. Easy to interpret for small-sized trees
  3. Accuracy comparable to other classification techniques for many simple data sets.
  4. Excludes unimportant features.

Disadvantages of Classification with Decision Trees:

  1. Decision Boundary restricted to being parallel to attribute axes.
  2. Decision tree models are often biased toward splits on features having a large number of levels.
  3. Small changes in the training data can result in large changes to decision logic.
  4. Large trees can be difficult to interpret and the decisions they make may seem counter intuitive.

Applications of Decision trees in real life :

  1. Financial analysis (Customer Satisfaction with a product or service).
  2. Astronomy (classify galaxies).
  3. System Control.
  4. Manufacturing and Production (Quality control, Semiconductor manufacturing, etc).
  5. Medicines (diagnosis, cardiology, psychiatry).
  6. Physics (Particle detection).

The Startup

Get smarter at building your thing. Join The Startup’s +741K followers.