Matlab implementation of the ID3 algorithm for classification: this implementation makes use of entropy and information gain to split the node of a tree. This repository contains different files:
main.m
: calls the functiondecision_tree_classifier()
, that receives the training set, the class labels and the number of columns to consider as numerical and the test set;decision_tree_classifier.m
: calls the functionbuild_tree()
in order to build a decision tree and then classifies the test set with the functionclassifier()
;build_tree.m
: builds the decision tree recursively by splitting each node with the feature that maximizes the information gain.classifier.m
: computes the classification with the tree previously built;H.m
: function that computes the entropy of a probability vector.
Insert the training set and the corresponding labels and indicate which columns should be considered as numerical in the file main.m
: it outputs the classification of the test set made by the tree built.