60 likes | 222 Views
Example. Calculation of Information Gain. # positive samples = 7 # negetive samples = 3 I( 7/10,3/10 ) = [ 7/10(log 2 10/7) + 3/10(log 2 10/7) ] = 0.88 Reminder ( Alternate ) = [0.7 * I(6/7,1/7)] + [0.3* I(0/3,3/3)] = 0.41
E N D
CalculationofInformationGain • # positive samples = 7 • # negetive samples = 3 • I( 7/10,3/10 ) = [ 7/10(log2 10/7) + 3/10(log2 10/7) ] = 0.88 Reminder ( Alternate ) = [0.7 * I(6/7,1/7)] + [0.3* I(0/3,3/3)] = 0.41 Reminder ( Type ) = [0.2 * I(0/2,2/2)]+ [0.1 * I(1/1,0/1)]+ [0.7 * I(5/7,2/7)] = 0.60 Reminder( Patrons ) = [0.2 * I(2/2,0/2)]+ [0.2 * I(0/2,2/2)]+ [0.6 * I(4/6,2/6)] = 0.55 IG( Alternate ) = 0.88 - 0.41 = 0.47 IG( Type ) = 0.88 – 0.60 = 0.28 IG( Patrons ) = 0.88 – 0.55 = 0.33
CalculationofInformationGain • # positive samples = 7 • # negetive samples = 3 • I( 7/10,3/10 ) = [ 7/10(log2 10/7) + 3/10(log2 10/7) ] = 0.88 Reminder ( Alternate ) = [0.7 * I(6/7,1/7)] + [0.3* I(0/3,3/3)] = 0.41 Reminder ( Type ) = [0.2 * I(0/2,2/2)]+ [0.1 * I(1/1,0/1)]+ [0.7 * I(5/7,2/7)] = 0.60 Reminder( Patrons ) = [0.2 * I(2/2,0/2)]+ [0.2 * I(0/2,2/2)]+ [0.6 * I(4/6,2/6)] = 0.55 IG( Alternate ) = 0.88 - 0.41 = 0.47 IG( Type ) = 0.88 – 0.60 = 0.28 IG( Patrons ) = 0.88 – 0.55 = 0.33 1
CalculationofInformationGain • # positive samples = 7 • # negetive samples = 3 • I( 7/10,3/10 ) = [ 7/10(log2 10/7) + 3/10(log2 10/7) ] = 0.88 Reminder ( Alternate ) = [0.7 * I(6/7,1/7)] + [0.3* I(0/3,3/3)] = 0.41 Reminder ( Type ) = [0.2 * I(0/2,2/2)]+ [0.1 * I(1/1,0/1)]+ [0.7 * I(5/7,2/7)] = 0.60 Reminder( Patrons ) = [0.2 * I(2/2,0/2)]+ [0.2 * I(0/2,2/2)]+ [0.6 * I(4/6,2/6)] = 0.55 IG( Alternate ) = 0.88 - 0.41 = 0.47 IG( Type ) = 0.88 – 0.60 = 0.28 IG( Patrons ) = 0.88 – 0.55 = 0.33 1 2
CalculationofInformationGain • # positive samples = 7 • # negetive samples = 3 • I( 7/10,3/10 ) = [ 7/10(log2 10/7) + 3/10(log2 10/7) ] = 0.88 Reminder ( Alternate ) = [0.7 * I(6/7,1/7)] + [0.3* I(0/3,3/3)] = 0.41 Reminder ( Type ) = [0.2 * I(0/2,2/2)]+ [0.1 * I(1/1,0/1)]+ [0.7 * I(5/7,2/7)] = 0.60 Reminder( Patrons ) = [0.2 * I(2/2,0/2)]+ [0.2 * I(0/2,2/2)]+ [0.6 * I(4/6,2/6)] = 0.55 IG( Alternate ) = 0.88 - 0.41 = 0.47 IG( Type ) = 0.88 – 0.60 = 0.28 IG( Patrons ) = 0.88 – 0.55 = 0.33 1 3 2
Trees Alternate ? Patrons? Tree Using IG Greedy Algorithm Optimal Algorithm No None Yes Full Some False Patrons? True False Type ? None Burger Thai Full Some False False True Type ? Alternate ? Burger Thai No Yes True False False True A.P.L = (1+1+2+3+3)/5 = 2 A.P.L = (1+2+2+3+3)/5 = 2.2 French