Fuzzy logic

20
fuzzy logic: Fuzzy logic is a superset of conventional (Boolean) logic that has been extended to handle the concept of partial truth -- truth values between "completely true" and "completely false". It was introduced by Dr. Lotfi Zadeh of UC/Berkeley in the 1960's as a means to model the uncertainty of natural language. Zadeh says that rather than regarding fuzzy theory as a single theory, we should regard the process of ``fuzzification'' as a methodology to generalize ANY specific theory from a crisp (discrete) to a continuous (fuzzy) form. Fuzzy Subsets: Just as there is a strong relationship between Boolean logic and the concept of a subset, there is a similar strong relationship between fuzzy logic and fuzzy subset theory. In classical set theory, a subset U of a set S can be defined as a mapping from the elements of S to the elements of the set {0, 1}, U: S --> {0, 1} This mapping may be represented as a set of ordered pairs, with exactly

description

AI notes

Transcript of Fuzzy logic

Page 1: Fuzzy logic

fuzzy logic:

Fuzzy logic is a superset of conventional (Boolean) logic that has beenextended to handle the concept of partial truth -- truth values between"completely true" and "completely false". It was introduced by Dr. LotfiZadeh of UC/Berkeley in the 1960's as a means to model the uncertaintyof natural language. Zadeh says that rather than regarding fuzzy theory as a single theory, weshould regard the process of ``fuzzification'' as a methodology togeneralize ANY specific theory from a crisp (discrete) to a continuous(fuzzy) form.

Fuzzy Subsets:

Just as there is a strong relationship between Boolean logic and theconcept of a subset, there is a similar strong relationship between fuzzylogic and fuzzy subset theory.

In classical set theory, a subset U of a set S can be defined as amapping from the elements of S to the elements of the set {0, 1},

U: S --> {0, 1}

This mapping may be represented as a set of ordered pairs, with exactlyone ordered pair present for each element of S. The first element of theordered pair is an element of the set S, and the second element is anelement of the set {0, 1}. The value zero is used to representnon-membership, and the value one is used to represent membership. Thetruth or falsity of the statement

x is in U

is determined by finding the ordered pair whose first element is x. Thestatement is true if the second element of the ordered pair is 1, and thestatement is false if it is 0.

Similarly, a fuzzy subset F of a set S can be defined as a set of

Page 2: Fuzzy logic

orderedpairs, each with the first element from S, and the second element fromthe interval [0,1], with exactly one ordered pair present for eachelement of S. This defines a mapping between elements of the set S andvalues in the interval [0,1]. The value zero is used to representcomplete non-membership, the value one is used to represent completemembership, and values in between are used to represent intermediateDEGREES OF MEMBERSHIP. The set S is referred to as the UNIVERSE OFDISCOURSE for the fuzzy subset F. Frequently, the mapping is describedas a function, the MEMBERSHIP FUNCTION of F. The degree to which thestatement

x is in F

is true is determined by finding the ordered pair whose first element isx. The DEGREE OF TRUTH of the statement is the second element of theordered pair.

In practice, the terms "membership function" and fuzzy subset get usedinterchangeably.

That's a lot of mathematical baggage, so here's an example. Let'stalk about people and "tallness". In this case the set S (theuniverse of discourse) is the set of people. Let's define a fuzzysubset TALL, which will answer the question "to what degree is personx tall?" Zadeh describes TALL as a LINGUISTIC VARIABLE, whichrepresents our cognitive category of "tallness". To each person in theuniverse of discourse, we have to assign a degree of membership in thefuzzy subset TALL. The easiest way to do this is with a membershipfunction based on the person's height.

tall(x) = { 0, if height(x) < 5 ft., (height(x)-5ft.)/2ft., if 5 ft. <= height (x) <= 7 ft., 1, if height(x) > 7 ft. }

Page 3: Fuzzy logic

A graph of this looks like:

1.0 + +------------------- | / | /0.5 + / | / | /0.0 +-------------+-----+------------------- | | 5.0 7.0

height, ft. ->

Given this definition, here are some example values:

Person Height degree of tallness--------------------------------------Billy 3' 2" 0.00 [I think]Yoke 5' 5" 0.21Drew 5' 9" 0.38Erik 5' 10" 0.42Mark 6' 1" 0.54Kareem 7' 2" 1.00 [depends on who you ask]

Expressions like "A is X" can be interpreted as degrees of truth,e.g., "Drew is TALL" = 0.38.

Note: Membership functions used in most applications almost never have assimple a shape as tall(x). At minimum, they tend to be triangles pointingup, and they can be much more complex than that. Also, the discussioncharacterizes membership functions as if they always are based on asingle criterion, but this isn't always the case, although it is quitecommon. One could, for example, want to have the membership function forTALL depend on both a person's height and their age (he's tall for hisage). This is perfectly legitimate, and occasionally used in practice.It's referred to as a two-dimensional membership function, or a "fuzzyrelation". It's also possible to have even more criteria, or to have the

Page 4: Fuzzy logic

membership function depend on elements from two completely differentuniverses of discourse.

Logic Operations:->

Now that we know what a statement like "X is LOW" means in fuzzy logic,how do we interpret a statement like

X is LOW and Y is HIGH or (not Z is MEDIUM)

The standard definitions in fuzzy logic are:

truth (not x) = 1.0 - truth (x) truth (x and y) = minimum (truth(x), truth(y)) truth (x or y) = maximum (truth(x), truth(y))

Some researchers in fuzzy logic have explored the use of otherinterpretations of the AND and OR operations, but the definition for theNOT operation seems to be safe.

Note that if you plug just the values zero and one into thesedefinitions, you get the same truth tables as you would expect fromconventional Boolean logic. This is known as the EXTENSION PRINCIPLE,which states that the classical results of Boolean logic are recoveredfrom fuzzy logic operations when all fuzzy membership grades arerestricted to the traditional set {0, 1}. This effectively establishesfuzzy subsets and logic as a true generalization of classical set theoryand logic. In fact, by this reasoning all crisp (traditional) subsets AREfuzzy subsets of this very special type; and there is no conflict betweenfuzzy and crisp methods.

Some examples:->

assume the same definition of TALL as above, and in addition,assume that we have a fuzzy subset OLD defined by the membership function:

old (x) = { 0, if age(x) < 18 yr. (age(x)-18 yr.)/42 yr., if 18 yr. <= age(x) <= 60 yr.

Page 5: Fuzzy logic

1, if age(x) > 60 yr. }

And for compactness, let

a = X is TALL and X is OLD b = X is TALL or X is OLD c = not (X is TALL)

Then we can compute the following values.

height age X is TALL X is OLD a b c----------------------------------------------------------

used of fuzzy logic :->

Fuzzy logic is used directly in very few applications. The Sony PalmTopapparently uses a fuzzy logic decision tree algorithm to performhandwritten (well, computer lightpen) Kanji character recognition.

A fuzzy expert system:->A fuzzy expert system is an expert system that uses a collection offuzzy membership functions and rules, instead of Boolean logic, toreason about data. The rules in a fuzzy expert system are usually of aform similar to the following:

if x is low and y is high then z = medium

where x and y are input variables (names for know data values), z is anoutput variable (a name for a data value to be computed), low is amembership function (fuzzy subset) defined on x, high is a membershipfunction defined on y, and medium is a membership function defined on z.The antecedent (the rule's premise) describes to what degree the ruleapplies, while the conclusion (the rule's consequent) assigns amembership function to each of one or more output variables. Most toolsfor working with fuzzy expert systems allow more than one conclusion perrule. The set of rules in a fuzzy expert system is known as the rulebaseor knowledge base.

Page 6: Fuzzy logic

The general inference process proceeds in three (or four) steps.

1. Under FUZZIFICATION, the membership functions defined on the input variables are applied to their actual values, to determine the degree of truth for each rule premise.

2. Under INFERENCE, the truth value for the premise of each rule is computed, and applied to the conclusion part of each rule. This results in one fuzzy subset to be assigned to each output variable for each rule. Usually only MIN or PRODUCT are used as inference rules. In MIN inferencing, the output membership function is clipped off at a height corresponding to the rule premise's computed degree of truth (fuzzy logic AND). In PRODUCT inferencing, the output membership function is scaled by the rule premise's computed degree of truth.

3. Under COMPOSITION, all of the fuzzy subsets assigned to each output variable are combined together to form a single fuzzy subset for each output variable. Again, usually MAX or SUM are used. In MAX composition, the combined output fuzzy subset is constructed by taking the pointwise maximum over all of the fuzzy subsets assigned tovariable by the inference rule (fuzzy logic OR). In SUM composition, the combined output fuzzy subset is constructed by taking the pointwise sum over all of the fuzzy subsets assigned to the output variable by the inference rule.

4. Finally is the (optional) DEFUZZIFICATION, which is used when it is useful to convert the fuzzy output set to a crisp number. There are more defuzzification methods than you can shake a stick at (at least 30). Two of the more common techniques are the CENTROID and MAXIMUM methods. In the CENTROID method, the crisp value of the output variable is computed by finding the variable value of the center of gravity of

Page 7: Fuzzy logic

the membership function for the fuzzy value. In the MAXIMUM method, one of the variable values at which the fuzzy subset has its maximum truth value is chosen as the crisp value for the output variable.

Extended Example:

Assume that the variables x, y, and z all take on values in the interval[0,10], and that the following membership functions and rules are defined:

low(t) = 1 - ( t / 10 ) high(t) = t / 10

rule 1: if x is low and y is low then z is high rule 2: if x is low and y is high then z is low rule 3: if x is high and y is low then z is low rule 4: if x is high and y is high then z is high

Notice that instead of assigning a single value to the output variable z, eachrule assigns an entire fuzzy subset (low or high).

Notes:

1. In this example, low(t)+high(t)=1.0 for all t. This is not required, but it is fairly common.

2. The value of t at which low(t) is maximum is the same as the value of t at which high(t) is minimum, and vice-versa. This is also not required, but fairly common.

3. The same membership functions are used for all variables. This isn't required, and is also *not* common.

In the fuzzification subprocess, the membership functions defined on theinput variables are applied to their actual values, to determine the

Page 8: Fuzzy logic

degree of truth for each rule premise. The degree of truth for a rule'spremise is sometimes referred to as its ALPHA. If a rule's premise has anonzero degree of truth (if the rule applies at all...) then the rule issaid to FIRE. For example,

x y low(x) high(x) low(y) high(y) alpha1 alpha2 alpha3 alpha4------------------------------------------------------------------------------0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 0.00.0 3.2 1.0 0.0 0.68 0.32 0.68 0.32 0.0 0.00.0 6.1 1.0 0.0 0.39 0.61 0.39 0.61 0.0 0.00.0 10.0 1.0 0.0 0.0 1.0 0.0 1.0 0.0 0.03.2 0.0 0.68 0.32 1.0 0.0 0.68 0.0 0.32 0.06.1 0.0 0.39 0.61 1.0 0.0 0.39 0.0 0.61 0.010.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.03.2 3.1 0.68 0.32 0.69 0.31 0.68 0.31 0.32 0.313.2 3.3 0.68 0.32 0.67 0.33 0.67 0.33 0.32 0.3210.0 10.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0 1.0

In the inference subprocess, the truth value for the premise of each rule iscomputed, and applied to the conclusion part of each rule. This results inone fuzzy subset to be assigned to each output variable for each rule.

MIN and PRODUCT are two INFERENCE METHODS or INFERENCE RULES. In MINinferencing, the output membership function is clipped off at a heightcorresponding to the rule premise's computed degree of truth. Thiscorresponds to the traditional interpretation of the fuzzy logic AND

Page 9: Fuzzy logic

operation. In PRODUCT inferencing, the output membership function isscaled by the rule premise's computed degree of truth.

For example, let's look at rule 1 for x = 0.0 and y = 3.2. As shown in thetable above, the premise degree of truth works out to 0.68. For this rule, MIN inferencing will assign z the fuzzy subset defined by the membershipfunction:

rule1(z) = { z / 10, if z <= 6.8 0.68, if z >= 6.8 }

For the same conditions, PRODUCT inferencing will assign z the fuzzy subsetdefined by the membership function:

rule1(z) = 0.68 * high(z) = 0.068 * z

Note: The terminology used here is slightly nonstandard. In most texts,the term "inference method" is used to mean the combination of the thingsreferred to separately here as "inference" and "composition." Thusyou'll see such terms as "MAX-MIN inference" and "SUM-PRODUCT inference"in the literature. They are the combination of MAX composition and MINinference, or SUM composition and PRODUCT inference, respectively.You'll also see the reverse terms "MIN-MAX" and "PRODUCT-SUM" -- thesemean the same things as the reverse order. It seems clearer to describethe two processes separately.

In the composition subprocess, all of the fuzzy subsets assigned to eachoutput variable are combined together to form a single fuzzy subset for eachoutput variable.

Page 10: Fuzzy logic

MAX composition and SUM composition are two COMPOSITION RULES. In MAXcomposition, the combined output fuzzy subset is constructed by takingthe pointwise maximum over all of the fuzzy subsets assigned to theoutput variable by the inference rule. In SUM composition, the combinedoutput fuzzy subset is constructed by taking the pointwise sum over allof the fuzzy subsets assigned to the output variable by the inferencerule. Note that this can result in truth values greater than one! Forthis reason, SUM composition is only used when it will be followed by adefuzzification method, such as the CENTROID method, that doesn't have aproblem with this odd case. Otherwise SUM composition can be combinedwith normalization and is therefore a general purpose method again.

For example, assume x = 0.0 and y = 3.2. MIN inferencing would assign thefollowing four fuzzy subsets to z:

rule1(z) = { z / 10, if z <= 6.8 0.68, if z >= 6.8 }

rule2(z) = { 0.32, if z <= 6.8 1 - z / 10, if z >= 6.8 }

rule3(z) = 0.0

rule4(z) = 0.0

MAX composition would result in the fuzzy subset:

fuzzy(z) = { 0.32, if z <= 3.2 z / 10, if 3.2 <= z <= 6.8 0.68, if z >= 6.8 }

PRODUCT inferencing would assign the following four fuzzy subsets to z:

rule1(z) = 0.068 * z

Page 11: Fuzzy logic

rule2(z) = 0.32 - 0.032 * z rule3(z) = 0.0 rule4(z) = 0.0

SUM composition would result in the fuzzy subset:

fuzzy(z) = 0.32 + 0.036 * z

Sometimes it is useful to just examine the fuzzy subsets that are theresult of the composition process, but more often, this FUZZY VALUE needsto be converted to a single number -- a CRISP VALUE. This is what thedefuzzification subprocess does.

fuzzy numbers and fuzzy arithmetic:->

Fuzzy numbers are fuzzy subsets of the real line. They have a peak orplateau with membership grade 1, over which the members of theuniverse are completely in the set. The membership function isincreasing towards the peak and decreasing away from it.

Fuzzy numbers are used very widely in fuzzy control applications. A typicalcase is the triangular fuzzy number

1.0 + + | / \ | / \0.5 + / \ | / \ | / \0.0 +-------------+-----+-----+-------------- | | | 5.0 7.0 9.0

which is one form of the fuzzy number 7. Slope and trapezoidal functionsare also used, as are exponential curves similar to Gaussian probabilitydensities.

There are more defuzzification methods than you can shake a stick at. A

Page 12: Fuzzy logic

couple of years ago, Mizumoto did a short paper that compared about tendefuzzification methods. Two of the more common techniques are theCENTROID and MAXIMUM methods. In the CENTROID method, the crisp value ofthe output variable is computed by finding the variable value of thecenter of gravity of the membership function for the fuzzy value. In theMAXIMUM method, one of the variable values at which the fuzzy subset hasits maximum truth value is chosen as the crisp value for the outputvariable. There are several variations of the MAXIMUM method that differonly in what they do when there is more than one variable value at whichthis maximum truth value occurs. One of these, the AVERAGE-OF-MAXIMAmethod, returns the average of the variable values at which the maximumtruth value occurs.

For example, go back to our previous examples. Using MAX-MIN inferencingand AVERAGE-OF-MAXIMA defuzzification results in a crisp value of 8.4 forz. Using PRODUCT-SUM inferencing and CENTROID defuzzification results ina crisp value of 5.6 for z, as follows.

Earlier on in the FAQ, we state that all variables (including z) take onvalues in the range [0, 10]. To compute the centroid of the function f(x),you divide the moment of the function by the area of the function. To compute the moment of f(x), you compute the integral of x*f(x) dx, and to compute thearea of f(x), you compute the integral of f(x) dx. In this case, we wouldcompute the area as integral from 0 to 10 of (0.32+0.036*z) dz, which is

Page 13: Fuzzy logic

(0.32 * 10 + 0.018*100) = (3.2 + 1.8) = 5.0

and the moment as the integral from 0 to 10 of (0.32*z+0.036*z*z) dz, which is

(0.16 * 10 * 10 + 0.012 * 10 * 10 * 10) = (16 + 12) = 28

Finally, the centroid is 28/5 or 5.6.

Note: Sometimes the composition and defuzzification processes arecombined, taking advantage of mathematical relationships that simplifythe process of computing the final output variable values.

The Mizumoto reference is probably "Improvement Methods of FuzzyControls", in Proceedings of the 3rd IFSA Congress, pages 60-62, 1989.

================================================================

Used of fuzzy expert systems :->

To date, fuzzy expert systems are the most common use of fuzzy logic. Theyare used in several wide-ranging fields, including: o Linear and Nonlinear Control o Pattern Recognition o Financial Systems o Operation Research o Data Analysis

-------------------------------------------------------------------------------- Click a to send an instant message to an online friend = Online, = Offline Prev | Next | Inbox - Choose Folder -[New Folder] as attachmentinline text Download Attachments

Page 14: Fuzzy logic

Privacy Policy- Terms of Service Copyright © 1994-2002 Yahoo! Inc. All rights reserved.