lecture 5 fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf ·...

51
Negnevitsky, Pearson Education, 2002 Negnevitsky, Pearson Education, 2002 1 Lecture 5 Lecture 5 Fuzzy expert systems: Fuzzy expert systems: Fuzzy inference Fuzzy inference Mamdani fuzzy inference Mamdani fuzzy inference Sugeno Sugeno fuzzy inference fuzzy inference Case study Case study Summary Summary

Upload: dodat

Post on 06-Feb-2018

233 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 1

Lecture 5Lecture 5Fuzzy expert systems:Fuzzy expert systems:Fuzzy inferenceFuzzy inference■■ Mamdani fuzzy inferenceMamdani fuzzy inference■■ SugenoSugeno fuzzy inferencefuzzy inference■■ Case studyCase study■■ SummarySummary

Page 2: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 2

Fuzzy Fuzzy inferenceinferenceThe most commonly used fuzzy inference techniqueThe most commonly used fuzzy inference techniqueis the so-called Mamdani method. In 1975,is the so-called Mamdani method. In 1975,Professor Professor Ebrahim MamdaniEbrahim Mamdani of London University of London Universitybuilt one of the first fuzzy systems to control abuilt one of the first fuzzy systems to control asteam engine and boiler combination. He applied asteam engine and boiler combination. He applied aset of fuzzy rules supplied by experienced humanset of fuzzy rules supplied by experienced humanoperators.operators.

Page 3: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 3

Mamdani fuzzyMamdani fuzzy inferenceinference

■■ The Mamdani-style fuzzy inference process isThe Mamdani-style fuzzy inference process isperformed in four steps:performed in four steps:●● fuzzification of the input variables,fuzzification of the input variables,●● rule evaluation;rule evaluation;●● aggregation ofaggregation of the rule outputs, and the rule outputs, and finallyfinally●● defuzzificationdefuzzification..

Page 4: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 4

We examine a simple two-input one-outputWe examine a simple two-input one-output problem that problem thatincludes three rules:includes three rules:Rule: 1Rule: 1 Rule: 1Rule: 1IFIF xx is is AA33 IFIF projectproject_funding_funding is is adequateadequateOROR yy is is BB11 OROR projectproject_staffing_staffing is is smallsmallTHEN THEN zz is is CC11 THEN THEN riskrisk is is lowlow

Rule: 2Rule: 2 Rule: 2Rule: 2IFIF xx is is AA22 IFIF projectproject_funding_funding is is marginalmarginalAND AND yy is is BB22 ANDAND projectproject_staffing_staffing is is largelargeTHEN THEN zz is is CC22 THEN THEN riskrisk is is normalnormal

Rule: 3Rule: 3 Rule: 3Rule: 3IFIF xx is is AA11 IFIF projectproject_funding_funding is is inadequateinadequateTHEN THEN zz is is CC33 THEN THEN riskrisk is is highhigh

Page 5: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 5

Step 1: Step 1: FuzzificationFuzzificationTheThe first step is to take the crisp inputs, first step is to take the crisp inputs, xx1 and 1 and yy11((project fundingproject funding and and project staffingproject staffing), and determine), and determinethe degree to which these inputs belong to each of thethe degree to which these inputs belong to each of theappropriate fuzzy setsappropriate fuzzy sets..

Crisp Inputy1

0.1

0.71

0 y1

B1 B2

Y

Crisp Input

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

Page 6: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 6

Step 2: Rule Step 2: Rule EvaluationEvaluationTheThe second step is to take the second step is to take the fuzzified fuzzified inputs, inputs,µµ((xx==AA1)1) = 0.5, = 0.5, µµ((xx==AA2)2) = 0.2, = 0.2, µµ((yy==BB1)1) = 0.1 and = 0.1 and µµ((yy==BB2)2) = =0.7, and apply them to the antecedents of the fuzzy0.7, and apply them to the antecedents of the fuzzyrules. If a given fuzzy rule has multiple antecedents,rules. If a given fuzzy rule has multiple antecedents,the fuzzy operator (AND or OR) is used to obtain athe fuzzy operator (AND or OR) is used to obtain asingle number that represents the result of thesingle number that represents the result of theantecedent evaluation. This number (the truth value)antecedent evaluation. This number (the truth value)is then applied to the consequent membershipis then applied to the consequent membershipfunctionfunction..

Page 7: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 7

To evaluate the disjunction of the rule antecedents,To evaluate the disjunction of the rule antecedents,we use the we use the OR fuzzy operationOR fuzzy operation. Typically, fuzzy. Typically, fuzzyexpert systems make use of the classical fuzzyexpert systems make use of the classical fuzzyoperation operation unionunion::

µµµµµµµµAA∪∪∪∪∪∪∪∪ BB((xx) = ) = maxmax [ [µµµµµµµµAA((xx), ), µµµµµµµµBB((xx)])]

Similarly, in order to evaluate the conjunction of theSimilarly, in order to evaluate the conjunction of therule antecedents, we apply the rule antecedents, we apply the AND fuzzy operationAND fuzzy operationintersectionintersection::

µµµµµµµµAA∩∩∩∩∩∩∩∩BB((xx) = ) = minmin [ [µµµµµµµµAA((xx), ), µµµµµµµµBB((xx)])]

Page 8: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 8

Mamdani-style rule evaluationMamdani-style rule evaluation

A31

0 X

1

y10 Y0.0

x1 0

0.1C1

1C2

Z

1

0 X

0.2

0

0.2 C11

C2

Z

A2

x1

Rule 3:

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:

AND THENRule 2:

IF x is A3 (0.0) y is B1 (0.1) z is C1 (0.1)

IF x is A2 (0.2) y is B2 (0.7) z is C2 (0.2)

IF x is A1 (0.5) z is C3 (0.5)

Page 9: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 9

Now the result of the antecedent evaluation can beNow the result of the antecedent evaluation can beapplied to the membership function of theapplied to the membership function of theconsequent.consequent.

■■ The most common method of correlating the ruleThe most common method of correlating the ruleconsequent with the truth value of the ruleconsequent with the truth value of the ruleantecedent is to antecedent is to cut thecut the consequent membership consequent membershipfunction at the level of the antecedent truth. Thisfunction at the level of the antecedent truth. Thismethod is called method is called clippingclipping. Since the top of the. Since the top of themembership function is sliced, the clipped fuzzy setmembership function is sliced, the clipped fuzzy setloses some information. However, clipping is stillloses some information. However, clipping is stilloften preferred because it involves less complex andoften preferred because it involves less complex andfaster mathematics, and generates an aggregatedfaster mathematics, and generates an aggregatedoutput surface that is easier tooutput surface that is easier to defuzzify defuzzify..

Page 10: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 10

■■ While clipping is a frequently used method, While clipping is a frequently used method, scalingscalingoffers a better approach for preserving the originaloffers a better approach for preserving the originalshape of the fuzzy set. The original membershipshape of the fuzzy set. The original membershipfunction of the rule consequent is adjusted byfunction of the rule consequent is adjusted bymultiplying all its membership degrees by the truthmultiplying all its membership degrees by the truthvalue of the rule antecedent. This method, whichvalue of the rule antecedent. This method, whichgenerally loses less information, can be very usefulgenerally loses less information, can be very usefulin fuzzy expert systems.in fuzzy expert systems.

Page 11: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 11

ClippedClipped and scaledand scaled membershipmembership functionsfunctions

Degree ofMembership1.0

0.0

0.2

Z

Degree ofMembership

Z

C2

1.0

0.0

0.2

C2

Page 12: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 12

Step 3: Aggregation of the rule Step 3: Aggregation of the rule outputsoutputsAggregationAggregation is the process of unification of the is the process of unification of theoutputs of all rules. outputs of all rules. We take the membership We take the membershipfunctions of all rulefunctions of all rule consequents consequents previously clipped or previously clipped orscaled and combine them into a single fuzzy set.scaled and combine them into a single fuzzy set.The inputThe input of the aggregation process is the list of of the aggregation process is the list ofclipped or scaled consequent membership functions,clipped or scaled consequent membership functions,and the output is one fuzzy set for each outputand the output is one fuzzy set for each outputvariable.variable.

Page 13: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 13

AggregationAggregation of the rule of the rule outputsoutputs

00.1

1C1

Cz is 1 (0.1)

C2

00.2

1

Cz is 2 (0.2)

0

0.5

1

Cz is 3 (0.5)ZZZ

0.2

Z0

C30.50.1

Page 14: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 14

Step 4: Step 4: DefuzzificationDefuzzificationTheThe last step in the fuzzy inference process is last step in the fuzzy inference process isdefuzzificationdefuzzification. Fuzziness helps us to evaluate the. Fuzziness helps us to evaluate therules, but the final output of a fuzzy system has to berules, but the final output of a fuzzy system has to bea crisp number. The input for thea crisp number. The input for the defuzzification defuzzificationprocess is the aggregate output fuzzy set and theprocess is the aggregate output fuzzy set and theoutput is a single number.output is a single number.

Page 15: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 15

■■ There are severalThere are several defuzzification defuzzification methods, but methods, butprobably the most popular one is theprobably the most popular one is the centroidcentroidtechniquetechnique. It finds the point where a vertical line. It finds the point where a vertical linewould slice the aggregate set into two equal masses.would slice the aggregate set into two equal masses.Mathematically this Mathematically this centre of gravity (COG)centre of gravity (COG) can canbe expressed as:be expressed as:

( )

( )∫

µ

µ

= b

aA

b

aA

dxx

dxxx

COG

Page 16: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 16

■■ Centroid defuzzificationCentroid defuzzification method finds a point method finds a pointrepresenting the centre of gravity of the fuzzy set, representing the centre of gravity of the fuzzy set, AA,,on the interval,on the interval, abab..

■■ A reasonable estimate can be obtained by calculatingA reasonable estimate can be obtained by calculatingit over a sample of points.it over a sample of points.

µ ( x )1.0

0.0

0.2

0.4

0.6

0.8

160 170 180 190 200

a b

210

A

150X

Page 17: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 17

Centre of gravity (COG):Centre of gravity (COG):

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 10060Z

Degree ofMembership

67.4

Page 18: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 18

■■ Mamdani-style inference, as we have just seen,Mamdani-style inference, as we have just seen,requires us to find therequires us to find the centroid centroid of a two-dimensional of a two-dimensionalshape by integrating across a continuously varyingshape by integrating across a continuously varyingfunction. In general, this process is notfunction. In general, this process is notcomputationally efficient.computationally efficient.

■■ Michio SugenoMichio Sugeno suggested to use suggested to use a single spike, a a single spike, asingletonsingleton, as the membership function of the rule, as the membership function of the ruleconsequent. consequent. A A singletonsingleton, or more precisely a , or more precisely a fuzzyfuzzysingletonsingleton, is a fuzzy set with a membership, is a fuzzy set with a membershipfunctionfunction that is unity at a single particular point on that is unity at a single particular point onthe universe of discourse and zero everywhere else.the universe of discourse and zero everywhere else.

Sugeno fuzzySugeno fuzzy inferenceinference

Page 19: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 19

SugenoSugeno-style fuzzy inference is very similar to the-style fuzzy inference is very similar to theMamdani method.Mamdani method. Sugeno Sugeno changed only a rule changed only a ruleconsequent. Instead of a fuzzy set, he used aconsequent. Instead of a fuzzy set, he used amathematical function of the input variable. Themathematical function of the input variable. Theformat of theformat of the SugenoSugeno-style fuzzy rule-style fuzzy rule is is

IFIF xx is is AAANDAND yy is is BBTHEN THEN zz is is f f ((x, yx, y))

where where xx, , yy and and zz are linguistic variables; are linguistic variables; AA and and BB are arefuzzy sets on universe of discourses fuzzy sets on universe of discourses XX and and YY,,respectively; and respectively; and f f ((x, yx, y) is a mathematical function.) is a mathematical function.

Page 20: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 20

TheThe most commonly used most commonly used zero-orderzero-order Sugeno Sugeno fuzzy fuzzymodelmodel applies fuzzy rules in the following form: applies fuzzy rules in the following form:

IFIF xx is is AAANDAND yy is is BBTHEN THEN zz is is kk

where where kk is a constant. is a constant.

In this case, the output of each fuzzy rule is constant.In this case, the output of each fuzzy rule is constant.All consequent membershipAll consequent membership functions are represented functions are representedby singleton spikes.by singleton spikes.

Page 21: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 21

A31

0 X

1

y10 Y

0.0

x1 0

0.1

1

Z

1

0 X

0.2

0

0.2

1

Z

A2

x1

IF x is A1 (0.5) z is k3 (0.5)Rule 3:

A11

0 X 0

1

Zx1

THEN

1

y1

B2

0 Y

0.7

B10.1

0.5 0.5

OR(max)

AND(min)

OR y is B1 (0.1) THEN z is k1 (0.1)Rule 1:

IF x is A2 (0.2) AND y is B2 (0.7) THEN z is k2 (0.2)Rule 2:

k1

k2

k3

IF x is A3 (0.0)

Sugeno-style rule evaluationSugeno-style rule evaluation

Page 22: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 22

Sugeno-style Sugeno-style aggregation of the rule outputsaggregation of the rule outputs

z is k1 (0.1) z is k2 (0.2) z is k3 (0.5) ∑0

1

0.1Z 0

0.5

1

Z00.2

1

Zk1 k2 k3 0

1

0.1Zk1 k2 k3

0.20.5

Page 23: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 23

Weighted average (WA):Weighted average (WA):

655.02.01.0

805.0502.0201.0)3()2()1(

3)3(2)2(1)1( =++

×+×+×=µ+µ+µ

×µ+×µ+×µ=kkk

kkkkkkWA

0 Z

Crisp Outputz1

z1

Sugeno-style Sugeno-style defuzzificationdefuzzification

Page 24: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 24

How to make a decision on which methodHow to make a decision on which methodto apply to apply −−−−−−−− Mamdani or Sugeno? Mamdani or Sugeno?■■ Mamdani method is widely accepted for capturingMamdani method is widely accepted for capturing

expert knowledge. It allows us to describe theexpert knowledge. It allows us to describe theexpertise in more intuitive, more human-likeexpertise in more intuitive, more human-likemanner. However, Mamdani-type fuzzy inferencemanner. However, Mamdani-type fuzzy inferenceentails a substantial computational burden.entails a substantial computational burden.

■■ On the other hand, Sugeno method isOn the other hand, Sugeno method iscomputationally effective and works well withcomputationally effective and works well withoptimisation and adaptive techniques, which makesoptimisation and adaptive techniques, which makesit very attractive in control problems, particularlyit very attractive in control problems, particularlyfor dynamic nonlinear systems.for dynamic nonlinear systems.

Page 25: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 25

Building a fuzzy expert system: case studyBuilding a fuzzy expert system: case study

■■ A service centre keeps spare parts and repairs failedA service centre keeps spare parts and repairs failedones.ones.

■■ A customer brings a failed item and receives a spareA customer brings a failed item and receives a spareof the same type.of the same type.

■■ Failed parts are repaired, placed on the shelf, andFailed parts are repaired, placed on the shelf, andthus become spares.thus become spares.

■■ The objective here is to advise a manager of theThe objective here is to advise a manager of theservice centre on certain decision policies to keepservice centre on certain decision policies to keepthe customers satisfied.the customers satisfied.

Page 26: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 26

Process of developing a fuzzy expert systemProcess of developing a fuzzy expert system

1. Specify the problem and define linguistic variables.1. Specify the problem and define linguistic variables.

2. Determine fuzzy sets.2. Determine fuzzy sets.

3. Elicit and construct fuzzy rules.3. Elicit and construct fuzzy rules.

4. Encode the fuzzy sets, fuzzy rules and procedures4. Encode the fuzzy sets, fuzzy rules and procedures to perform fuzzy inference into the expert system. to perform fuzzy inference into the expert system.

5. Evaluate and tune the system.5. Evaluate and tune the system.

Page 27: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 27

Step Step 11: Specify the problem and define: Specify the problem and define linguistic variableslinguistic variablesThere are four main linguistic variables: averageThere are four main linguistic variables: averagewaiting time (mean delay) waiting time (mean delay) mm, repair utilisation, repair utilisationfactor of the service centre factor of the service centre ρρ, number of servers , number of servers ss,,and initial number of spare parts and initial number of spare parts nn..

Page 28: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 28

Linguistic variables and their rangesLinguistic variables and their rangesLinguistic Variable: Mean Delay, m

Linguistic Value Notation Numerical Range (normalised)Very ShortShortMedium

VSSM

[0, 0.3][0.1, 0.5][0.4, 0.7]

Linguistic Variable: Number of Servers, sLinguistic Value Notation Numerical Range (normalised)

SmallMediumLarge

SML

[0, 0.35][0.30, 0.70]

[0.60, 1]Linguistic Variable: Repair Utilisation Factor, ρ

Linguistic Value Notation Numerical RangeLowMediumHigh

LMH

[0, 0.6][0.4, 0.8][0.6, 1]

Linguistic Variable: Number of Spares, nLinguistic Value Notation Numerical Range (normalised)

Very SmallSmallRather SmallMediumRather LargeLargeVery Large

VSS

RSMRLL

VL

[0, 0.30][0, 0.40]

[0.25, 0.45][0.30, 0.70][0.55, 0.75]

[0.60, 1][0.70, 1]

Linguistic Variable: Mean Delay, m

Linguistic Variable: Number of Servers, s

Linguistic Variable: Repair Utilisation Factor, ρ

Linguistic Variable: Number of Spares, n

Page 29: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 29

Step Step 22: Determine fuzzy sets: Determine fuzzy sets

Fuzzy sets can have a variety of shapes. However,Fuzzy sets can have a variety of shapes. However,a triangle or a trapezoid can often provide ana triangle or a trapezoid can often provide anadequate representation of the expert knowledge,adequate representation of the expert knowledge,and at the same time, significantly simplifies theand at the same time, significantly simplifies theprocess of computation.process of computation.

Page 30: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 30

Fuzzy sets of Fuzzy sets of Mean Delay mMean Delay m

0.10

1.0

0.0

0.2

0.4

0.6

0.8

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Mean Delay (normalised)

SVS M

Degree of Membership

Page 31: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 31

Fuzzy sets of Fuzzy sets of Number of Servers sNumber of Servers s

0.10

1.0

0.0

0.2

0.4

0.6

0.8

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

M LS

Degree of Membership

Number of Servers (normalised)

Page 32: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 32

Fuzzy sets of Fuzzy sets of Repair Utilisation Factor Repair Utilisation Factor ρρρρρρρρ

0.10

1.0

0.0

0.2

0.4

0.6

0.8

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Repair Utilisation Factor

M HL

Degree of Membership

Page 33: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 33

Fuzzy sets of Fuzzy sets of Number of Spares nNumber of Spares n

0.10

1.0

0.0

0.2

0.4

0.6

0.8

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

S RSVS M RL L VL

Degree of Membership

Number of Spares (normalised)

Page 34: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 34

Step Step 33: Elicit and construct fuzzy rules: Elicit and construct fuzzy rules

To accomplish this task, we might ask the expert toTo accomplish this task, we might ask the expert todescribe how the problem can be solved using thedescribe how the problem can be solved using thefuzzy linguistic variables defined previously.fuzzy linguistic variables defined previously.

Required knowledge also can be collected fromRequired knowledge also can be collected fromother sources such as books, computer databases,other sources such as books, computer databases,flow diagrams and observed human behaviour.flow diagrams and observed human behaviour.

Page 35: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 35

The square FAM representationThe square FAM representation

m

s

M

RL

VL

S

RS

L

VS

S

M

VS S M

L

M

S

Page 36: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 36

The rule tableThe rule tableRule m s ρ n Rule m s ρ n Rule m s ρ n

1 VS S L VS 10 VS S M S 19 VS S H VL

2 S S L VS 11 S S M VS 20 S S H L

3 M S L VS 12 M S M VS 21 M S H M

4 VS M L VS 13 VS M M RS 22 VS M H M

5 S M L VS 14 S M M S 23 S M H M

6 M M L VS 15 M M M VS 24 M M H S

7 VS L L S 16 VS L M M 25 VS L H RL

8 S L L S 17 S L M RS 26 S L H M

9 M L L VS 18 M L M S 27 M L H RS

Page 37: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 37

Rule Base 1Rule Base 11. If (utilis a tion_factor is L) then (number_of_spares is S)2. If (utilis a tion_factor is M) then (number_of_spares is M)3. If (utilis a tion_factor is H) then (number_of_spares is L)

4. If (mean_delay is VS) and (number_of_servers is S) then (number_of_spares is VL)5. If (mean_delay is S) and (number_of_servers is S) then (number_of_spares is L)6. If (mean_delay is M) and (number_of_servers is S) then (number_of_spares is M)

7. If (mean_delay is VS) and (number_of_servers is M) then (number_of_spares is RL)8. If (mean_delay is S) and (number_of_servers is M) then (number_of_spares is RS)9. If (mean_delay is M) and (number_of_servers is M) then (number_of_spares is S)

10.If (mean_delay is VS) and (number_of_servers is L) then (number_of_spares is M)11.If (mean_delay is S) and (number_of_servers is L) then (number_of_spares is S)12.If (mean_delay is M) and (number_of_servers is L) then (number_of_spares is VS)

Page 38: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 38

Cube FAM of Rule Base 2Cube FAM of Rule Base 2

VS VS VSVS VS VS

VS VS VSVL L M

HS

VS VS VSVS VS VS

VS VS VSM

VS VS VSVS VS VS

S S VSL

s

LVS S M

m

MH

ρρ

VS VS VSLVS S M

S

m

VS VS VSM

S S VSL

s

S VS VSMVS S M

m

VS S M

m

S

RS S VSM

M RS SL

s

S

M M SM

RL M RSL

s

Page 39: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 39

Step Step 44: Encode the fuzzy sets, fuzzy rules: Encode the fuzzy sets, fuzzy rules and procedures to perform fuzzyand procedures to perform fuzzy inference into the expert systeminference into the expert systemTo accomplish this task, we may choose one ofTo accomplish this task, we may choose one oftwo options: to build our system using atwo options: to build our system using aprogramming language such as C/C++ or Pascal,programming language such as C/C++ or Pascal,or to apply a fuzzy logic development tool such asor to apply a fuzzy logic development tool such asMATLAB Fuzzy Logic Toolbox or FuzzyMATLAB Fuzzy Logic Toolbox or FuzzyKnowledge Builder.Knowledge Builder.

Page 40: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 40

Step Step 55: Evaluate and tune the system: Evaluate and tune the systemThe last, and the most laborious, task is to evaluateThe last, and the most laborious, task is to evaluateand tune the system. We want to see whether ourand tune the system. We want to see whether ourfuzzy system meets the requirements specified atfuzzy system meets the requirements specified atthe beginning.the beginning.

Several test situations depend on the mean delay,Several test situations depend on the mean delay,number of servers and repair utilisation factor.number of servers and repair utilisation factor.

The Fuzzy Logic Toolbox can generate surface toThe Fuzzy Logic Toolbox can generate surface tohelp us analyse the system’s performance.help us analyse the system’s performance.

Page 41: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 41

Three-dimensional plots for Rule Base 1Three-dimensional plots for Rule Base 1

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.2

0.3

0.4

0.5

0.6

number_of_serversmean_de lay

num

ber_

of_s

pare

s

Page 42: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 42

Three-dimensional plots for Rule Base 1Three-dimensional plots for Rule Base 1

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.2

0.3

0.4

0.5

0.6

utilis a tion_factormean_delay

num

ber_

of_s

pare

s

Page 43: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 43

Three-dimensional plots for Rule Base 2Three-dimensional plots for Rule Base 2

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.15

0.2

0.25

0.3

0.35

number_of_se rve rsmean_delay

num

ber_

of_s

pare

s

Page 44: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 44

Three-dimensional plots for Rule Base 2Three-dimensional plots for Rule Base 2

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.2

0.3

0.4

utilis a tion_factormea n_delay

num

ber_

of_s

pare

s

0.5

Page 45: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 45

However, even now, the expert might not beHowever, even now, the expert might not besatisfied with the system performance.satisfied with the system performance.

To improve the system performance, we may useTo improve the system performance, we may useadditional sets additional sets −− Rather SmallRather Small and and Rather LargeRather Large −−on the universe of discourse on the universe of discourse Number of ServersNumber of Servers,,and then extend the rule base.and then extend the rule base.

Page 46: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 46

Modified fuzzy sets of Modified fuzzy sets of Number of Servers sNumber of Servers s

0.10

1.0

0.0

0.2

0.4

0.6

0.8

0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Number of Servers (normalised)

RS M RL LS

Degree of Membership

Page 47: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 47

Cube FAM of Rule Base 3Cube FAM of Rule Base 3

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

VS VS VS

S S VS

S S VS

VL L M

VL RL RS

M M S

RL M RS

L M RS

HS

M

RL

L

RS

s

LVS S M

m

MH

ρρ

VS VS VS

VS VS VS

VS VS VS

S S VS

S S VS

LVS S M

S

M

RL

L

RS

m

s

S VS VS

S VS VS

RS S VS

M RS S

M RS S

MVS S Mm

VS S Mm

S

M

RL

L

RS

s

S

M

RL

L

RS

s

Page 48: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 48

Three-dimensional plots for Rule Base 3Three-dimensional plots for Rule Base 3

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.15

0.2

0.25

0.3

0.35

number_of_se rve rsmea n_delay

num

ber_

of_s

pare

s

Page 49: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 49

Three-dimensional plots for Rule Base 3Three-dimensional plots for Rule Base 3

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.2

0.3

0.4

utilis a tion_factormean_delay

num

ber_

of_s

pare

s

0.5

Page 50: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 50

Tuning fuzzy systemsTuning fuzzy systems1.1. Review model input and output variables, and if Review model input and output variables, and if

required redefine their ranges. required redefine their ranges.2.2. Review the fuzzy sets, and if required define Review the fuzzy sets, and if required define

additional sets on the universe of discourse. additional sets on the universe of discourse. The use of wide fuzzy sets may cause the fuzzy The use of wide fuzzy sets may cause the fuzzy system to perform roughly. system to perform roughly.

3.3. Provide sufficient overlap between neighbouring Provide sufficient overlap between neighbouring sets. It is suggested that triangle-to-triangle and sets. It is suggested that triangle-to-triangle and trapezoid-to-triangle fuzzy sets should overlap trapezoid-to-triangle fuzzy sets should overlap between 25% to 50% of their bases. between 25% to 50% of their bases.

Page 51: Lecture 5 Fuzzy expert systems - web.itu.edu.trweb.itu.edu.tr/~sonmez/lisans/ai/ai_lec05.pdf · Negnevitsky, Pearson Education, 2002 2 Fuzzy inference The most commonly used fuzzy

Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 51

4.4. Review the existing rules, and if required add new Review the existing rules, and if required add new rules to the rule base. rules to the rule base.

5.5. Examine the rule base for opportunities to write Examine the rule base for opportunities to write hedge rules to capture the pathological behaviour hedge rules to capture the pathological behaviour of the system. of the system.

6.6. Adjust the rule execution weights. Most fuzzy Adjust the rule execution weights. Most fuzzy logic tools allow control of the importance of rules logic tools allow control of the importance of rules by changing a weight multiplier. by changing a weight multiplier.

7.7. Revise shapes of the fuzzy sets. In most cases, Revise shapes of the fuzzy sets. In most cases, fuzzy systems are highly tolerant of a shape fuzzy systems are highly tolerant of a shape approximation. approximation.