SeriesMachine Learning2 / 20

Decision Trees

Module 2 of CS 7641 - Machine Learning @ Georgia Tech. Lesson 1 of Supervised Learning Series.

Supervised Learning#

Definition#

Supervised Learning refers to function approximation - given a labeled set of tabular data consisting of features XX and labels yy, we are interested in mapping from input features to output labels.

f:Xyf : X \rightarrow y

There are two primary types of supervised learning:

Vocabulary#

From a theoretical standpoint, we should define some foundational terminology which will appear frequently over the supervised learning lectures:

Decision Trees for Classification#

General Approach#

A Decision Tree is a nonparametric supervised learning algorithm that uses sequential splitting to make predictions. Each decision node (circle) splits data depending on the value of some attribute. Leaf nodes are final destinations in the tree where predictions are generated.

decision-tree

Learning in the context of decision trees refers to selecting attributes and split values for decision nodes. The best split should minimize post-split node impurity - in the case of classification, this value may be approximated by the Gini Index or Entropy.

Gini Index:   IG=1jkpj2    k=n classes\text{Gini Index}: ~~~ I_G = 1 - \sum_j^k p_j^2 ~~~~ k = \text{n classes}

Entropy:   IH=jkpjlog2pj\text{Entropy}: ~~~ I_H = - \sum_j^k p_j \log_2 p_j

Put differently, the best split should maximize information gain - weighted reduction in expected entropy as a result of the split.

Information Gain:   G(S,A)=Entropy(S)vSvSEntropy(Sv)\text{Information Gain}: ~~~ G(S, A) = \text{Entropy}(S) - \sum_v \frac{|S_v|}{|S|} \text{Entropy}(S_v)

Decision tree algorithms typically proceed by greedily selecting the best possible split until reaching some terminal condition.

ID3 Algorithm#

ID3 is a specific algorithm for fitting decision trees that implements the above concepts.

Loop over iterations:
    Loop over leaves:
        1. Identify best attribute AA according to information gain.
        2. Assign AA as decision attribute for node and sort training instances to leaves.
        3. Check terminal condition (perfect classification).

As with any machine learning algorithm, ID3 has certain inductive biases which influence the search for the optimal concept.

Other Considerations#

Splitting is relatively straightforward in the case of a binary attribute. However, what if we have a continuous attribute? We can define splits as ranges (ex: age \geq 30), and iterate over all unique values for the attribute in the training set as candidate split values.

We defined the terminal condition for ID3 as perfect classification. What if we have noise in our data, preventing perfect classification and causing an infinite loop? We can refine our terminal condition to stop after reaching a maximum depth instead.

Finally, overfitting is an issue with any machine learning algorithm. We can introduce modifications into the ID3 algorithm to mitigate overfitting. For example, early stopping will terminate training after validation error fails to decrease over some number of rounds. Pruning is another approach which removes terminal decision nodes based on validation error after the decision tree has been fit.


(all images obtained from Georgia Tech ML course materials)

License

CC BY-NC-SA 4.0 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Related Posts