DECISION TREE ALGORITHM

Decision tree Algorithm

Decision tree algorithm is a commonly used supervised learning algorithm, solves classification problems. Decision tree is the graphical representation of all the possible solutions to a decision. Decisions are based on some conditions.

Decision tree is a tree-like structure, that breaks down a dataset into smaller and smaller subsets. The final result is a tree with decision nodes and leaf nodes. The topmost decision node in a tree which corresponds to the best predictor called the root node.root node

The entire tree implements by answering “True/False” questions until it reaches the leaf node. Decision tree can handle both categorical and numerical data. They are extremely useful for data analytics and machine learning because they break down complex data into more manageable parts. They’re often used in these fields for prediction analysis, data classification, and regression.

Example of Decision tree Algorithm:

decision tree

In the above example the root node checks whether the person is hungry. If the person is not hungry, then it goes to eat after sometime, else checks whether it is lunch time. If it is lunch time the person gets the food, else he will get after some time. The final eat node is the decision node.

Another example of Decision tree:

decision-tree-machine-learning-stati-decision-making-tree

Implementation of Decision tree algorithm:

  1. Import the required libraries.
  2.  Initialize and print the dataset.
  3. Fit decision tree to the dataset.
  4. Predicting the result with new value. 
  5. Visualizing the result.

Advantages of Decision tree:

  • Decision trees have an advantage that it is easy to understand.
  • A decision tree does not require normalization of data.
  • Data cleaning is required less.

Disadvantages of Decision tree:

  • Decision tree often involves higher time to train the model.
  • Adding a new-data point can lead to regeneration of all the over-all tree and all nodes need to be recalculated and recreated.

Leave a Comment