1
$\begingroup$

I have a question on Decision tree visualization.

I have used scikit-learn Decision Tree classifier for my analysis.

I have 2 classes to predict: 0 and 1 (it comes up as a numeric field when I load the dataset)

I have given the class_names as "NotPresent" and "Ispresent" which I believe it will map to 0 and 1. is that correct?

How do I interpret the nodes and value present in each nodes in the accompanying diagram? What do the value matrix represent or calculate? Decision Tree output with Feature and Class Names

$\endgroup$

1 Answer 1

1
$\begingroup$

I would recommend to read a few tutorials such as this one. At a general level, GINI metric that the algorithm computes to decide whether to split. The variable name and comparison (<,>, etc) and value in a node represent on what information you should travel on the left side of the node or right side. The class is the most frequently occurring class in your tree.

In regards to your encoding you should check your code.

To measure the quality of your model you can compute a confusion matrix that will tell you how many true positives you have and true negatives. Moreover, you can compute the receiver operator curve (ROC) and the Area under the curve (AUC), both metrics are implemented in sklearn.

$\endgroup$
1
  • $\begingroup$ Thank you. I had gone through the link mentioned in your post. Quite a good one. I think my assumption on the encoding is correct as you can see whenever the dominant class mentioned is "NotPresent", the first entry in value is higher. Regarding the metrics used, I am using F1 score to evaluate the quality of model and it is around 64% after fine tuning using GridSearchCV $\endgroup$
    – Sanant SK
    Commented Oct 25, 2016 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.