Presentation is loading. Please wait.

Presentation is loading. Please wait.

F UZZY L OGIC Ranga Rodrigo March 30, 2014 Most of the sides are from the Matlab tutorial. 1.

Similar presentations

Presentation on theme: "F UZZY L OGIC Ranga Rodrigo March 30, 2014 Most of the sides are from the Matlab tutorial. 1."— Presentation transcript:

1 F UZZY L OGIC Ranga Rodrigo March 30, 2014 Most of the sides are from the Matlab tutorial. 1

2 I NTRODUCTION Fuzzy logic is due to the 1965 paper by Prof. Lofti A. Zadeh. Fuzzy logic is a form of many- valued logic; it deals with reasoning that is approximate rather than fixed and exact. Compared to traditional binary sets (true or false values) fuzzy logic variables may have a truth value that ranges in degree between 0 and 1 (no and yes). 2

3 H UMAN R EASONING Fuzzy systems attempts to mimic human reasoning. It can capture the degree of belongingness. E.g., – Is a student short, or tall? – In classical logic: h > 6 feet is tall and h  6 is short. – How about 5 feet 11 inches? Some may call this tall, and some may call it short. – This information is captured as a matter of degree This “degree” is called a truth value. 3

4 O VERVIEW OF A F UZZY I NFERENCE S YSTEM The point of fuzzy logic is to map an input space to an output space. The input space consists of a vector of truth values. The primary mechanism for doing this is a list of if- then statements called rules. 4

5 P ROCESS 5 Crisp input  Fuzzy input Fuzzification  Fuzzy set Apply Fuzzy Operators and Implication  Crisp output Defuzzyfication

6 A F UZZY I NFERENCE S YSTEM (FIS) 6 InputOutput Rules Input terms (interpret) Output terms (assign) A General Case ServiceTip If service is good then tip is cheap If service is good then tip is average If service is excellent then tip is generous Service is interpreted as {poor, good, excellent} Tip is assigned to be {cheap, average, generous} A Specific Example A FIS interprets the values in the input vector and, based on some set of rules, assigns values to the output vector.

7 F UZZY S ETS Fuzzy logic starts with the concept of a fuzzy set. A fuzzy set is a set without a crisp, clearly defined boundary. It can contain elements with only a partial degree of membership. 7

8 F UZZY S ETS E XAMPLE 8 A classical set: The set of days of the week unquestionably includes Monday, Thursday, and Saturday. It just as unquestionably excludes butter, liberty, and dorsal fins, and so on. A fuzzy set: Most would agree that Saturday and Sunday belong, but what about Friday? It feels like a part of the weekend, but somehow it seems like it should be technically excluded. Of any subject, one thing must be either asserted or denied In fuzzy logic, the truth of any statement becomes a matter of degree.

9 F UZZY S ETS E XAMPLE C ONTD. Reasoning in fuzzy logic is a matter of generalizing the familiar yes-no (Boolean) logic. If true = 1 and false = 0, fuzzy logic also permits in- between values like 0.2 and 0.7453. Q: Is Saturday a weekend day? – A: 1 (yes, or true) Q: Is Tuesday a weekend day? – A: 0 (no, or false) Q: Is Friday a weekend day? – A: 0.8 (for the most part yes, but not completely) Q: Is Sunday a weekend day? – A: 0.95 (yes, but not quite as much as Saturday). 9

10 10 Truth values for weekend-ness if forced to respond with an absolute yes or no response Truth value for weekend-ness if allowed to respond with fuzzy in- between values Continuous-scale Time Plot of Weekend-ness for Two-valued And Multi-Valued Membership

11 E XAMPLE OF A PPLYING T RUTH V ALUES A temperature measurement for anti-lock brakes Each function maps the same temperature value to a truth value in the 0 to 1 range. These truth values can then be used to determine how the brakes should be controlled. 11 Truth values of each of the three functions at a particular temperature

12 M EMBERSHIP F UNCTIONS A membership function (MF) is a curve that defines how each point in the input space is mapped to a membership value (or degree of membership) between 0 and 1. The input space is sometimes referred to as the universe of discourse. 12

13 M EMBERSHIP F UNCTIONS C ONTD. A smoothly varying curve that passes from not-tall to tall is the right way to represent. The output-axis is a number known as the membership value between 0 and 1. The curve is known as a membership function and is often given the designation of µ. 13

14 14

15 M EMBERSHIP F UNC. IN F UZZY L OGIC T OOLBOX 15 Triangular Membership Function Trapezoidal Membership Function Gaussian Membership Function Sigmoid Membership Function

16 L OGICAL O PERATIONS Fuzzy logical reasoning is the fact that it is a superset of standard Boolean logic. 16 Standard Truth Table Fuzzy Truth Table AND: min(A,B) OR: max(A,B) NOT: 1-A


18 I F -T HEN R ULES Fuzzy sets and fuzzy operators are the subjects and verbs of fuzzy logic. These if-then rule statements are used to formulate the conditional statements that comprise fuzzy logic. A single fuzzy if-then rule assumes the form An example of such a rule might be 18 if x is A then y is B If service is good then tip is average The if-part of the rule "x is A" is called the antecedent or premise. While the then-part of the rule "y is B" is called the consequent or conclusion.

19 I F -T HE R ULES C ONTD. In general, the input to an if-then rule is the current value for the input variable (in this case, service) The output is an entire fuzzy set (in this case, average). This set will later be defuzzified, assigning one value to the output. 19

20 P ROCESS 20 Crisp input  Fuzzy input Fuzzification  Fuzzy set Apply Fuzzy Operators and Implication  Crisp output Defuzzyfication

21 L OGICAL O PERATION OF T HEN The implication function then modifies that fuzzy set to the degree specified by the antecedent. The most common ways to modify the output fuzzy set are – truncation using the min function – scaling using the prod function 21

22 22

23 S UMMARY OF I F -T HEN R ULES Interpreting if-then rules is a three-part process. Fuzzify inputs: Resolve all fuzzy statements in the antecedent to a degree of membership between 0 and 1. If there is only one part to the antecedent, then this is the degree of support for the rule. Apply fuzzy operator to multiple part antecedents: If there are multiple parts to the antecedent, apply fuzzy logic operators and resolve the antecedent to a single number between 0 and 1. This is the degree of support for the rule. Apply implication method: Use the degree of support for the entire rule to shape the output fuzzy set. The consequent of a fuzzy rule assigns an entire fuzzy set to the output. This fuzzy set is represented by a membership function that is chosen to indicate the qualities of the consequent. If the antecedent is only partially true, (i.e., is assigned a value less than 1), then the output fuzzy set is truncated according to the implication method. 23

24 S UMMARY OF I F -T HEN R ULES C ONTD. In general, one rule alone is not effective. Two or more rules that can play off one another are needed. The output of each rule is a fuzzy set. The output fuzzy sets for each rule are then aggregated into a single output fuzzy set. Finally the resulting set is defuzzified, or resolved to a single number. 24


26 W HAT A RE F UZZY I NFERENCE S YSTEMS ? Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. The mapping then provides a basis from which decisions can be made, or patterns discerned. The process of fuzzy inference involves all of the pieces: – Membership Functions – Logical Operations – If-Then Rules. We concentrate on the Mamdani-type FIS (Ebrahim Mamdani in 1975). 26

27 A PPLICATIONS OF FIS Automatic control Data classification Decision analysis Expert systems Computer vision 27 WT-H650-top-loader-washing-machine


29 S TEP 1. F UZZIFY I NPUTS The first step is to take the inputs and determine the degree to which they belong to each of the appropriate fuzzy sets via membership functions. 29

30 S TEP 2. A PPLY F UZZY O PERATOR After fuzzification, the degree to which each part of the antecedent is satisfied for each rule is known. If the antecedent of a given rule has more than one part, the fuzzy operator is applied to obtain one number that represents the result of the antecedent for that rule. 30

31 S TEP 3. A PPLY I MPLICATION M ETHOD After applying a weight to each rule, the implication method is implemented. A consequent is a fuzzy set represented by a membership function, which weights appropriately the linguistic characteristics that are attributed to it. The consequent is reshaped using a function associated with the antecedent (a single number). 31

32 32

33 S TEP 4. A GGREGATE A LL O UTPUTS Because decisions are based on the testing of all of the rules in a FIS, the rules must be combined in some manner in order to make a decision. Aggregation is the process by which the fuzzy sets that represent the outputs of each rule are combined into a single fuzzy set. Methods: – max (maximum) – probor (probabilistic OR) – sum (simply the sum of each rule's output set) 33

34 34 fuzzy tipper

35 S TEP 5. D EFUZZIFY The input for the defuzzification process is a fuzzy set (the aggregate output fuzzy set) and the output is a single number. As much as fuzziness helps the rule evaluation during the intermediate steps, the final desired output for each variable is generally a single number. However, the aggregate of a fuzzy set encompasses a range of output values, and so must be defuzzified in order to resolve a single output value from the set. Methods: centroid, bisector, middle of max, largest of max, smallest of max. 35

36 36

37 S UMMARY 37

38 38

Download ppt "F UZZY L OGIC Ranga Rodrigo March 30, 2014 Most of the sides are from the Matlab tutorial. 1."

Similar presentations

Ads by Google