【正文】
l l e n t no3 0 …4 0 h i g h no f a i r ye s4 0 me d i u m no f a i r ye s4 0 l o w ye s f a i r ye s4 0 l o w ye s e x ce l l e n t no3 1 …4 0 l o w ye s e x ce l l e n t ye s=3 0 me d i u m no f a i r no=3 0 l o w ye s f a i r ye s4 0 me d i u m ye s f a i r ye s=3 0 me d i u m ye s e x ce l l e n t ye s3 1 …4 0 me d i u m no e x ce l l e n t ye s3 1 …4 0 h i g h ye s f a i r ye s4 0 me d i u m no e x ce l l e n t noID3算法 使用信息增益進行屬性選擇 ? Class P: buys_puter = “ yes” ? Class N: buys_puter = “ no” ? I(p, n) = I(9, 5) = ? Compute the entropy for age: Hence Similarly age p i n i I ( p i, n i)=3 0 2 3 0 .9 7 13 0 …4 0 4 0 04 0 3 2 0 .9 7 1)2,3(145)0,4(144)3,2(145)(????IIIageE)_()()(???ratingcreditGainstudentGainineGain)(),()( ageEnpIage ?? Decision Tree (結(jié)果輸出 ) age? overcast student? credit rating? no yes fair excellent =30 40 no no yes yes yes 30..40 基尼指數(shù) Gini Index (IBM IntelligentMiner) ? 集合 T包含 N個類別的記錄,那么其 Gini指標就是 pj 類別 j出現(xiàn)的頻率 ? 如果集合 T分成兩部分 N1 and N2 。那么這個分割的Gini就是 ? 提供最小 Ginisplit 就被選擇作為分割的標準 (對于每個屬性都要遍歷所有可以的分割方法 ). ???? njp jTgini121)()()()( 2211 TginiNNTginiNNTgini split ?? 預(yù)備知識二 (Pruning Tree) ? 目的: ? 消除決策樹的過適應(yīng) (OverFitting)問題 ? 實質(zhì):消除訓(xùn)練集中的異常和噪聲 ? 兩種方法: ? 先剪枝法 (Public 算法 ) ? 后剪枝法 (Sprint 算法 ) 兩種剪枝標準 ? 最小描述長度原則 (MDL) ? 思想:最簡單的解釋最期望的 ? 做法:對 DecisionTree 進行二進位編碼,編碼所需二進位最少的樹即為“最佳剪枝樹” ? 期望錯誤率最小原則 ? 思想:選擇期望錯誤率最小的子樹進行剪枝 ? 對樹中的 內(nèi)部節(jié)點 計算其剪枝 /不剪枝可能出現(xiàn)的期望錯誤率,比較后加以取舍 Cost of Encoding Data Records ? 對 n條記錄進行分類編碼的代價 (2種方法 ) ? n ——記錄數(shù), k ——類數(shù)目, ni——屬于類 i的記錄數(shù) !!1!log)11log(nknnkkn?????)2/(