Decision Tree: An Example. Decision tree building algorithms

The decision tree method is a great way to choose a strategy for sequential action in the face of risk. It is risk that is the key word here, since in case of danger it is very difficult to make a rational decision, and a well-thought-out plan helps to analyze the current situation.

The decision tree is like the present: it has a trunk, branches and leaves. The “trunk" is the basis of everything - this is the main question that needs to be answered. Branches are arrows with several answers. And the leaves are situations that the chosen answer will lead us to.

example decision tree

Simplest example

Any theory is perceived much easier if you give an example. The “Go for a walk? Decision tree is the simplest algorithm. In business, everything is based on such principles . By the way, the basis of all electronic programs is also the algorithm for constructing a tree.

So, the task is: to decide whether you can go for a walk. Our trunk - the first question - is a key factor: " Is it sunny on the street?" Our future path depends on him . If the answer is yes, we move in the direction of the word "Yes." We come to a new branch . If the air temperature is high, we get the final answer - "Do not go for a walk," otherwise we also get the result, but with the result "And go for a walk."

decision tree method

One could choose another way. The decision tree implies that all options for movement will be analyzed and the results predicted .

Why choose this method

The advantages of the decision tree allow you to determine why this method is the most flexible of all that relate to the question of choosing solutions.

  • This is a one-dimensional scheme, which clearly shows the cause- effect relationships. What will happen if ... And where will our choice lead.
  • The ability to simultaneously consider atypical situations and select several options for resolving them.
  • The absence of any laws of investigation.
  • Easy to use.
  • Several people can work on the model at once, which makes the task easier.
  • The decision tree is not limited in time.
  • Suitable for most business situations.

decision tree

Application area

You can give any example of a decision tree. It may be a question of whether to open new production facilities, introduce technologies, form a new assortment, etc. The scope of this method is incredibly wide.

But there are three large groups where the decision tree helps to gain time.

  • Description of the data. Suppose the task of management is to solve the problem of expanding the assortment. The scheme of this task will consist of specific figures of possible amounts of profit and profitability. It will be much easier to structure such information if it is stored in the form of a diagram, and not in an extensive table.
  • Classification. There is an opportunity to group the source data and make a selection for them.
  • Regression. The decision tree allows you to determine how the target strategy is formed under the influence of independent factors. For example, the choice of assortment formation strategy will be affected, in addition to the main factors of production, by secondary factors that indirectly relate to this . This may be a harvest of cocoa beans from the exporting country or a schedule of movement of transport vessels. It seems that the choice of strategy is not directly affected, but the failure of their work can interfere with the formation of the assortment at the confectionery factory.

the right decision

Algorithms

Today, there are several well-known algorithms that allow you to create a decision tree (we have already examined examples).

  • CART is an abbreviation of the words Classification and Regression Tree (classification and regression). According to its principles, each tree node can have only two branches .
  • C4.5 is a construction method in which each node can have an unlimited number of branches. In such a scheme, it is difficult to make forecasts, so it is used for classification.
  • QUEST ( Quick , Unbiased , Efficient Statistical Trees ). The most difficult of all models, but very reliable. P allows you to create multidimensional branching . This means that not just many branches, but examples of actions can be created in any node m .

decision tree problem solving examples

Data collection

The decision tree method will be effective if you approach the issue of data collection correctly. We give a characteristic sequence:

  • Determination of the project life cycle: how many stages will be and how long will each of them be.
  • Highlighting key events, during which a dilemma may arise to choose one or the other.
  • A description of each of the possible factors that will affect the onset of an event described in the previous step.
  • About the price of the probability of making these decisions.
  • Calculation of the cost of all stages of the life cycle (considered between key events).

Decision Tree Example

Consider a typical business situation. The company needs to choose a profitable investment investment Ip1, Ip2, Ip3 using the decision tree. Examples of solving problems are formed on the basis of the source data.

The first project requires an investment of 200 million rubles , and will bring a profit of 100 million rubles . For the second, 300 million rubles are needed . but will bring 200 million rubles . The third, most profitable, is 3 00 million rubles , but you need to invest 500. At the same time, there is a risk of losing everything. In the first option , the risk level is 10%, in the second - 5%, and in the third - 20%. Which of the projects will be the most profitable?

It is rather difficult to carry out mathematical calculations. Therefore, you need to build a graphic diagram. The correct decision will depend not only on how understandable the model will be, but also how the source data will be located.

Plotting
how to make a decision tree

So, we have three projects: Ip1, Ip2 and Ip3. Consider how to make a decision tree. We will move from the first key point, indicated by a large square. Here we will write the final result, but for now let the sector remain empty. From it we draw three branches with the names of the projects. Further, each option has its own level of mathematical expectations, indicated by a circle. While they are empty, they will need to write the result of the calculations. Each of them will have two more branches. Up - this is income and its level of expectation, down - costs and risks of losses.

Math calculations
tree building algorithms

It's time to start finding the right solution. To do this, we compose the formulas:

  • Ip1 = 100 × 0.9 - 200 × 0.1 = 70
  • Ip2 = 200 × 0.95 - 300 × 0.05 = 175
  • Ip3 = 300 × 0.8 - 500 × 0.2 = 140

The resulting data is written in circles. We select the largest number - 175. And write it in a square. This is the mathematical expectation of the project. And since the most advantageous offer is Ip2, this will be the answer to the problem.

Application area

It would seem that an unlimited number of examples of a business decision tree can be given . Indeed, most often this method is spoken about in the context of management. But actually the scope of the algorithm is much larger. Here are some interesting facts:

  • The decision tree is indispensable in banking. It is used to evaluate customers and make decisions for granting a loan.
  • Industry. A prime example is quality control. Since factories do not always have the opportunity to evaluate all manufactured goods in a practical way, they create a special algorithm with which rejects are cut off at several stages of verification.
  • The medicine. To use the decision tree in this area, you do not need a leaf and paper. Any doctor does this every day when making a diagnosis. The doctor asks the patient suggestive questions about which answers will lead to a single correct solution.
  • Molecular biology. Even in this unique area there is where to apply the method of constructing circuits. For example, analysis of the structure of amino acids.
  • Programming. Any program or web page is built on the principle of an algorithm and movement from whole to many.

An example of using the algorithm in the banking sector

Let's try to build a decision tree, imagining that we are employees of the lending department of any bank. Denote the key factors:

  • age;
  • income level;
  • dependents , marital status;
  • loans in other organizations;
  • the presence of movable and immovable property.

Now, for each of the key branches, it is necessary to draw up a rough plan of possible actions.

Let's start with age. More than 21? The answer is yes or no. No immediately leads us to zero. After the answer "Yes " we move to the next question.

The level of income above 50,000 rubles. per month? “No” - this is immediately zero , “Yes” - go to the next branch.

Marital status . Additional branches may appear in this section that will be important for our decision. How many people are in the family? How many of them are dependents , what is the income of the spouse. If the answers satisfy us, you can move on to the next sector.

Loans to other organizations. It is rational to single out: how much did you take, how quickly did you pay back, are there any debts?

The presence of movable and immovable property may become an additional guarantee of repayment of funds, therefore, if a potential borrower has reached this stage and answered positively to the last question, then the decision to issue money to him will definitely be positive.

You can shorten the path to any of the “Issue” or “Do Not Issue” solutions at any stage .

Medical example

Consider a typical situation. A patient with a cough came to see a doctor. When making a diagnosis, the doctor evaluates a person according to several parameters:

  • how long has a cough;
  • is there a temperature;
  • if the nose is stuffy;
  • how the lungs, bronchi, wheezing are heard;
  • heartbeat;
  • age, the presence of fluorography and other factors.

The answer to each of these questions will lead the doctor to make the correct diagnosis.

Conclusion

An example of a decision tree can be found in everyday life. People are faced with a dilemma hundreds of times , which can be solved by choosing only the shortest or most profitable path. That is exactly the same in business. The algorithm helps to choose the right solution, to classify and structure the data on the issue, to predict the outcome. An important task is the selection of the main issues that make up the key points, and the branches with the result. There are many models, computer programs that allow you to quickly and efficiently build a decision tree and facilitate the search.

Source: https://habr.com/ru/post/F8020/


All Articles