案例01|Decision Tree:Titanic 的 Sex、Age 與可執行規則
案例02|Entropy 與 Information Gain:為什麼先以 Sex 分割 Titanic
案例03|Titanic Full Decision Tree:Basic Growth Strategy 與 Decision Rules
案例04|Exercise 8.1:Decision Tree Confusion Matrix 與 Classification Metrics
案例05|Basic、Advanced、Custom Growth Strategy 與 Logistic Regression 比較
案例06|Exercise 8.2:Employee Attrition Decision Tree 與 Logistic Regression
案例07|Continuous Target Decision Tree:House Price 的 Binning 與 Rules
案例08|Exercise 8.3:Advertising Sales 的 Continuous Decision Tree
| 核心主題 | 主要觀點/方法 | 實務用途 | 重要條件/限制/延伸 |
|---|---|---|---|
| Classification and Regression Trees(CART) | 以條件 Splits 建立 Tree Rules,不形成單一 Regression Equation | 分類與 Continuous Outcome Prediction | 可取代 Logistic/Multiple Regression,但 Model Structure 不同 |
| Interpretability | Root、Branch、Node、Leaf 可轉為 IF–THEN–ELSE | 建立可溝通、可部署的 Business Rules | Tree 變深後 Rules 可能快速複雜化 |
| Information Entropy | 衡量 Node Purity;0 為 Pure、1 為 Even Split | 評估 Candidate Splits | 需依各 Class Probability 計算 |
| Information Gain | Parent Entropy − Weighted Child Entropy | 選擇最有資訊的 Split Variable | SAS VA Basic Autonomous Growth 使用 Information Gain |
| Titanic Sex Split | Target Entropy 0.9595;Sex Information Gain 0.206 | 示範 Split Search | Male 844、Female 467;總樣本 1,311 |
| Basic Growth Strategy | 最多 2 Branches per Split、6 Levels | 快速建立基礎 Tree | Stopping Criteria 可能使某些 Variables 不進入模型 |
| Advanced Growth Strategy | 最多 4 Branches per Split、6 Levels | 提高 Tree Flexibility | 原書案例降低 FN,但 FP 表現較差 |
| Custom Growth Strategy | 手動調整 Growth Parameters | 在 Basic/Advanced Fit 不佳時進一步調整 | 更複雜不代表必然更能 Generalize |
| Model Performance | Misclassification、Lift、ROC、KS、Confusion Matrix | 比較 Classification Models | 不能只依 Accuracy |
| Decision Tree vs Logistic Regression | Accuracy 80.63% vs 78.87%;F1 74.08% vs 71.53% | 比較同一 Titanic Predictors 的 Models | 原書認為整體 Performance 很接近;最終需看 Unseen Data |
| Continuous Target | 將 Continuous Outcome 分成 Bins,再依 Rules 切分 | House Price 等 Continuous Prediction | House Price Example 預設 10 Bins,可設 2–100 |
| House Price Node Rules | OverallQual 等 Variables 形成多條件 Paths | 產生 Range-based Prediction Rules | 比單一 Multiple Regression Equation 更複雜 |
| Exercise 8.2 | Employee Attrition Decision Tree | 與 Chapter 7 Logistic Regression 比較 | 原書未提供固定 Exercise Output |
| Exercise 8.3 | Advertising Sales Decision Tree | 與 Chapter 6 Multiple Regression 比較 | 原書未提供固定 Exercise Output |
原書指出 CART 可用於取代 Multiple Regression、Binary Logistic Regression、Multinomial Regression 與 Ordinal Regression。與 Parametric Regression 不同,Decision Tree 不預設 Inputs 與 Outcome 必須具有特定 Structural Association,而是從資料中形成一組 Prediction Rules。
Decision Tree 的 Decisions 直接顯示於 Branches 與 Nodes,因此即使沒有 Machine Learning/Predictive Analytics 背景,也較容易理解。原書特別把這種 Interpretability 視為對 Managers、Consumers 與其他 Stakeholders 的優勢。
原書先以 Sex,再加入 Age,形成 15 個 Nodes,並示範把 SAS VA Node Rules 轉成 IF–THEN–ELSE。這使 Prediction Model 可以直接轉成 Credit Approval 等營運 Decision Rules。
SAS VA 在 Autonomous Basic Growth 下使用 Information Gain。Titanic Target 有 810 Perished、501 Survived,Target Entropy 為 0.9595。Sex Split 中 Male 為 683 Perished/161 Survived,Female 為 127/340;原書算得 Male Entropy 0.703、Female Entropy 0.844,Sex Information Gain 0.206。Algorithm 會比較 Variables 的 Gain,選最高者 Split,再在下一層重複。