以 Figure 8.6、Table 8.3 重建 CART 的 Information Gain Split Logic。
能計算 Entropy、Weighted Entropy 與 Information Gain,並理解 Highest Information Gain 的 Predictor 為何優先 Split。
Titanic Target 有 1,311 位 Passenger:810 Perished、501 Survived。原書以 Sex 的 Contingency Table 示範 Split Search。
| 群組 | Perished | Survived | Total |
|---|---|---|---|
| 全體 | 810 | 501 | 1,311 |
| Male | 683 | 161 | 844 |
| Female | 127 | 340 | 467 |
Entropy = −Σ p×log₂(p)。先計算 Target Entropy,再計算 Male/Female Entropy,依群組比例加權後,以 Target Entropy 減去 Weighted Entropy 得 Information Gain。
原書:P(Perished)=0.618、P(Survived)=0.382;Target Entropy=0.9595。Male Entropy=0.703;Female Entropy=0.844;Male Proportion=0.644;Female Proportion=0.356;Sex Information Gain=0.206。
Entropy 越接近 0,Node 越 Pure;越接近 1,Classes 越平均。Algorithm 會比較候選 Predictors 的 Information Gain,選擇 Gain 最大者進行 Split,再在下一層重複。
依原書 810/501、683/161、127/340 的資料逐步驗算 Target Entropy、Male/Female Entropy 與 Sex Information Gain,並標示每一步公式。
若某 Predictor Split 後兩個 Child Nodes 的 Class 比例幾乎與 Parent 相同,Information Gain 會如何?
參考解答: Weighted Entropy 會接近 Parent Entropy,因此 Information Gain 很低,代表該 Split 幾乎沒有增加分類資訊。