最终的决策树
ßWeather数据
Outlook | Temperature | Humidity | Windy | Play? |
sunny | hot | high | false | No |
sunny | hot | high | true | No |
overcast | hot | high | false | Yes |
rain | mild | high | false | Yes |
rain | cool | normal | false | Yes |
rain | cool | normal | true | No |
overcast | cool | normal | true | Yes |
sunny | mild | high | false | No |
sunny | cool | normal | false | Yes |
rain | mild | normal | false | Yes |
sunny | mild | normal | true | Yes |
overcast | mild | high | true | Yes |
overcast | hot | normal | false | Yes |
rain | mild | high | true | No |
决策树的剪枝
ß决策树过渡拟合往往是因为太过“茂盛”,也就是节点过多,所以需要“裁剪” (Prune Tree)决策树的枝叶。
ß裁剪枝叶的策略对决策树正确率的影响很大。主要有两种裁剪策略:前置裁剪,后置裁剪。