Understanding Decision Tree Algorithm with the help of Examples
Share This On
Aug 2, 2018 | 936 Views
Decision Tree Algorithm is a part of supervised Machine Learning Algorithm. This algorithm is used for solving regression and classification problems just like other algorithms. This algorithm is basically used to predict the value from the passed trained data by applying learning decision rules. This is the most powerful algorithm among all as this algorithm can be easily visualized and understandable by the humans.
A decision tree is a graphical representation of all the possible solutions to a decision based on certain conditions. It's called a decision tree because it starts with a single box (or root), which then branches off into a number of solutions, just like a tree.
Take an example of flowchart, where each level comprises of some questions with the answers whether Yes or No. This is called decision tree. All are using decision trees to minimize their tasks and decision trees in machine learning take that ability and multiply it to be able to artificially perform complex decision making tasks. Sometime it is very difficult to judge or understand that how machine learning algorithms come to its answers or decisions. When a human constructs a decision tree, the questions and answers are based off their logic and knowledge. In data science the creation of these rules is usually governed by an algorithm learning which questions to ask by analyzing the entire data set.
Understanding what exactly is decision tree with the help of example:
When you call a large company sometimes you end up talking to their "intelligent computerized assistant," who asks you to press 1 then 6, then 7, then entering your account number, 3, 2 and then you are redirected to a harried human being. You may think that you were caught in voicemail hell, but the company you called was just using a decision tree to get you to the right person.
Decision trees are helpful, not only because they are a visual representation that help you 'see' what you are thinking, but also because making a decision tree requires a systematic, documented thought process. Often, the biggest limitation of our decision making is that we can only select from the known alternatives. Decision tree help formalize the brainstorming process so we can identify more potential solutions. Think at the simplest level of answering a yes or no question. If the answer is yes, then there are a number of possibilities that will happen. If the answer is no, then there's a different possibility of steps that are going to occur after that. A decision tree moves through a bigger level helping you predict next steps and finding answers to complex problems.
Applied in real life, decision trees can be very complex and end up including pages of options. But, regardless of the complexity, decision trees are all based on the same principles. Here is a basic example of a decision tree. You are making your weekend plans and find out that your parents might come to town. You'd like to have plans in place, but there are a few unknown factors that will determine what you can, and can't, do, then decision tree is required.
A tree has many analogies in real life, and turns out that it has influenced a wide area of machine learning, covering both classification and regression. In decision analysis, a decision tree can be used to visually and explicitly represent decisions and decision making. As the name goes, it uses a tree-like model of decisions
Where it can be applied?
You can use this for fraud detection or to check whether the transaction is genuine or not. Suppose I am using a credit card here in India, now due to some reason I had to fly to Dubai, now if I am using the credit card over there, I will get a notification or alert regarding my transaction. They would ask me to confirm about the transaction. So this also a kind of predictive analysis, as the machine predicts that something fishy is in the transaction and generates a call for confirmation because it differs so much from my transaction history. You can even use it to classify different items like fruits on the basis of its taste, color, size or weight. A machine well trained using the classification algorithm can easily predict the class or the type of the fruit whenever a new data is given to it.
How does the machine learn?
Well there are several different ways to perform a same task. Like classifying whether the person is a male or female, it's a task and to predict it the machine has to learn first. But there are multiple ways of learning you can choose any one of them. Just for predictive analytics there are many different techniques, but the most common of them all is the decision tree which we will cover in depth in today's session. So as a part of classification algorithm we have Decision Tree, Random Forest, Naive Bayes, Logistic Regression, Linear Regression, Support Vector Machine and KNN.