# Improvement of ID3 Algorithm Based on Simplified Information Entropy and Coordination Degree
## 5 Examples and Analyses
### Example 1  
The data set depicted in Table 1 is obtained from common life, which is used to judge the family dogs' characteristics based on the three attributes (Body Shape, Hair Type, Colour). The samples in Table 1 are randomly divided into two subsets (training set and testing set). There are nine samples in the training set, which are acquired by the function command (\(a\) = randperm(12), Train = data(\(a\)(1:9). ;), Test = data(\(a\)(10:end),:) in Matlab. Two different decision tree models about family dogs' characteristics are built based on the training set that depicted in Table 2, and the two models are finally listed in Figure 7.  
From Figure 7a,b, the decision tree model built by the improved algorithm is more concise, which can also be displayed in classification rules. The decision tree model in Figure 7a that built by the ID3 algorithm produces 10 nodes and 6 rules: \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{4}{c}{**Training Set**} \\ \hline
**Number** & **Colour** & **Body Shape** & **Hair Type** & **Characteristic** \\ \hline
1 & black & big & poolle & danger \\
2 & brown & big & smooth & danger \\
4 & black & small & poolle & safe \\
5 & brown & medium & smooth & danger \\
7 & brown & small & poolle & danger \\
8 & brown & small & smooth & safe \\
9 & brown & big & poolle & danger \\
10 & black & medium & poolle & safe \\
12 & black & small & smooth & safe \\ \hline \multicolumn{4}{c}{**Testing Set**} \\ \hline
**Number** & **Colour** & **Body Shape** & **Hair Type** & **Characteristic** \\ \hline
3 & brown & medium & poolle & safe \\
6 & black & big & smooth & danger \\
11 & black & medium & smooth & safe \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Experimental dataset based on family dogs’ characteristic. Figure 7: Decision tree models using different algorithms based on family dogs’ characteristics: (**a**) the decision tree using ID3 algorithm; (**b**) the decision tree using the improved algorithm based on ID3 method. if Body shape = big, then class = danger;
2 if Body shape = medium and Hair type = poodle, then Characteristic = safe;
3 if Body shape = medium and Hair type = smooth, then Characteristic = danger;
4 if Body shape = small and Hair type = poodle, and Colour = black, then Characteristic = safe;
5 if Body shape = small and Hair type = poodle, and Colour = brown, then Characteristic = danger;
6 if Body shape = small and Hair type = smooth, then Characteristic = safe. The decision tree built by the improved ID3 algorithm produces six nodes and four rules, and all rules are listed as the following:  
1 if Colour = black, Body shape = big, then Characteristic = danger;
2 if Colour = black, Body shape = medium, then Characteristic = safe;
3 if Colour = black, Body shape = small, then Characteristic = safe;
4 if Colour = brown, then Characteristic = danger. The optimal attribute of the root node in Figure 7a is Body Shape that has three values, but the optimal attribute of the root node in Figure 7b is color that has two values, which solves the attribution bias problem. The accuracy of the testing  
From Figure 9a,b, the decision tree model built by the improved algorithm is more concise. The decision tree built by the ID3 algorithm produces 11 nodes and seven rules:  
1 if Outlook = overcast and Hum = high, then d = N;
2 if Outlook = overcast and Hum = normal, then d = Y;
3 if Outlook = sunny, then d = Y;
4 if Outlook = rain, Hum = normal, then Windy = not, then d = Y;