VIEWS: 123 PAGES: 38 CATEGORY: Engineering POSTED ON: 10/5/2010 Public Domain
INTRODUCTION TO FUZZY SYSTEMS By Dr. M. Tahir Khaleeq Total Slides 37 1 Fuzzy Sets • Fuzzy logic is an approach to uncertainty that combines real values [0,1] and logic operations • Fuzzy logic is based on the ideas of fuzzy set theory and fuzzy set membership. Ex: He is very tall how does this differ from tall? • In normal sets, membership is binary. – An item is either in the set or not in the set. Ex: U = { 1,2,3,4,5,6,7,8,9} A = {1,3,5,7,9} B = {2,4,6,8}. 2 Fuzzy Sets (continue) • In fuzzy sets, membership is based on a degree between 0 and 1 – 0 means that the object is not a member of the set – 1 means that the object belongs entirely to the set – If degree is between 0 and 1, then this degree is the degree to which the item is thought to be in the set. – Each value of the function is called a membership degree. Ex: Jun is 43, 1.0 in set Hot August is 40, 0.7 in set Hot September is 35, 0.2 in set Hot 3 Fuzzy Sets (continue) • The notion of the fuzzy set was introduced by Lotfi Zadeh in 1965. • Fuzzy sets have imprecise boundaries. • Transition between fuzzy sets is gradual. • Fuzzy v Crisp: Fuzzy (approximate) Crisp (precise) - Elements can belong to Elements belong to one two sets at same time. set or the other only. - cold, warm, hot 20, 30, 40 (°C) - slow, normal, fast 50, 70, 100 (km/h) - dry, normal, humid 10, 25, 75 (% R.H.)4 Fuzzy Sets (continue) • Difference between an ordinary (crisp set) and a fuzzy set is shown in the figure • Crisp sets use clear cut on the boundaries. cool medium Crisp set • Fuzzy sets use grades. Fuzzy set Ex: values 14.99 and 15.01. medium - Belong to the fuzzy set medium. - Associated with different crisp sets, cool and medium. 5 Fuzzy Sets (continue) Example: Three fuzzy sets , values of a variable height are: short, medium, tall. Short Medium Tall – The value 170cm belongs 1 to fuzzy set medium to a 0.7 degree of 0.2 and at the 0.2 set tall to a degree of 0.7. 30 170 250 Height (cm) 6 Conceptualizing in Fuzzy terms • The representation of a problem in fuzzy terms is called conceptualization in fuzzy terms. • Linguistic terms are used in the process of identification and specification of a problem and construction of rules. Ex: higher, lower, very strong, slowly, much dependent, less dependent, good, bad etc. • Linguistic variable is a variable which takes fuzzy values and has a linguistic meaning. Ex: Linguistic variable: Velocity. Value: low, moderate, or high. 7 Conceptualizing in Fuzzy terms (continue) • Linguistic values are also called fuzzy labels, fuzzy predicates, or fuzzy concepts. • Linguistic values have semantic meaning and can be expressed numerically by their membership functions. • Linguistic variables can be – Quantitative Ex: temperature: low, high time: early, late – Qualitative Ex: truth, certainty, belief • The process of representing a linguistic variable into a set of linguistic values is called fuzzy quantization. 8 Crisp Membership Function Rule: IF temp >37 THEN day = hot. – Precise value of set { hot } at 37 °C – Each temp U belongs to only one set. 1.0 hot 0.8 0.6 0.4 0.2 0 35 36 37 38 39 40 U Temp (°C) 9 Fuzzy Membership Functions • Following are the most useful membership functions in fuzzy expert systems design: 1. Single-valued (Singleton) 2. Triangular 3. Trapezoidal 4. S-function (sigmoid function) 5. Z-function 6. function (bell function 10 Single-valued (Singleton) • U = b. B is a scalar value Triangular Function b U • The triangular functions are uniformly distributed over the universe U. 11 • Membership function (for a<b<c): x -a c -x mtri ( x; a , b, c) = max{min{ , }, 0 }, b - a c -b Example: If X= 32.5 then 32.5 - 25 35 - 32.5 µtri (32.5; 25,30,35) = max { min { , },0} 30 - 25 35 - 30 = max { min { 1.5, 0.5},0} = max {0.5,0} = 0.5 32.5 12 Trapezoidal Function • Member ship function (for a b < c d ) x -a d -x m trap ( x; a , b, c,d ) = max{min{ ,1, }, 0 }, b -a d -c - Fuzzy membership for u between 36 and 38 °C as uU - About half of persons would call the day “hot” when the temp is 37 °C. m(T) represents the fraction of people, who would assign the term “hot” to the day. 13 S-Function (sigmoid function) • Member function for a<b: 1 msigm ( x; a , b) = 1 e - a ( x -b ) - Fuzzy membership for u between 36 and 38 °C as uU 14 Fuzzy Logic • Just as fuzzy sets are an extension to sets, fuzzy logic is an extension to classical logic. • Fuzzy logic is a multi-valued logic while the classical logic is a binary logic. • Classical logic holds that every thing can be expressed in binary terms: 0 or 1, black or white, yes or ne, in terms of Boolean algebra, every thing is in one set or another but not in both. • Fuzzy logic allows for values between 0 and 1, shades of gray and may be partial membership in a set. 15 Fuzzy Logic (continue) • When the approximate reasoning of fuzzy logic is used with an expert system, logical inferences can be drawn from imprecise relationships. • EX: To optimize automatically the wash cycle of a washing machine by sensing – the load size – fabric mix, and – quantity of detergent. • The most distinguishing property of fuzzy logic is that deal with fuzzy propositions, which contain fuzzy variables and fuzzy values. 16 Fuzzy Rules • Several types of fuzzy rules have been used for fuzzy knowledge engineering. • IF x is A THEN y is B – Where (x is A) and (y is B) are two fuzzy propositions: • x and y are fuzzy variables defined over universe of discourse U and V respectively; and • A and B are fuzzy sets defined by their fuzzy membership functions µA : U [0,1], µB : V [0,1] 17 Fuzzy Rules (continue) • May contain AND, OR, NOT and other operators • The conclusion is computed by applying these fuzzy operators to the fuzzified inputs • Implication operation will be applied to rule output Example: IF day is hot THEN drink lots of water 18 Fuzzy Rules (continue) • The rule would recommend to drink 6 - 10 glasses of water. • The implication of the rule will be the minimum of the intersection of the 0.7 membership line with the “lots of” implication weight function. mA B ( x, y) = min[mA ( x), mB ( y)] 19 Fuzzification • When the input data are crisp then the fuzzification is applied over fuzzy rules of the type IF x1 is A1 AND x2 is A2 THEN y is B. • Fuzzification is the process of finding the membership degrees µA1(x1’) and µA2(x2’) to which input data x1’ and x2’ belong to the fuzzy sets A1 and A2 in the antecedent part of a fuzzy rule. 20 Fuzzification (continue) – Crisp input x is input to fuzzy membership function m(x) Example: Temperature = 37.4 degC – Result is fuzzy degree of membership Example: Membership in “hot” is 0.7 21 RULE EVALUATION • Rule evaluation takes place after the fuzzification procedure. • It deals with single values of membership degrees mA(x) and mA(y) and produces output membership function. • There are two major methods which can be applied: 1. Minimum inference: mA B ( x, y) = min[mA ( x), mB ( y)] 2. Product inference: mA B ( x, y) = mA ( x)mB ( y) 22 DEFUZZIFICATION • If the output is crisp then the defuzzification is applied over fuzzy rules. • Defuzzification is the process of calculating a single- output numerical value for a fuzzy output variable on the basis of the inferred resulting membership function for this variable. • Following two methods are widely used 1. The Center-of-Gravity method (COG) 2. The Mean-of-Maxima method (MOM) 23 The Center-of-Gravity Method – This method finds the geometical centre y’ in the universe V of an output variable y, which is center balance the inferred membership function B as a fuzzy value for y. v . mB(v) y= mB(v) The Mean-of-Maxima Method – This method finds the value y’ for output variable y which has maximum membership degree according to the fuzzy membership function B. – If values have maximum values then find mean of them. 24 Example 1 y'(MOM) 0.7 y'(COG) y 0 1 2 3 4 1.5 1.9 (0 × 0) + (1 × 1) + (1 × 2) + (0.7 × 3) y'(COG) = 1.9 1 + 1 + 0.7 1+2 y'(MOM) = = 1.5 2 25 Fuzzy Expert System • A fuzzy expert system is like an ordinary expert system but methods of fuzzy logic are applied. • Fuzzy expert systems use: – Fuzzy data (fuzzy input and output variables) – Fuzzy rules – Fuzzy inference – Other components of the ordinary expert system 26 Block diagram of a fuzzy expert system Fuzzy Rule Base Learning Fuzzy Rules Fuzzy Inference Data Base (Fuzzy) Machine Fuzzification Membership Defuzzyfication Function User Interface Fuzzy data/Exact data Fuzzy queries/Exact queries 27 1. Fuzzy Rule-Base – The fuzzy rules and the membership functions make up the system knowledge base. – Some systems use production rules extended with fuzzy variables and confidence factors. – Different types of production rules can be used: antecedent part consequent part Crisp Crisp (CF) Crisp Fuzzy (CF) Fuzzy Crisp (CF) Fuzzy Fuzzy (CF) 28 2. Data-Base – Data can be exact or fuzzy data with certainty factors. Ex: economic situation good CF = 0.95 3. Fuzzy Inference Machine – A fuzzy inference machine is built on the theoretical basis of fuzzy inference methods – A fuzzy inference machine activates all the satisfied rules at every cycle. – A characteristic of fuzzy expert system is the realization of partial match between exact or fuzzy facts. – A rule is fired only if the matching degree of the left hand side of the rule is greater than a predefined threshold. 29 – A measure of the degree of matching is calculated for every case. Ex: fuzzy fact --- fuzzy condition Crisp fact --- fuzzy condition fuzzy fact --- exact condition crisp fact --- exact condition 4. Fuzzification and Defuzzification – These may be used according to the type of inference machine implemented in the fuzzy expert system. 30 5. User Interface – The interface unit communicates with the user or the environment, or both for collecting input data and reporting output results. – Fuzzy queries might be possible when the user input information in fuzzy terms. Ex: high temperature, severe headache etc. 6. Learning Fuzzy Rules – This is optional module. – Learning can take place either before the inference machine starts the reasoning process, or during the fuzzy inference process. – If learning takes place before the inference machine starts the learning module uses AI machine learning 31 methods or neural networks. – If the learning takes place during the fuzzy inference process the fuzzy neural networks can be used for learning. 7. Explanation – The explanation module explains the way the expert system is functioning during the inference process or explains how the final solution has been reached. – The system may use fuzzy terms for explanation as well as exact terms and values. 32 Fuzzy System Design • The following are the main steps of the fuzzy system design: 1. Identification the Problem – Identify the problem and choosing the type of fuzzy system, which best suits the problem requirements. – A modular system can be designed consisting of several modules linked together. – The modular approach simply the design of the whole system, reduce the complexity and make the system more comprehensible. 2. Defining the Input and Output Variables: – Define the input and output variables, their fuzzy values 33 and their membership functions. 3. Articulating the Set of Fuzzy Rules 4. Choosing the fuzzy inference method, fuzzification and defuzzification methods if necessary. 5. Experiment and Validate the System – Experimenting with the fuzzy system prototype, – drawing the goal function between input and output fuzzy variables, – changing the membership functions and fuzzy rules if necessary, – tuning the fuzzy system, – validation of the results. 34 Methods for Obtaining Fuzzy Rules • The main problem in building fuzzy expert systems is that of articulating the fuzzy rules and membership functions for the fuzzy terms. • Some methods for obtaining fuzzy rules are as follows: 1. Interview an Expert – Sometimes, communication between expert and interviewer can be difficult because of a lake of common understanding. – The shape of membership functions, the number of labels, and so forth should be defined by the expert. But, sometimes the human expert is unfamiliar with fuzzy sets or fuzzy logic and the knowledge engineer is unfamiliar with the domain area. 35 2. Imagine the Behavior of the System – The system designer has to be particularly experienced with the system in order to imagine physical behavior of the system and think about physical meaning in natural and technical languages. 3. Using Learning Methods – Use the methods of machine-learning, neural networks, and genetic algorithms to learns fuzzy rules from data and to learn membership functions if they are not given in advance. 36 END 37 All lectures are available on www.geocities.com/mtkhaleeq/AI.htm 38