I am trying to print the output of a decision tree in the below format: enter image description here
I have my decision tree stored as a nested dictionary. I am trying to use the nested looping for the dictionary but having no result.
Please let me know any ideas on how to achieve this??
The output must look something like this
|--- XO <= 0.50
| |--- XM <= 0.50
| | |--- XF <= 0.50
| | | |--- class: 0
| | |--- XF > 0.50
| | | |--- class: 0
| |--- XM > 0.50
| | |--- XB <= 0.50
| | | |--- XF <= 0.50
| | | | |--- XG <= 0.50
| | | | | |--- class: 0
| | | | |--- XG > 0.50
| | | | | |--- XD <= 0.50
| | | | | | |--- class: 1
| | | | | |--- XD > 0.50
| | | | | | |--- class: 0
| | | |--- XF > 0.50
| | | | |--- class: 1
| | |--- XB > 0.50
| | | |--- XI <= 0.50
| | | | |--- class: 0
| | | |--- XI > 0.5