21

Fuzzy Rules 1965 paper: “Fuzzy Sets” (Lotfi Zadeh) Apply natural language terms to a formal system of mathematical logic zadeh

Embed Size (px)

Citation preview

Fuzzy Rules

1965 paper: “Fuzzy Sets” (Lotfi Zadeh)Apply natural language terms to a formal

system of mathematical logichttp://www.cs.berkeley.edu/~zadeh

1973 paper outlined a new approach to capturing human knowledge and designing expert systems using fuzzy rules

Fuzzy Rules

A fuzzy rule is a conditional statementin the familiar form:

IF x is ATHEN y is B

x and y are linguistic variablesA and B are linguistic values determined by

fuzzy sets on the universe of discourses X and Y, respectively

Linguistic Variables

A linguistic variable is a fuzzy variablee.g. the fact “John is tall” implies linguistic

variable “John” takes the linguistic value “tall”

Use linguistic variables to form fuzzy rules:IF ‘project duration’ is longTHEN ‘risk’ is high

IF risk is very highTHEN ‘project funding’ is very low

Fuzzy Expert Systems

A fuzzy expert system is an expert system thatuses fuzzy rules, fuzzy logic, and fuzzy sets

Many rules in a fuzzy logic system will fire to some extentIf the antecedent is true to some degree of

membership, then the consequent is true to the same degree

Fuzzy Expert Systems

Two distinct fuzzy sets describing tall and heavy:

Tall men Heavy men

180

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Height, cm

190 200 70 80 100160

Weight, kg

120

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Tall men Heavy men

180

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Height, cm

190 200 70 80 100160

Weight, kg

120

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Fuzzy Expert Systems

IF height is tallTHENweight is heavy

Tall menHeavy men

180

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Height, cm

190 200 70 80 100160

Weight, kg

120

Degree ofMembership1.0

0.0

0.2

0.4

0.6

0.8

Fuzzy Expert Systems

Other examples (multiple antecedents):e.g. IF ‘project duration’ is long

AND ‘project staffing’ is largeAND ‘project funding’ is

inadequateTHEN risk is high

e.g. IF service is excellentOR food is deliciousTHEN tip is generous

Fuzzy Expert Systems

Other examples (multiple consequents):e.g. IF temperature is hot

THEN ‘hot water’ is reduced;‘cold water’ is increased

Fuzzy Inference

Named after Ebrahim Mamdani, the Mamdani method for fuzzy inference is:1. Fuzzify the input variables2. Evaluate the rules3. Aggregate the rule outputs4. Defuzzify

Fuzzy Inference – Example

Rule 1:IF x is A3OR y is B1THEN z is C1

Rule 2:IF x is A2AND y is B2THEN z is C2

Rule 3:IF x is A1THEN z is C3

Rule 1:IF ‘project funding’ is adequateOR ‘project staffing’ is smallTHEN risk is low

Rule 2:IF ‘project funding’ is marginalAND ‘project staffing’ is largeTHEN risk is normal

Rule 3:IF ‘project funding’ is inadequateTHEN risk is high

x, y, and z are linguistic variablesA1, A2, and A3 are linguistic values on XB1 and B2 are linguistic values on YC1, C2, and C3 are linguistic values on Z

Fuzzy Inference – Example

1. Fuzzification

CrispInput

0.1

0.71

0y1

B1 B2

Y

CrispInput

0.20.5

1

0

A1 A2 A3

x1

x1 X(x =A1) = 0.5(x =A2) = 0.2

(y =B1) = 0.1(y =B2) = 0.7

project funding project staffing

inadequate

marginal large

small

Fuzzy Inference – Example

2. Rule 1 evaluation

A31

0 X

1

y10 Y

0.0

x1 0

0.1C1

1

C2

Z

1

0 X

0.2

0

0.2 C11

C2

Z

A2

x1

Rule 3: IF x isA1 (0.5)

A11

0 X 0

1

Zx1

THEN

C1 C2

1

y1

B2

0 Y

0.7

B10.1

C3

C3

C30.5 0.5

OR(max)

AND(min)

OR THENRule 1: IF x isA3 (0.0)

AND THENRule 2: IF x isA2 (0.2)

y isB1 (0.1) z isC1 (0.1)

y isB2 (0.7) z isC2 (0.2)

z isC3 (0.5)

project fundingproject staffing

adequate small

risk

low

Fuzzy Inference – Example

2. Rule 2 evaluation

A31

0 X

1

y10 Y

0.0

x1 0

0.1C1

1

C2

Z

1

0 X

0.2

0

0.2 C11

C2

Z

A2

x1

Rule 3: IF x isA1 (0.5)

A11

0 X 0

1

Zx1

THEN

C1 C2

1

y1

B2

0 Y

0.7

B10.1

C3

C3

C30.5 0.5

OR(max)

AND(min)

OR THENRule 1: IF x isA3 (0.0)

AND THENRule 2: IF x isA2 (0.2)

y isB1 (0.1) z isC1 (0.1)

y isB2 (0.7) z isC2 (0.2)

z isC3 (0.5)

project funding project staffing

marginal large

risk

normal

Fuzzy Inference – Example

2. Rule 3 evaluation

A31

0 X

1

y10 Y

0.0

x1 0

0.1C1

1

C2

Z

1

0 X

0.2

0

0.2 C11

C2

Z

A2

x1

Rule 3: IF x isA1 (0.5)

A11

0 X 0

1

Zx1

THEN

C1 C2

1

y1

B2

0 Y

0.7

B10.1

C3

C3

C30.5 0.5

OR(max)

AND(min)

OR THENRule 1: IF x isA3 (0.0)

AND THENRule 2: IF x isA2 (0.2)

y isB1 (0.1) z isC1 (0.1)

y isB2 (0.7) z isC2 (0.2)

z isC3 (0.5)

project funding

inadequate

risk

high

00.1

1C1

z isC1 (0.1)

C2

0

0.2

1

z isC2 (0.2)

0

0.5

1

z isC3 (0.5)

ZZZ

0.2

Z0

C30.5

0.1

Fuzzy Inference – Example

3. Aggregation of the rule outputs

risk

highnormallow

00.1

1C1

z isC1 (0.1)

C2

0

0.2

1

z isC2 (0.2)

0

0.5

1

z isC3 (0.5)

ZZZ

0.2

Z0

C30.5

0.1

Fuzzy Inference – Example

4. Defuzzificatione.g. use the centroid method in

which a vertical lineslices the aggregate setinto two equal halves

How can we calculate this?

Fuzzy Inference – Example

4. DefuzzificationCalculate the centre of gravity (cog):

b

aA

b

aA

COG

x x dx

x dx

Fuzzy Inference – Example

4. DefuzzificationUse a reasonable sampling of points

4.675.05.05.05.02.02.02.02.01.01.01.0

5.0)100908070(2.0)60504030(1.0)20100(

COG

1.0

0.0

0.2

0.4

0.6

0.8

0 20 30 40 5010 70 80 90 10060

Z

DegreeofMembership

67.4

4.675.05.05.05.02.02.02.02.01.01.01.0

5.0)100908070(2.0)60504030(1.0)20100(

COG

1.0

0.0

0.2

0.4

0.6

0.8

0 20 30 40 5010 70 80 90 10060

Z

DegreeofMembership

67.4

Applications of Fuzzy Logic

Why use fuzzy expert systems or fuzzy control systems?Apply fuzziness (and therefore accuracy) to

linguistically defined terms and rulesLack of crisp or concrete mathematical models

exist

When do you avoid fuzzy expert systems?Traditional approaches produce acceptable resultsCrisp or concrete mathematical models exist and

are easily implemented

Applications of Fuzzy Logic

Real-world applications include:Control of robots, engines, automobiles,

elevators, etc. Sendai Subway system in Sendai, Japan

Cruise-control in automobilesTemperature controlHandwriting recognition, OCRPredictive and diagnostic systems (e.g.

cancer)