cs 621 artificial intelligence lecture 8 - 19/08/05 prof. pushpak bhattacharyya

31
19-08-05 Prof. Pushpak Bhattachary ya, IIT Bombay 1 CS 621 Artificial Intelligence Lecture 8 - 19/08/05 Prof. Pushpak Bhattacharyya Fuzzy Logic Application

Upload: moya

Post on 21-Mar-2016

41 views

Category:

Documents


0 download

DESCRIPTION

CS 621 Artificial Intelligence Lecture 8 - 19/08/05 Prof. Pushpak Bhattacharyya. Fuzzy Logic Application. NLP -> Fuzzy Logic. Language statements imprecise Linguistic variable -> Adjective Hedges -> Adverb. Example Problem. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

1

CS 621 Artificial Intelligence

Lecture 8 - 19/08/05

Prof. Pushpak Bhattacharyya

Fuzzy Logic Application

Page 2: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

2

NLP -> Fuzzy Logic

Language statements impreciseLinguistic variable -> AdjectiveHedges -> Adverb

Page 3: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

3

Example Problem

Assume 4 types of Fuzzy Predicates applicable to persons (age, height, weight and level of education). The membership functions are of the basic form 1/(1+e-x), but of appropriate shape and orientation.

Page 4: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

4

Example (Contd 1)

Determine the truth values of :a) A person X is highly educated and not very young is very true.b) X is very young, tall, not heavy and somewhat educated is truec) X is more of less old or highly educated is fairly true

Page 5: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

5

Example (Contd 2)

d) X is very heavy or old or not highly educated is fairly true

e) X is short, not very young and highly educated is very true

( assume that the level of education has 4 values: Elementary school, High school, College, PHD)

Page 6: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

6

Basic Profile

Page 7: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

7

To Adjust For Different Linguistic Variables

Page 8: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

8

To Find k1 and k2 we need < x1, y1 > , <x2, y2>

x1 = 0 y1 = 0.01 x2 = ? y2 = 0.99

Page 9: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

9

y = 1/(1+e-k1

(x-k2

))

=> (1-y)/y = e-k1

(x-k2

)

=> k1(x - k2) = ln(y/1-y)

call y/1-y = α

Finding α

Page 10: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

10

Solving for k1 & k2

k1(x-k2) = ln α

So, k1 x – k1 k2 = ln α

at < x1, y1 >

k1 x1 – k1 k2 = ln α1 --- (1) where α1 = y1/1-y1

Page 11: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

11

Solving for k1 & k2 (Contd 1)

k1 x2 - k1 k2 = ln α2 ---(2)

α2 = y2 / 1- y2

Solving from k1 and k2

k1 = (1/(x2- x1) ) ln ( ((1-y1)/y1)/((1-y2)/y2))

Page 12: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

12

Solving for k1 & k2 (Contd 2)

k2 = x2 – (ln α2) / k1

Lets use x1= 0, y1= 0.01, x2=?, y2= 0.99

k1 = 2/x2 ln 99

= 2* 4.6 / x2

= 9.2 /x2

Page 13: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

13

Solving for k1 & k2 (Contd 3)

k2 = x2 /2

k1 = 9.2 / x2

k2 = x2 / 2

Page 14: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

14

Profile of Old

x1 = 0, y1 = 0.01x2 = 80 yrsy2 = 0.99k1 = 9.2 / 80 = 0.1k2 = 40

Profile of old y = 1/(1+e - 0.1(x - 40))

Page 15: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

15

Profile of Tall

x1 = 0, y1 = 0.01

x2 =6ft, y2 = 0.99

k1 = 9.2 / 6 = 1.5

k2 = 6/2 = 3

Profile of Tall, y = 1/(1+e -1.5(x - 3))

Page 16: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

16

Profile of Heavy

x1 = 0, y1 = 0.01

x2 = 100kg yrs, y2 = 0.99

k1 = 9.2 / 100 = 0.1

k2 = 100/2 = 50

Profile of Heavy, y = 1/(1+e - 0.1(x - 50))

Page 17: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

17

Profile of Educatedschool = 0.25, high School = 0.5, college 0.75,PhD = 1.00

x1 = 0, y1 = 0.01, x2 =1 yrs, y2 = 0.99

Profile: y = 1/(1+e - 9.2 (x – 0.5 ))

Page 18: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

18

Old

Tall

Heavy

Educated

1/(1+e-k1(x-k2))

Page 19: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

19

Truey = 1/(1+e-k

1(x-k

2))

k1 and k2 values are chosen arbitrarily

Page 20: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

20

a) X is highly educated and not very young is very true

l = Level of educationμ 2

true (μ)

μ = min [μ2educated (l), 1- ( 1- μold(age) ) ) 2

μ for Different Configurations - 1

Page 21: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

21

μ for Different Configurations - 2b) X is very young, tall, not heavy and somewhat

educated is trueμ true (μ)

μ = min ( ( 1 - μold(age))2, μtall(ht), 1- μ heavy(wt), (μedu

(L))1/2)

Page 22: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

22

μ for Different Configurations - 3c) X is more or less old or highly educated is fairly

true

(μtrue(μ ))1.5

μ = max ( (μold(age))1/2, μ2edu (l))

Page 23: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

23

μ for Different Configurations - 4

d) X is very heavy or old or not highly educated is fairly true

(μ true(μ) )1.5

μ = max (μold(age), μ2heavy(wt ), 1 - μ2

edu (l))

Page 24: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

24

μ for Different Configurations - 5

e) X is short, not very young and highly educated is very true

μ2true(μ)

μ = min [1 – (1 - μ old(age))2, μ2edu (l), 1 - μtall(ht) ]

Page 25: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

25

Question : How to actually read off values

John:age: 35

ht : 5.8’

wt : 75 Kg

education l : College

Page 26: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

26

Page 27: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

27

Fuzzy InferencingClosely related to Fuzzy Expert Systems

Expert Systems:Rules :

Antecedent Consequentp q

p1 p2 p3 …. Pn qi

Page 28: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

28

Inferencing

Forward Chaining Backward Chaining

Supposed to prove the fact F

Inferencing

Page 29: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

29

Forward Chaining ( Data Driven)

Given Facts are matched with LHS of rules

RHS of satisfied rules are added to the fact base

Stop when the required F comes to the fact base.

Page 30: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

30

Backward Chaining ( Goal Driven)

Start from F to see if it matches the RHS of any rule.

LHS of matched Rule becomes the new goal.

Stop when a fact is hit.

Page 31: CS 621 Artificial Intelligence Lecture 8 -  19/08/05 Prof. Pushpak Bhattacharyya

19-08-05 Prof. Pushpak Bhattacharyya, IIT Bombay

31

Fuzzy Expert System

Rules are in forms of linguistic variables.

Example of “Inverted pendulum control”