A sample implement of ID3 algorithm, based on a bird flu samples, coded by C++ 11.
The samples consist of seven records.Each record contains its conclusion whether having bir flu and the state of each posibbly decisive feature.
All the records are shown by the following picture:
For easily access the records, I use integer to identify the state of each feature.Each integer has a different meaning, which can be found in the above picture.
The records are storaged in the file './source/samples.txt', which contains the following content:
headache courbature temperature hasBirdFlu
1 1 0 0
1 1 1 1
1 1 2 1
0 1 0 0
0 0 1 0
0 1 2 1
1 0 1 1
The following picture shows the process of program:
As you can see, some calculation process are displayed.And at the end, the program outputs a decision tree, which generated by ID3 algorithm.