Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 38: Fuzzy Logic.

Similar presentations


Presentation on theme: "CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 38: Fuzzy Logic."— Presentation transcript:

1 CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 38: Fuzzy Logic

2 Uncertainty Studies Uncertainty Study Probability Based Information Theory based Fuzzy Logic Based Probabilistic Reasoning Markov Processes & Graphical Models Entropy Centric Algos Qualitative Reasoning Bayesian Belief Network

3 Outlook (0) Temp (T) Humidit y (H) Windy (W) Decision to play (D) SunnyHigh FN SunnyHigh TN CloudyHigh FY RainMedHighFY RainColdLowNY RainColdLowTN CloudyColdLowTY To-play-or-not-to-play-tennis data vs. Climatic-Condition from Ross Quinlan’s paper on ID3 (1986), C4.5 (1993)

4 Weather (0) Temp (T) Humidit y (H) Windy (W) Decision (D) SunnyMedHighFN SunnyColdLowFY RainMedLowFY SunnyMedLowTY CloudyMedHighTY CloudyHighLowFY RainHigh TN

5 Outlook Rain CloudySunny Windy YesHumidity High Low Yes No T F Yes No

6 Rule Base R1: If outlook is sunny and if humidity is high then Decision is No. R2: If outlook is sunny and if humidity is low then Decision is Yes. R3: If outlook is cloudy then Decision is Yes.

7 Fuzzy Logic

8 Fuzzy Logic tries to capture the human ability of reasoning with imprecise information Models Human Reasoning Works with imprecise statements such as: In a process control situation, “If the temperature is moderate and the pressure is high, then turn the knob slightly right” The rules have “Linguistic Variables”, typically adjectives qualified by adverbs (adverbs are hedges).

9 Underlying Theory: Theory of Fuzzy Sets Intimate connection between logic and set theory. Given any set ‘S’ and an element ‘e’, there is a very natural predicate, μ s (e) called as the belongingness predicate. The predicate is such that, μ s (e) = 1,iff e ∈ S = 0,otherwise For example, S = {1, 2, 3, 4}, μ s (1) = 1 and μ s (5) = 0 A predicate P(x) also defines a set naturally. S = {x | P(x) is true} For example, even(x) defines S = {x | x is even}

10 Fuzzy Set Theory (contd.) Fuzzy set theory starts by questioning the fundamental assumptions of set theory viz., the belongingness predicate, μ, value is 0 or 1. Instead in Fuzzy theory it is assumed that, μ s (e) = [0, 1] Fuzzy set theory is a generalization of classical set theory also called Crisp Set Theory. In real life belongingness is a fuzzy concept. Example: Let, T = set of “tall” people μ T (Ram) = 1.0 μ T (Shyam) = 0.2 Shyam belongs to T with degree 0.2.

11 Linguistic Variables Fuzzy sets are named by Linguistic Variables (typically adjectives). Underlying the LV is a numerical quantity E.g. For ‘tall’ (LV), ‘height’ is numerical quantity. Profile of a LV is the plot shown in the figure shown alongside. μ tall (h) 1 2 3 4 5 60 height h 1 0.4 4.5

12 Example Profiles μ rich (w) wealth w μ poor (w) wealth w

13 Example Profiles μ A (x) x x Profile representing moderate (e.g. moderately rich) Profile representing extreme

14 Concept of Hedge Hedge is an intensifier Example: LV = tall, LV 1 = very tall, LV 2 = somewhat tall ‘very’ operation: μ very tall (x) = μ 2 tall (x) ‘somewhat’ operation: μ somewhat tall (x) = √(μ tall (x)) 1 0 h μ tall (h) somewhat tall tall very tall

15 Representation of Fuzzy sets Let U = {x 1,x 2,…..,x n } |U| = n The various sets composed of elements from U are presented as points on and inside the n-dimensional hypercube. The crisp sets are the corners of the hypercube. (1,0) (0,0) (0,1) (1,1) x1x1 x2x2 x1x1 x2x2 (x 1,x 2 ) A(0.3,0.4) μ A (x 1 )=0.3 μ A (x 2 )=0.4 Φ U={x 1,x 2 } A fuzzy set A is represented by a point in the n-dimensional space as the point {μ A (x 1 ), μ A (x 2 ),……μ A (x n )}

16 Degree of fuzziness The centre of the hypercube is the “most fuzzy” set. Fuzziness decreases as one nears the corners Measure of fuzziness Called the entropy of a fuzzy set Entropy Fuzzy setFarthest corner Nearest corner

17 (1,0) (0,0) (0,1) (1,1) x1x1 x2x2 d(A, nearest) d(A, farthest) (0.5,0.5) A

18 Definition Distance between two fuzzy sets L 1 - norm Let C = fuzzy set represented by the centre point d(c,nearest) = |0.5-1.0| + |0.5 – 0.0| = 1 = d(C,farthest) => E(C) = 1

19 Definition Cardinality of a fuzzy set [generalization of cardinality of classical sets] Union, Intersection, complementation, subset hood

20 Note on definition by extension and intension S 1 = {x i |x i mod 2 = 0 } – Intension S 2 = {0,2,4,6,8,10,………..} – extension How to define subset hood?

21 Meaning of fuzzy subset Suppose, following classical set theory we say if Consider the n-hyperspace representation of A and B (1,1) (1,0)(0,0) (0,1) x1x1 x2x2 A. B 1.B 2.B 3 Region where

22 This effectively means CRISPLY P(A) = Power set of A Eg: Suppose A = {0,1,0,1,0,1,…………….,0,1} – 10 4 elements B = {0,0,0,1,0,1,……………….,0,1} – 10 4 elements Isn’t with a degree? (only differs in the 2 nd element)

23 Fuzzy definition of subset Measured in terms of “fit violation”, i.e. violating the condition Degree of subset hood = 1- degree of superset hood = m(A) = cardinality of A =

24 We can show that Exercise 1: Show the relationship between entropy and subset hood Exercise 2: Prove that Subset hood of B in A

25 Fuzzy sets to fuzzy logic Forms the foundation of fuzzy rule based system or fuzzy expert system Expert System Rules are of the form If then A i Where C i s are conditions Eg: C 1 =Colour of the eye yellow C 2 = has fever C 3 =high bilurubin A = hepatitis

26 In fuzzy logic we have fuzzy predicates Classical logic P(x 1,x 2,x 3 …..x n ) = 0/1 Fuzzy Logic P(x 1,x 2,x 3 …..x n ) = [0,1] Fuzzy OR Fuzzy AND Fuzzy NOT

27 Fuzzy Implication Many theories have been advanced and many expressions exist The most used is Lukasiewitz formula t(P) = truth value of a proposition/predicate. In fuzzy logic t(P) = [0,1] t( ) = min[1,1 -t(P)+t(Q)] Lukasiewitz definition of implication

28 Eg: If pressure is high then Volume is low Pressure High Pressure

29 Fuzzy Inferencing

30 Fuzzy Inferencing: illustration through inverted pendulum control problem Core The Lukasiewitz rule t( ) = min[1,1 + t(P) – t(Q)] An example Controlling an inverted pendulum θ = angular velocity Motor i=current

31 The goal: To keep the pendulum in vertical position (θ=0) in dynamic equilibrium. Whenever the pendulum departs from vertical, a torque is produced by sending a current ‘i’ Controlling factors for appropriate current Angle θ, Angular velocity θ. Some intuitive rules If θ is +ve small and θ. is –ve small then current is zero If θ is +ve small and θ. is +ve small then current is –ve medium

32 -ve med -ve small Zero +ve small +ve med -ve med -ve small Zero +ve small +ve med +ve small -ve small -ve med -ve small +ve small Zero Region of interest Control Matrix θ.θ. θ

33 Each cell is a rule of the form If θ is <> and θ. is <> then i is <> 4 “Centre rules” 1.if θ = = Zero and θ. = = Zero then i = Zero 2.if θ is +ve small and θ. = = Zero then i is –ve small 3.if θ is –ve small and θ. = = Zero then i is +ve small 4.if θ = = Zero and θ. is +ve small then i is –ve small 5. if θ = = Zero and θ. is –ve small then i is +ve small

34 Linguistic variables 1.Zero 2.+ve small 3.-ve small Profiles -ε-ε+ε+ε ε2 ε2 -ε2-ε2 -ε3-ε3 ε3ε3 +ve small -ve small 1 Quantity (θ, θ., i)

35 Inference procedure 1. Read actual numerical values of θ and θ. 2. Get the corresponding μ values μ Zero, μ (+ve small), μ (-ve small). This is called FUZZIFICATION 3. For different rules, get the fuzzy I-values from the R.H.S of the rules. 4. “ Collate ” by some method and get ONE current value. This is called DEFUZZIFICATION 5. Result is one numerical value of ‘ i ’.


Download ppt "CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 38: Fuzzy Logic."

Similar presentations


Ads by Google