Upload
oswin-sanders
View
212
Download
0
Embed Size (px)
Citation preview
example: input data
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true no
outlooksunny-no 2/5overcast-yes 0/4rainy-yes 2/5total 4/14
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true no
temp.hot-no* 2/4mild-yes 2/6cool-yes 1/4total 5/14
humidityhigh-no 3/7normal-yes 1/7total 4/14
windyfalse-yes 2/8true-no* 3/6total 5/14
example: 1R
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true nosunny cool high true ?
yessunny 2/9cool 3/9high 3/9true 3/9overall 9/14
0.005320.5 %
nosunny 3/5cool 1/5high 4/5true 3/5overall 5/14
0.020679.5 %
example: Naïve Bayes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true no
outlook
sunny2:3
overcast4:0
rainy3:2
temp.
hot2:2
cool3:1
mild4:2
humidity
high3:4
normal6:1
windy
false6:2
true3:3
temp.
hot0:2
cool1:0
mild1:1
humidity
high0:3
normal2:0
windy
false1:2
true1:1
example: ID3
outlook
windyhumidity yes
noyesyesno
high normal false true
sunny overcast rainy
example: ID3
example: PRISM
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true no
If ? then P=yesIf O=overcast then P=yes
O = sunny 2/5O = overcast 4/4O = rainy 3/5T = hot 2/4T = mild 4/6T = cool 3/4H = high 3/7H = normal 6/7W = false 6/8W = true 3/6
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
If ? then P=yesIf H=normal then P=yes
O = sunny 2/5O = rainy 3/5T = hot 0/2T = mild 3/5T = cool 2/3H = high 1/5H = normal 4/5W = false 4/6W = true 1/4
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
O = sunny 2/2O = rainy 2/3T = mild 2/2T = cool 2/3W = false 3/3W = true 1/2
If H=normaland ? then P=yesIf H=normal andW=false then P=yes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
O = sunny 1/4O = rainy 1/3T = hot 0/2T = mild 2/3T = cool 0/1H = high 1/5H = normal 1/2W = false 1/3W = true 1/4
If ? then P=yesIf T=mild then P=yes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
O = sunny 1/2O = rainy 1/2H = high 1/3H = normal 1/1W = false 1/2W = true 1/2
If T=mild and? then P=yesIf T=mild andH=normal then P=yes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
O = sunny 0/3O = rainy 1/3T = hot 0/2T = mild 1/3T = cool 0/1H = high 1/5H = normal 0/1W = false 1/3W = true 0/3
If ? then P=yesIf O=rainy then P=yes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true noexample: PRISM
T = mild 1/2T = cool 0/1H = high 1/2H = normal 0/1W = false 1/1W = true 0/2
If O=rainy and? then P=yesIf O=rainy andW=false then P=yes
outlook temp. humidity windy play
sunny hot high false no
sunny hot high true no
overcast
hot high false yes
rainy mild high false yes
rainy cool normal false yes
rainy cool normal true no
overcast
cool normal true yes
sunny mild high false no
sunny cool normal false yes
rainy mild normal false yes
sunny mild normal true yes
overcast
mild high true yes
overcast
hot normal false yes
rainy mild high true no
If O=overcast then P=yes
If H=normal andW=false then P=yes
If T=mild andH=normal then P=yes
If O=rainy andW=false then P=yes
example: PRISM
outlook temp. humidity windy play distance
sunny hot high false no 2
sunny hot high true no 1
overcast
hot high false yes 3
rainy mild high false yes 3
rainy cool normal false yes 3
rainy cool normal true no 2
overcast
cool normal true yes 2
sunny mild high false no 2
sunny cool normal false yes 2
rainy mild normal false yes 4
sunny mild normal true yes 2
overcast
mild high true yes 2
overcast
hot normal false yes 4
rainy mild high true no 2example: kNNsunny cool high true ?