@ May 1993, Luis Torgo - LIACC
This is a rather naive implementation used only for teaching purposes.
?- [-id3].To learn some problem you first need a file describing both the attributes of the problem as well as the examples being learned (bellow you have a more detailed description of these files, but you can also have a look at the given example file named "golf").
The predicate used to learn a file of examples is run/1.
Ex :
?- run(golf_id3).This learns the examples contained in the file and outputs the resulting decision tree.
node(NodeId,AttributeName or "leaf",ListOfDescendents or ClassLabel)
where
ListOfDescendents is a list of triplets of the form (ValueOfAttribute,DescendentNodeId,ExsPartition)
Exs: node(1,color,[(red,2,[4,5,10,23]),(blue,3,[2])]) node(15,leaf,dog)
Each example is stored as a Prolog fact with the following format ex(ExID,ListOfAttributeValuePairs,ClassLabel).
Ex:
ex(1,[color=red,shape=circular],x).