Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 386 Artificial Intelligence Ellen Walker Hiram College

Similar presentations


Presentation on theme: "CPSC 386 Artificial Intelligence Ellen Walker Hiram College"— Presentation transcript:

1 CPSC 386 Artificial Intelligence Ellen Walker Hiram College
Fuzzy Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College

2 Why fuzzy? Imprecision better approximates human reasoning
It is warm today. 65 degrees F in April is warm 65 degrees F in August is cool Imprecise calculation can be much faster (and “good enough”) This is the idea behind heuristics TSP (0.75%) 1,000,000 cities, 7 months TSP (3.5%) 1,000,000 cities, 3.5 hours

3 Fuzzy vs. Crisp Sets Crisp set A Fuzzy set A
Each item x is an element of A (100%) or is not (0%) Fuzzy set A Each item x has degree of membership in the set A An item can have non-zero membership in both A and ~A

4 Membership function Horizontal axis: all potential members of the set (sorted, if possible) Vertical axis: membership value from 0 (not at all) to 1 (totally) hot cold warm 0.8 0.2 65F Temperature

5 Linguistic Values Cold, Warm and Hot are linguistic values, represented by overlapping membership functions We can also define linguistic modifiers Very A = membership in A squared Somewhat hot = sqrt (membership in A) Not A = 1-A So, “not very A” = 1-A2

6 Fuzzy Logic Operations
AND X cannot have more membership in the set (A and B) than it does in A Therefore, membership in (A and B) = min (membership in A, membership in B) OR X must have at least as much membership in (A or B) as in A Therefore, membership in (A or B) = max (membership in A, membership in B)

7 Fuzzy Rules The basic fuzzy rule form
If x is A then y is B First, determine membership of x in A Then use that value to limit the degree to which y is B

8 Example: Adjusting a Bath/Shower
Rules If temperature is cold, then add-hot-water = high If temperature is warm, then add-hot-water = med If temperature is cold, then add-cold-water = low If temperature is warm, then add-cold-water = low

9 Example: Membership functions
cold warm hot 0.8 0.2 65F Temperature low med high Water flow

10 Resulting Membership Functions
low med high Center of mass Cold water flow (.8 low, .2 low) low med high Center of mass Hot water flow (.8 med, .2 high)

11 More complex left sides
If X is A and Y is B, then Z is C Take AND (min) of A and B membership values to limit C If X is A and Y is not B … Take min (A, 1-B) membership values to limit C

12 Designing a Fuzzy Rule-based System
Develop linguistic variables for each input and output variable Express a set of rules in terms of variables One rule for each input,output combination Test and adjust Change rules Change linguistic variables Often done using neural net, genetic algorithm, etc.

13 Operating a Fuzzy Rule Based System
Fuzzify inputs Numerical input -> set of linguistic memberships Apply rules Find the degree to which the left side applies Limit the m.f. of the right side at that value OR (union) m.f.s of all applicable rules Defuzzify output Find the center of mass of the resulting fuzzy set, translate that to a numerical output (if needed)

14 Rules as Fuzzy Graphs If temperature is cold, then add-hot-water = high If temperature is warm, then add-hot-water = med If temperature is hot, then add-hot-water = low hot warm cold high low med

15 Advantages of Fuzzy Rules
Rules are expressed in (close to) natural language Fewer rules are needed because of interpolation No precise thresholds Precise thresholds tend to make systems brittle

16 Fuzzy Clustering If you have data that you want to classify, you are essentially specifying subsets of your data. Crisp clustering = crisp sets. Each item in (at most) one cluster. Fuzzy clustering = fuzzy sets. Items can belong to multiple clusters (with membership values between 0 and 1) Typically, membership values add up to 1

17 K Means Clustering (Crisp)
Choose K random cluster centers Repeat For each data point (feature vector) Find the closest cluster Assign point to cluster For each cluster Recompute the center (avg. data pt) Until clusters don’t change

18 Fuzzy C-Means Clustering
Same as fuzzy K-means except: Point has (0-1) membership in cluster Membership computed based on distance from center Center computed based on weighted average of cluster members (weight by membership) “Borderline points” belong to multiple clusters, but don’t pull the centers much Overlapping clusters make sense


Download ppt "CPSC 386 Artificial Intelligence Ellen Walker Hiram College"

Similar presentations


Ads by Google