7
Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan IF-UTAMA Ver/Rev:0/0 Halaman: 1 dari 7 Berdasarkan data-data berikut ini buat Decision tree-nya Solusi: Node Awal [1] Hitung Entropy awal Jumlah Instance Total = 7 Jumlah Instance Yes = 4 Jumlah Instance No = 3 ( ) ( ) 986 . 0 524 . 0 462 . 0 218 . 1 43 . 0 811 . 0 57 . 0 43 . 0 log 43 . 0 57 . 0 log 57 . 0 7 3 log 7 3 7 4 log 7 4 log log ) 2 2 2 2 2 2 = + = = = = = No No Yes Yes P P P P EntropyS [2] Hitung Entropy dan Infromation Gain per Atribut untuk menentukan node awal Atribut Age Yes 0 <=30 No 2 Yes 2 31..40 No 0 Yes 2 >40 No 1 ( ) 0 1 log 1 0 log 0 2 2 log 2 2 2 0 log 2 0 log log 30 2 2 2 2 2 2 = = = = <= No No Yes Yes P P P P Age Entropy ( ) 0 0 log 0 1 log 1 2 0 log 2 0 2 2 log 2 2 log log 40 .. 31 2 2 2 2 2 2 = = = = = No No Yes Yes P P P P Age Entropy

Contoh Studi Kasus Decision Tree

Embed Size (px)

Citation preview

Page 1: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 1 dari 7

Berdasarkan data-data berikut ini buat Decision tree-nya

Solusi:

Node Awal

[1] Hitung Entropy awal

Jumlah Instance Total = 7 Jumlah Instance Yes = 4 Jumlah Instance No = 3

( ) ( )

986.0524.0462.0

218.143.0811.057.043.0log43.057.0log57.0

73log

73

74log

74

loglog)

22

22

22

=+=

−−−−=−−=

−−=

−−= NoNoYesYes PPPPEntropyS

[2] Hitung Entropy dan Infromation Gain per Atribut untuk menentukan node awal Atribut Age

Yes 0 <=30 No 2

Yes 2 31..40 No 0

Yes 2 >40 No 1

( )

01log10log0

22log

22

20log

20

loglog30

22

22

22

=−−=

−−=

−−=<= NoNoYesYes PPPPAgeEntropy

( )

00log01log1

20log

20

22log

22

loglog40..31

22

22

22

=−−=

−−=

−−== NoNoYesYes PPPPAgeEntropy

Page 2: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 2 dari 7

( )

( ) ( )

915.0528.0387.0

6.133.0578.067.033.0log33.067.0log67.0

31log

31

32log

32

loglog40

22

22

22

=+=

−−−−=−−=

−−=

−−=> NoNoYesYes PPPPAgeEntropy

( ) ( ) ( )

( ) ( ) ( )

594.0392.0986.0

915.0730

720

72986.0

4040..3130986.0 4040..3130

}40,40..31,30{

=−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

>−=−<=−=

−=

><=

>>=∈∑

AgeEntropyS

SAgeEntropy

SS

AgeEntropyS

S

SEntropySS

SEntropyAgeGainInformatonv

vv

Atribut income Yes 1 High No 2

Yes 1 Medium No 0

Yes 2 Low No 1

( )

( ) ( )

915.0387.0528.0

578.067.06.133.067.0log67.033.0log33.0

32log

32

31log

31

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPHighIncomeEntropy

( )

00log01log1

10log

10

11log

11

loglog

22

22

22

=−−=

−−=

−−== NoNoYesYes PPPPMediumIncomeEntropy

( )

( ) ( )

915.0528.0387.0

6.133.0578.067.033.0log33.067.0log67.0

31log

31

32log

32

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPLowIncomeEntropy

Page 3: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 3 dari 7

( ) ( ) ( )

( ) ( ) ( )

202.0392.00392.0986.0

915.0730

71915.0

73986.0

986.0

},,{

=−−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

−−−=

−= ∑∈

LowEntropyS

SMediumEntropy

SS

HighEntropyS

S

SEntropySS

SEntropyIncomeGainInformaton

LowMediumHigh

LowMediumHighvv

v

Atribut student Yes 2 Yes No 1

Yes 2 No No 2

( )

( ) ( )

15.05.0

15.015.05.0log5.05.0log5.0

42log

42

42log

42

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPNoStudentEntropy

( )

( ) ( )

915.0528.0387.0

6.133.0578.067.033.0log33.067.0log67.0

31log

31

32log

32

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPYesStudentEntropy

( ) ( ) ( )

( ) ( )

023.0571.0392.0986.0

174915.0

73986.0

986.0

},{

=−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

=−=−=

−= ∑∈

NoStudentEntropyS

SYesStudentEntropy

SS

SEntropySS

SEntropyStudentGainInformaton

NoYes

NoYesvv

v

Atribut Leasing_rating Yes 1 Fair No 3

Yes 2 Excelent No 1

Page 4: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 4 dari 7

( )

( ) ( )

811.0311.05.0

415.075.0225.075.0log75.025.0log25.0

43log

43

41log

41

loglogFairtingLeasing_ra

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPEntropy

( )

( ) ( )

915.0528.0387.0

6.133.0578.067.033.0log33.067.0log67.0

31log

31

32log

32

loglogExcelenttingLeasing_ra

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPEntropy

( ) ( ) ( ){ }

( ) ( )

131.0392.0463.0986.0

915.073811.0

74986.0

ExcelenttingLeasing_raFairtingLeasing_ra986.0

tingLeasing_ra,

=−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

=−=−=

−= ∑∈

EntropyS

SEntropy

SS

SEntropySS

SEntropyGainInformaton

ExcelentFair

ExcelentFairvv

v

Atribut Information Gain Age 0.594 Income 0.202 Student 0.023 Leasing_Rate 0.131

Karena Atribut Age memiliki Nilai Information Gain tertinggi maka Atribut tersebut dijadikan node awal, sehingga decision tree-nya menjadi

[3] Hitung Entropy dan Infromation Gain per Atribut untuk menentukan node cabang dari edge >40

Page 5: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 5 dari 7

Jumlah Instance untuk Atribut Age > 40 = 3 Jumlah Instance Yes = 2 Jumlah Instance No = 1 Atribut income

Yes 0 High No 0

Yes 1 Medium No 0

Yes 1 Low No 1

( )

00log00log0

00log

00

00log

00

loglog

22

22

22

=−−=

−−=

−−== NoNoYesYes PPPPHighIncomeEntropy

( )

00log01log1

10log

10

11log

11

loglog

22

22

22

=−−=

−−=

−−== NoNoYesYes PPPPMediumIncomeEntropy

( )

( ) ( )

15.05.0

15.015.05.0log5.05.0log5.0

21log

21

21log

21

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPLowIncomeEntropy

( ) ( ) ( )

( ) ( ) ( )

319.0667.000986.0

1320

310

30986.0

986.0404040

},,{ 40

=−−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

−−−=

−=

>>>

∈ >∑

LowEntropySS

MediumEntropySS

HighEntropySS

SEntropyS

SSEntropyIncomeGainInformaton

Age

Low

Age

Medium

Age

High

LowMediumHighvv

Age

v

Atribut student Yes 1 Yes No 1

Yes 1 No No 0

Page 6: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 6 dari 7

( )

( ) ( )

15.05.0

15.015.05.0log5.05.0log5.0

21log

21

21log

21

loglog

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPNoStudentEntropy

( )

( )0

0010log01log1

10log

10

11log

11

loglog

22

22

22

=−−=

−−=

−−=

−−== NoNoYesYes PPPPYesStudentEntropy

( ) ( ) ( )

( ) ( )

319.00667.0986.0

0311

32986.0

986.04040

},{ 40

=−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

=−=−=

−=

>>

∈ >∑

NoStudentEntropyS

SYesStudentEntropy

SS

SEntropyS

SSEntropyStudentGainInformaton

Age

No

Age

Yes

NoYesvv

Age

v

Atribut Leasing_rating Yes 2 Fair No 0

Yes 0 Excelent No 1

( )

( ) ( )

915.0528.0387.0

6.133.0578.067.033.0log33.067.0log67.0

31log

31

32log

32

loglogFtingLeasing_ra

22

22

22

=+=

−−−−=−−=

−−=

−−== NoNoYesYes PPPPairEntropy

( )

( )0

0101log10log0

11log

11

10log

10

loglogExcelenttingLeasing_ra

22

22

22

=−=

−−=

−−=

−−== NoNoYesYes PPPPEntropy

Page 7: Contoh Studi Kasus Decision Tree

Solusi Quiz Senin,10 Mei 2010 Sistem Pendukung Keputusan

IF-UTAMA Ver/Rev:0/0 Halaman: 7 dari 7

( ) ( ) ( ){ }

( ) ( )

376.0061.0986.0

031915.0

32986.0

ExcelenttingLeasing_raFairtingLeasing_ra986.0

tingLeasing_ra

4040

, 40

=−−=

⎟⎠⎞

⎜⎝⎛ ×−⎟

⎠⎞

⎜⎝⎛ ×−=

=−=−=

−=

>>

∈ >∑

EntropySS

EntropySS

SEntropyS

SSEntropyGainInformaton

Age

Excelent

Age

Fair

ExcelentFairvv

Age

v

Atribut Information Gain

Income 0.319 Student 0.319 Leasing_Rate 0.376

Karena Atribut Leasing_Rate memiliki Nilai Information Gain tertinggi maka Atribut tersebut dijadikan node cabang untuk edge >40, sehingga decision tree-nya menjadi

[4] Decision tree yang dihasilkan adalah