fuzzy expert systems. 2 motivation on vagueness “everything is vague to a degree you do not...
TRANSCRIPT
Fuzzy Expert Systems
2
Motivation On vagueness “Everything is vague to a degree you do not realise until you
have tried to make it precise.”
Bertrand Russell
3
The world is imprecise.
Mathematical and Statistical techniques often unsatisfactory. Experts make decisions with imprecise data
in an uncertain world. They work with knowledge that is rarely
defined mathematically or algorithmically but uses vague terminology with words.
Fuzzy logic is able to use vagueness to achieve a precise answer. By considering shades of grey and all factors simultaneously, you get a better answer, one that is more suited to the situation.
4
Outline“ So far as the laws of mathematics refer to reality, they are not certain. And so far as they are certain, they do not refer to reality." - Albert Einstein
Introduction (Fuzzy Logic)
Fuzzy Sets & Rules
Fuzzy Expert Systems
5
Introduction - Fuzzy Logic Fuzzy logic is a superset of boolean
logic It was created by Dr. Lotfi Zadeh in
1960s for the purpose of modeling the uncertainty inherent in natural language
In fuzzy logic, it is possible to have partial truth values
6
Fuzzy Logic Unlike two-valued Boolean logic,
fuzzy logic is multivalued.
It deals with degrees of membership and degrees of truth.
7
Fuzzy Logic – cont’d
Fuzzy logic is based on the idea that all things admit of degrees Temperature – “It is very cold” Height – “He is very tall guy” Speed – ... Beauty – ...
8
Fuzzy Sets & Rules A fuzzy set is a set with fuzzy
boundaries. In classical set theory;
fA(x):X {0,1}, where fA(x) = In fuzzy sets;
A(x):X {0,1},
where A(x) = 1, if x is totally in A;
A(x) = 0, if x is not in A;
0 < A(x) < 1, if x is partly in A
1, if xA
0, if xA
9
Fuzzy Sets & Rules – cont’d
A(x) is the “membership function”.
Value of this function is between 0 and 1.
This value represents the “degree of membership” (membership value) of element x in set A.
10
Fuzzy Sets & Rules – cont’d
Classical tall men example.
11
Fuzzy Sets & Rules – cont’d
Crisp and fuzzy sets of tall men
12
Fuzzy Sets
Membership functions representing three fuzzy sets for the variable "height".
13
Fuzzy Sets...
Representing crisp and fuzzy sets as subsets of a domain (universe) U".
14
Fuzzy Sets...
Support of a fuzzy set A
15
I-cut of a fuzzy set
Fuzzy Sets...
16
Notation
For the member, x, of a discrete set with membership µ we use the notation µ/x . In other words, x is a member of the set to degree µ. Discrete sets are written as:
A = µ1/x1 + µ2/x2 + .......... + µn/xn
Or
where x1, x2....xn are members of the set A and µ1, µ2, ...., µn are their degrees of membership. A continuous fuzzy set A is written as:
17
Fuzzy Sets - Example
“numbers close to 1”
18
Fuzzy Sets
The members of a fuzzy set are members to some degree, known as a membership grade or degree of membership.
The membership grade is the degree of belonging to the fuzzy set. The larger the number (in [0,1]) the more the degree of belonging. (N.B. This is not a probability)
The translation from x to µA(x) is known as fuzzification.
A fuzzy set is either continuous or discrete. Graphical representation of membership functions
is very useful.
19
Fuzzy Sets - Example
Again, notice the overlapping of the sets reflecting the real worldmore accurately than if we were using a traditional approach.
20
Imprecision
Words are used to capture imprecise notions, loose concepts or perceptions.
21
Operations with fuzzy sets
Five operations with two fuzzy sets A and B approximately represented in a graphical form
22
Operations with fuzzy sets...
Showing graphically one way to measuring similarity and distance between fuzzy sets A and B. The black area represents quantitatively the measure.
23
Union & Intersection of Fuzzy Sets: T-norms and T-conorms
Building blocks of fuzzy systems Only a few used in real applications
Introduced to enable generalisation from
boolean to multi-valuedlogic
How do we use them? Most commonly used t-norm for fuzzy
intersection is to take the minimum Most commonly used t-conorm for fuzzy union is
to take the maximum.
t-norms define a general class of intersection operators for fuzzy setst-conorms define a general class of aggregation operators for union of fuzzy sets
24
Fuzziness versus probability
Probability density function for throwing a dice and the membership functions of the concepts "Small" number, "Medium", "Big".
25
Developing a FS
Determining the Membership Function ‘heuristic’ approach where the developer sits down
with an expert Statistical techniques Neural networks and genetic algorithms have also
been used Determining the Rules
type of rules that should be used content of the rules
Composition operators (i.e. combining rules) Defuzzification (i.e. getting a crisp output).
26
Example - Dinner for two
Rule 2 If service is good, then tip is average
Rule 3 If service is excellent or food is delicious, then tip is generous
The inputs are crisp (non-fuzzy) numbers limited to a specific range
All rules are evaluated in parallel using fuzzy reasoning
The results of the rules are combined and distilled (de-fuzzyfied)
The result is a crisp (non-fuzzy) number
Output
Tip (5-25%)
Dinner for two: this is a 2 input, 1 output, 3 rule system
Input 1
Service (0-10)
Input 2
Food (0-10)
Rule 1 If service is poor or food is rancid, then tip is cheap
27
Dinner for two
1. Fuzzify the input:
2. Apply Fuzzy operator
28
Dinner for two
3. Apply implication method
29
Dinner for two
4. Aggregate all outputs
30
Dinner for two
5. defuzzify
Various approaches e.g.
centre of area mean of max
31
Graphical Overview (generalised)
32
Mamdani Procedure(overview)
For given values of x and y (using min for AND and maxor OR):
Or max for an ‘or’
i.e. aggregate all thetruncated sets
33
Conceptualising in fuzzy terms
Standard membership functions: single-valued, or singleton triangular trapezoidal S-function (sigmoid function):
• S(u) = 0, u<=a • S(u) = 2((u-a)/(c-a))2 , a <u <= b • S(u) = 1 - 2((u-a)/(c -a))2 , b <u <= c • S(u) = 1, u > c.
34
Conceptualising in fuzzy terms...
more standard membership functions... Z function:
• Z(u)= 1 - S(u) Pi - function: P(u)=S(u), u<=b; P(u)=Z(u), u>b.
Two parameters must be defined for the quantization procedure: the number of the fuzzy labels; the form of the membership functions for
each of the fuzzy labels.
35
Conceptualising in fuzzy terms...
Standard types of membership functions: Z function; n function; S function; trapezoidal function; triangular function; singleton.
36
Conceptualising in fuzzy terms...
One representation for the fuzzy number "about 600".
37
Conceptualising in fuzzy terms...
Representing truthfulness (certainty) of events as fuzzy sets over the [0,1] domain.
38
Fuzzy relations and fuzzy implications...
(a) Membership functions for fuzzy sets for the Smoker
and the Risk of Cancer case example.
(b) The Rc implication relation: "heavy smoker > high risk of cancer" in a matrix form.
39
Fuzzy Sets & Rules – cont’d
Fuzzy rules.
A fuzzy rule can be defined as a conditional statement as below.
IF x is ATHEN y is B
40
Fuzzy Sets & Rules – cont’d
Differences between classical and fuzzy rules.
IF height is > 1.80
THEN select_for_team
In fuzzy rules;IF height is tall
THEN select_for_team
41
Fuzzy Sets & Rules – cont’d
A fuzzy rule can have multiple antecedents.
IF height is tallAND age is smallTHEN select_for_team
Or, another exampleIF service is excellentOR food is deliciousTHEN tip is generous
42
Fuzzy systems
A Fuzzy system consists of: Fuzzy input and output variables Fuzzy rules Fuzzy inference
43
Fuzzy rules
Rule 1: IF (CScore is high) and (CRatio is good) and (CCredit is good) then (Decision is approve)
Rule 2: IF (CScore is low) and (CRatio is bad) or (CCredit is bad) then (Decision is disapprove)
Cscore 150 155 160 165 170 175 180 185 190 195 200
high 0 0 0 0 0 0 .2 .7 1 1 1
low 1 1 .8 .5 .2 0 0 0 0 0 0
Ccredit 0 1 2 3 4 5 6 7 8 9 10
good_cc 1 1 1 .7 3 0 0 0 0 0 0
bad_cc 0 0 0 0 0 0 .3 .7 1 1 1
Cratio .1 .3 .4 .41 .42 .43 .44 .45 .5 .7 1
good_cr 1 1 .7 .3 0 0 0 0 0 0 0
bad_cr 0 0 0 0 0 0 0 . .3 .7 1 1
Decision 0 1 2 3 4 5 6 7 8 9 10
approve 0 0 0 0 0 0 .3 .7 1 1 1
disapprove 1 1 1 .7 .3 0 0 0 0 0 0
44
Fuzzy inference methods
Inputs to a fuzzy system can be: fuzzy, e.g. (Score = Moderate), defined by
membership functions; exact, e.g.: (Score = 190); (Theta = 35),
defined by crisp values Outputs from a fuzzy system can be:
- fuzzy, i.e. a whole membership function. - exact, i.e. a single value is produced .
45
Fuzzy Expert Systems A “fuzzy expert system” is an expert
system that uses a collection of fuzzy membership functions and rules, to reason about data.
Fuzzy logic is primarily used as the underlying logic of Fuzzy Expert systems
46
Fuzzy Expert Systems – cont’d
Fuzzy logic is used to define rules of inference, and membership functions that allow a expert system to draw conclusions
The rules in a fuzzy expert system are usually of a form similar to the following:
if x is low and y is high then z = medium
47
Fuzzy Expert Systems – cont’d
How is Fuzzy Logic used?
Define the control objectives and criteria
Determine the input and output relationships
Use the rule-based structure of FL, break the control problem down into a series of IF X AND Y THEN Z rules
48
Fuzzy Expert Systems – cont’d
How is Fuzzy Logic used?
Create FL membership functions that define the meaning (values) of Input/Output terms used in the rules.
Create the necessary rules.
Test the system, evaluate the results, tune the rules and membership functions, and retest until satisfactory results are obtained.
49
Fuzzy Expert Systems – cont’d
Experts rely on common sense when they solve problems.
Fuzzy logic reflects how people think. It attempts to model our decision making, and our common sense.
Leads to new, more human, intelligent systems.
50
Fuzzy Expert Systems – cont’d
Fuzzy rules of inference are used to form what is commonly referred to as a “knowledge base” which acts as a repository of information from which an expert system can make decisions.
51
Fuzzy Expert Systems – cont’d
Inference process in fuzzy expert systems has four steps. FUZZIFICATION INFERENCE COMPOSITION DEFUZZIFICATION
52
Learning fuzzy rules
Fuzzy data/ Exact dataExact queries/ Fuzzy queries
Fuzzification
Fuzzy inferencemachine
Fuzzy rule base
User interface
Defuzzification
Data base (Fuzzy)
Membership functions
Fuzzy Expert Systems –cont’d
53
Fuzzy Expert Systems – cont’d
Fuzzification : In the fuzzification subprocess, the membership functions defined on the input variables are applied to their actual values, to determine the degree of truth for each rule premise.
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.
54
Fuzzy Expert Systems – cont’d
Composition : All of the fuzzy subsets assigned to each output variable are combined together to form a single fuzzy subset for each output variable.
Defuzzification : Sometimes it is useful to just examine the fuzzy subsets that are the result of the composition process, but more often, this fuzzy value needs to be converted to a single number - a crisp value. This is what the defuzzification subprocess does.
55
Fuzzy Expert Systems – cont’d
56
Fuzzy Expert Systems – cont’d
Fuzzy expert systems can be used in: Pattern Recognition Financial Systems Operation Research Data Analysis
57
Fuzzy systems design
Steps: identify the problem define the input and output variables define the set of fuzzy rules select the fuzzy inference method experiment and validate the system
58
Methods for defuzzification: center of gravity mean of maxima
see Figure 3.26
Methods of defuzzification: the centre of gravity method (COG), and the mean of maxima method (MOM) applied over the same membership function for a fuzzy output variable y. They calculate different crisp output values.
Fuzzy Rules and Fuzzy Inference...