1. Interpretation of the decision tree
One of the main advantages of using Decision Tree algorithm, is that it is interpretable. We can visualize the tree to understand the path taking us to the final decision.
2. Visualization
The visualization consists of 3 steps. First, one needs to export the tree. It will be exported into a file called tree.dot which will reside in the working directory, together with turnover.csv dataset file that we are using.
Then you need to open the file and copy content.
Last step is going to the webgraphviz website, pasting the content and visualizing the tree.
3. Interpretation
After the three steps are implemented, you will see similar tree on the webgraphviz website. As you can see each node includes information on sample size, which is number of employees in that leaf who satisfied the proceeding decision rules. It also provides number of stayers and leavers in each node and the corresponding Gini index value. It is visible that once the tree is growing Gini is decreasing, which is the objective we wanted to achieve.
4. Let's practice!
Now let's try some examples.