Code | Explanation |
---|---|
dt_demo.m | An example using the decision tree code, using the example data from this lecture. |
build_tree.m | Code to grow a decision tree based on information gain. |
ent.m | Calculates the entropy of a list of values |
cond_ent.m | Calculates the conditional entropy of a list of values given another list of values. |
data.txt | The car data used in dt_demo.m. Note that the non-numeric entries “mpg” and “maker” have been converted to integer values. |
To use the code, download the code and data above into some directory, making sure that you’ve changed directories from within Matlab to that directory. To run the example code, run dt_demo.m, which should create and display a decision tree.
Play with both the data and the code until you understand it. You can find more data to work with here.