ARTIFICIAL INTELLIGENCE
Lecturer: Silja Renooij
Supervised learning: classification
Utrecht University The Netherlands
These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html
ARTIFICIAL INTELLIGENCE Supervised learning: classification - - PowerPoint PPT Presentation
Utrecht University INFOB2KI 2019-2020 The Netherlands ARTIFICIAL INTELLIGENCE Supervised learning: classification Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from
Utrecht University The Netherlands
These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html
2
3
4
5
updated given forecast…. 6
7
8
Conditionals p(Fi|C) PT= yes PT= no O=sunny 2/9 3/5 O=overcast 4/9 O=rain 3/9 2/5 T=hot 2/9 2/5 T=mild 4/9 2/5 T=cool 3/9 1/5 H=high 3/9 4/5 H=normal 6/9 1/5 W=weak 6/9 2/5 W=strong 3/9 3/5
9
Probabilities based on frequency counting.
10
Conditionals p(Fi |C) PT= yes PT= no O=sunny 2/9 3/5 O=overcast 4/9 O=rain 3/9 2/5 T=hot 2/9 2/5 T=mild 4/9 2/5 T=cool 3/9 1/5 H=high 3/9 4/5 H=normal 6/9 1/5 W=weak 6/9 2/5 W=strong 3/9 3/5
11
12
13
Humidity high normal D1,D2,D3,D4 D8,D12,D14 D5,D6,D7,D9 D10,D11,D13
14
1 NB using ID3, this choice will be made by the algorithm…
15
Humidity high normal D5,D6,D7,D9 D10,D11,D13 Wind strong weak D1,D3,D4,D8 D2,D12,D14
16
Humidity high normal D5,D6,D7,D9 D10,D11,D13 Wind strong weak D1,D3,D4,D8 Outlook Sunny Rain Overcast Yes No No
Outlook Sunny Rain Overcast Yes No Yes Humidity high normal D5,D6,D7,D9 D10,D11,D13 Wind strong weak Outlook Sunny Rain Overcast Yes No No
17
Sunny Rain Overcast Yes Yes D5,D6,D10
Sunny Rain Overcast Yes No Yes Humidity high normal wind strong weak
Sunny Rain Overcast Yes No No
18
wind strong weak Yes No
Sunny Rain Overcast Yes Yes
Sunny Rain Overcast Yes No Yes Humidity high normal wind strong weak
Sunny Rain Overcast Yes No No
19
(humidity=high wind=strong outlook=overcast) (humidity=high wind=weak outlook=overcast) (humidity=high wind=weak outlook=rain) (humidity=normal outlook=sunny) (humidity=normal outlook=overcast) (humidity=normal outlook=rain wind=weak)
Note: The decision tree can be expressed as an expression
– in case of binary outcomes – a logical formula:
20
wind strong weak Yes No
Sunny Rain Overcast Yes Yes
Sunny Rain Overcast Yes No Yes Humidity high normal wind strong weak
Sunny Rain Overcast Yes No No
Humidity high normal wind strong weak
Sunny Rain Overcast Yes No No
Sunny Rain Overcast Yes No Yes
Sunny Rain Overcast Yes Yes wind strong weak Yes No
21
Humidity high normal wind strong weak
Sunny Rain Overcast Yes No No
Sunny Rain Overcast Yes No Yes
Sunny Rain Overcast Yes Yes wind strong weak Yes No
22
23
24
(= 1 for binary‐valued variable)
25
26
27
, Smild , Scool .
28
29
30
31
32
33
34
Left Sensor Right Sensor Forward Sensor Back Sensor Previous Action Action Obstacle Free Obstacle Free moveForward TurnRight Free Free Obstacle Free TurnLeft TurnLeft Free Obstacle Free Free MoveForward MoveForward Free Obstacle Free Obstacle TurnLeft MoveForward Obstacle Free Free Free TurnRight MoveForward Free Free Free Obstacle TurnRight MoveForward
35
Entropy(S) = − 1/6*log2(1/6) − 1/6*log2(1/6) − 4/6*log2(4/6) = 1.25 Entropy(SLeftSensor) = 2/6*Entropy(SLS=obstacle) + 4/6*Entropy(SLS=free) = 2/6*1 + 4/6*0.811 = 0.874 Entropy(SRightSensor) = 2/6*Entropy(SRS=obstacle) + 4/6*Entropy(SRS=free) = 2/6*0 + 4/6*1.5 = 1 Entropy(SForwardSensor) = 2/6*Entropy(SFS=obstacle) + 4/6*Entropy(SFS=Free) = 2/6*1 + 4/6*0 = 0.333 Entropy(SBackSensor) = 2/6*Entropy(SBS=obstacle) + 4/6*Entropy(SBS=free) = 2/6*0 + 4/6*1.5 = 1 Entropy(SPreviousAction) = 2/6*Entropy(SPA=MoveForw) + 2/6*Entropy(SPA=TurnL) + 2/6*Entropy(SPA=TurnR) = 2/6*1 + 2/6*1 + 2/6*0 = 0.666 Gain(S,LeftSensor) = 1.25 − 0.874 = 0.376 Gain(S,RightSensor) = 1.25 − 1 = 0.25 Gain(S,ForwardSensor) = 1.25 − 0.333 = 0.917 Gain(S,BackSensor) = 1.25 − 1 = 0.25 Gain(S,PreviousAction) = 1.25 − 0.666 = 0.584
Select ForwardSensor
36
ForwardSensor free
MoveForward {X1,X2} = S’
Entropy(S’) = −1/2*log2(1/2) − 1/2*log2(1/2) = 1 (X1: Action = TR; X2: Action = TL) Entropy(S’LeftSensor) = 1/2*Entropy(S’LS=obstacle) + 1/2*Entropy(S’LS=free) = 1/2*0 + 1/2*0 = 0 Gain = 1 – 0 = 1 Entropy(S’RightSensor) = 1*Entropy(S’RS=free) = 1*1 = 1 Gain = 1 – 1 = 0 Entropy(S’BackSensor) = exact same Gain = 1 – 1 = 0 Entropy(SPreviousAction) = 1/2*Entropy(SPA=MoveForw) + 1/2*Entropy(SPA=TurnL) = 1/2*0 +1/2*0 = 0 Gain = 1 – 0 = 1 Select either LeftSensor or PreviousAction, depending on the execution order
37
ForwardSensor free
MoveForward LeftSensor
free TurnRight (X1) TurnLeft (X2) ForwardSensor free
MoveForward Previous action Move forward TurnLeft TurnRight (X1) TurnLeft (X2)
38
Race Name BeenToB5 Good Person Minbari Delenn Yes Yes Minbari Draal Yes Yes Human Morden Yes No Narn G’Kar Yes Yes Human Sheridan Yes Yes
Entropy(S) = − 0.2*log2 0.2 − 0.8*log2 0.8 = 0.72
pyes=0.8 pno=0.2
Babylon 5 universe
D1 D2 D3 D4 D5 S
39
Race Name BeenToB5 Good Person Minbari Delenn Yes Yes Minbari Draal Yes Yes Human Morden Yes No Narn G’Kar Yes Yes Human Sheridan Yes Yes
Entropy(S) = − 0.2*log2 0.2 − 0.8*log2 0.8 = 0.72 pyes=0.8 pno=0.2
Babylon 5 universe
D1 D2 D3 D4 D5 S
40
Name Delenn Draal Morden G’kar Sheridan Yes Yes No Yes Yes
41
42
43
44
45
46