fuzzy logic, fuzzy inference - retis labretis.sssup.it/~giorgio/slides/neural/colla-fuzzy.pdf ·...
TRANSCRIPT
19/03/2014
1
Valentina Colla
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems with applications
2014
Valentina CollaScuola Superiore Sant'Anna
2
Fuzzy logic
Fuzzy inference
Neuro-fuzzy systems
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Outline
Scuola Superiore Sant'Anna
19/03/2014
2
3
Basic conceptsOn fuzzy sets and fuzzy logic
4
Fuzzy logic emerged as a consequence ofthe 1965 proposal of fuzzy set theory byLotfi Zadeh.
→ Fuzzy logic tries to overcome thecriticalities encountered by standard logic(based on the two truth values True andFalse) when describing human reasoning
→ Fuzzy logic uses the extends the conceptsof membership to the whole interval between0 (False) and 1 (True) to describe humanreasoning.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Introduction
Scuola Superiore Sant'Anna
19/03/2014
3
5
The crisp sets approach
Collections of sets from an Universe U in which every set is supposed to be included
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Crisp sets and fuzzy sets
Scuola Superiore Sant'Anna
Universe Any set A (i.e. the blue balls set) can be identified by a characteristic function
A
6
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Crisp sets and fuzzy sets
Scuola Superiore Sant'Anna
The crisp vision of the set of numbers in [5;9]
19/03/2014
4
7
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy sets in practice
It's a problem of age
Scuola Superiore Sant'Anna
Many sets have more than an either-or criterion for membership.
The age problem. Who is young?A one year old baby will clearly be a member of the set, and a 100years old person will not be a member of this set
→ what about people at the age of 20, 30, or 40 years?
young
0 100
8
It is simple to verify the stateman
Water temperature is 27°C
What about the following one?
Is this a pleasant summer day?
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Crisp sets and fuzzy sets
Scuola Superiore Sant'Anna
→ temperature not too high
→ little bit windy
→ sea temperature close to 24°C
Deals with uncertainty, qualitative, non-objective information
19/03/2014
5
9
The fuzzy sets approach
Elements belong to a given set A with a certain degree.
Characteristic functions are substituted by membershipfunctions valued in [0, 1].
A fuzzy subset A of X is defined by its membership functionassigning to every element x of X its degree ofmembership to A
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Crisp sets and fuzzy sets
Scuola Superiore Sant'Anna
10
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Crisp sets and fuzzy sets
Scuola Superiore Sant'Anna
A description of the fuzzy set of real numbers close to 7 could be given by the following figure:
19/03/2014
6
11
A human-like representation of the concepts related to people age.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy sets in practice
It's a problem of age
Scuola Superiore Sant'Anna
12
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Popular membership functions
Scuola Superiore Sant'Anna
Triangular
Trapezoidal
19/03/2014
7
13
Gaussian
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Popular membership functions
Scuola Superiore Sant'Anna
Bell-shaped
14
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Some nomenclature
About MFs
Scuola Superiore Sant'Anna
Example: the average membership function
19/03/2014
8
15
Standard sets theory: basic operations
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Working with sets
Scuola Superiore Sant'Anna
How to extend to fuzzy sets?
16
In standard set theoryThrough the characteristic functions:
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Operations on fuzzy sets
Union
Scuola Superiore Sant'Anna
Set A → A
Set B → B
Characteristic functions suggest the answer
19/03/2014
9
17
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Operations on fuzzy sets
Union
Scuola Superiore Sant'Anna
18
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Operations on fuzzy sets
Intersection
Scuola Superiore Sant'Anna
19/03/2014
10
19
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Operations on fuzzy sets
Complement
Scuola Superiore Sant'Anna
20
Other functions T(·,·) [0,1]x[0,1]→[0,1] can be used to performintersection between fuzzy sets. Some basic requirements:
→ commutativity
→ associativity
→ to be non-decreasing
Objects with such properties are called t-norms.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Operations on fuzzy sets
More on intersection
Scuola Superiore Sant'Anna
xxxxTxxT FSSFFSSF )(),()(),(
xxxxxTTxxTxT QFSQSFQSFQSF ][][)(,)(),()(),(),(
xx QSQF xxTxxTthenxxXxIf QSQFSF ,,
19/03/2014
11
21
Lukasiewicz
Product (usual product)
Godel
Drastic
Frank
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Popular t-norms
Intersection
Scuola Superiore Sant'Anna
22
The concept of membership function allows us to define fuzzysystems in natural language. Direct correspondence betweenlinguistic variables and fuzzy sets.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Linguistic variables
And fuzzy sets
Scuola Superiore Sant'Anna
Fuzzy set Linguistic variable
19/03/2014
12
23
The fuzzy logic invalidate two of the strongholds of the classical logic:
1. Law (or principle) of the excluded third (or Tertium non datur in Latin):
A or not(A) = TRUE
2. Principle of contradiction (or principium contradictionis in Latin):
A and not(A) = FALSE
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Breaking the rules...
Scuola Superiore Sant'Anna
24
Inferencewith fuzzy sets and fuzzy rules
19/03/2014
13
25
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
A fuzzy inference system achieves approximated conclusions on the basis of a set of approximate premises through a set of if-then rules and an inference engine
Standard (canonical) rulesIF (x1 is A1) AND (x2 is A2) AND … (xN is AN) THEN (y is Bj)Sub-casesPartial rules
IF (x1 is A1) AND … AND (xm is Am) THEN (y is Bj) con m<NOR rules
IF (x1 is A1) AND … AND (xm is Am) OR (xm+1 is Am+1) AND … AND (xN is AN) THEN (y is Bj) con m<NEquivalent to two standard rules
26
Rules set is complete if for each x in Ux, one rule at least is active
Rules set is consistent if no rules with the same premise butdifferent consequent exist
Mamdami rules:IF x1 is A1 and x2 is A2 and . . . and xN is AN THENy1 is B1 and y2 is B2 and . . . and yM is BM
Takagi-Sugeno rules:IF x1 is A1 and x2 is A2 and . . . and xN is AN THENy = fk (x1 , x2 , . . . , xN )
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Rules
Scuola Superiore Sant'Anna
19/03/2014
14
27
If x is A then y is B
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
→ A and B are fuzzy sets defined on the universe X and Y (x ∈ X and y ∈ Y)
→ the fuzzy rule defines a relation R on the space X × Y ;→ a fuzzy relation is a fuzzy set defined on several domains:
R = X × Y × Z × ...μ R (x, y , z, . . .)
28
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
Example or relation derived from a rule:
R = A × Bμ R (x, y ) = min (μ A (x), μ B (y ))
Mamdani implication
19/03/2014
15
29
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
Although Mamdani inference type is widely used, it is not theonly one (as for the other logic operators used for fuzzy sets).
30
Given the rule if x is A then y is B corresponding to the fuzzy relation RWhere A and B are fuzzy sets defined on the universe X and Y and x ∈ X , y ∈ Y
How can I produce fuzzy reasoning?
In classical logic:
Modus ponens
Premise: if (x is A) then (y is B)Antecedent: x is A→ Consequent: y is B
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
Modus Tollens
Premise: if (x is A) then (y is B)Antecedent: y is not BConsequent: x is not A
19/03/2014
16
31
Standard modus ponens cannot be used in the fuzzy logic (it works iff the premise is exactly the same as the antecedent of the IF-THEN rule).
Generalized modus ponens allows an inference when the fact is only similar but not equal to it.
Generalized modus-ponensPremise: if (x is A) then (y is B)Antecedent: x is A'Consequent: y is B'
B' (y ) = max (min (μA' (x), μR (x, y)))[max-min composition; max-prod is an alternative]
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Fuzzy inference
Scuola Superiore Sant'Anna
32
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
One rule, one atom
Scuola Superiore Sant'Anna
if (x is A) then (y is C)Calculating the resulting fuzzy set
Modus ponens
Where
Hence
19/03/2014
17
33
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
One rule, two atoms
Scuola Superiore Sant'Anna
if (x1 is A) and (x2 is B) then (y is C)Calculating the resulting fuzzy set
34
When more rules are involved in the inferencesystem, the fuzzy sets resulting as consequentsof each rule must be combined through the so-called aggregation.
Several aggregation operators exist. Mostcommon are min and max
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
Aggregation
Scuola Superiore Sant'Anna
19/03/2014
18
35
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
Aggregation
Scuola Superiore Sant'Anna
36
Defuzzification is the process of producing a quantifiable result in fuzzylogic. A fuzzy quantity is converted into a crisp one (a single number).
Defuzzifier is the system implementing the defuzzification. Several methodsare implemented for defuzzification.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Defuzzification
Scuola Superiore Sant'Anna
Centroid
Min of maximum
Mean of maximum
19/03/2014
19
37
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
To sum up...
Scuola Superiore Sant'Anna
Fuzzyfication
Input variablesCrisp
Rule base
Defuzzyfication
Fuzzy operators Aggregation
Output variablesCrisp
38
→ based on natural language→ can exploit human knowledge and experience→ flexible, immediate, easy→ robustness to unreliable data→ can model complex non linear functions→ can be integrated to adaptive systems (neural networks)→ can be integrated to standard control techniques
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
Some Pros
Scuola Superiore Sant'Anna
19/03/2014
20
39
→ implementing systems with many inputs and outputs is difficult→ requires knowledge on the relation between I/O (memberships, rules)→ membership functions parameters should be carefully tuned→ do not exploit any eventual numerical data
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Fuzzy inference
Some Cons
Scuola Superiore Sant'Anna
40
The problemDecide the amount of the tip on the basis of→ food quality→ service
In crisp terms a 1-10 rating for each criterium is used
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Example
Determining the Tip
Scuola Superiore Sant'Anna
The rules1. If service is BAD or food is AWFUL then tip is LOW2. if service is GOOD then tip is AVERAGE3. if service is EXCELLENT or food is DELICIOUS the tip is HIGH
19/03/2014
21
41
Which fuzzy sets? Just use natural language (and rules)
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Tip example
Step 1: fuzzyfication
Scuola Superiore Sant'Anna
The rules1. If service is BAD or food is AWFUL then tip is LOW2. if service is GOOD then tip is AVERAGE3. if service is EXCELLENT or food is DELICIOUS the tip is HIGH
Service → BAD, GOOD, EXCELLENTFood → AWFUL, DELICIOUS
Tip → LOW, AVERAGE, HIGH
42
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Tip example
Step 1: fuzzyfication
Scuola Superiore Sant'Anna
Tip
Service Food
19/03/2014
22
43
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Tip example
Step 2: Fuzzy inference
Scuola Superiore Sant'Anna
Mamdani implication, max aggregation, centroid defuzzyfication
Sample inference on rule 3
3. if service is EXCELLENT or food is DELICIOUS the tip is HIGH
44
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Tip example
Step 3: aggregation
Scuola Superiore Sant'Anna
1. If service is BAD or food is AWFUL then tip is LOW2. if service is GOOD then tip is AVERAGE3. if service is EXCELLENT or food is DELICIOUS the tip is HIGH
19/03/2014
23
45
Alternative: Mean of maximumTip is 25.1
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems Tip example
Step 4: defuzzyfication
Scuola Superiore Sant'Anna
Centroid (Center Of Gravity - COG)Tip is 21.5
46
Neuro-fuzzy networks
19/03/2014
24
47
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Motivation
Scuola Superiore Sant'Anna
Neuro Fuzzy Systems(aka Fuzzy neural networks)
Artificial neural networkslearning and
connectionist structure
Fuzzy logicHuman-like reasoning
48
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Genealogy
Scuola Superiore Sant'Anna
Neuro Fuzzy Systems(aka Fuzzy neural networks)
Artificial neural networksData exploitation
Training capability
Fuzzy logicfuzzy sets, a linguistic model
IF-THEN fuzzy rules
Universal approximator
19/03/2014
25
49
Critical: determining FISparameters in an efficient mannerby using the sole humanexperience
Approach: use experimental datato tune FIS parameters andminimize prediction error
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
Basic idea
Scuola Superiore Sant'Anna
Data
Fis
Learningalgorithm
+
Optimal parameters
50
ANFIS Artificial Neuro-Fuzzy Inference Systems
→ are a class of adaptive networks that arefuncionally equivalent to fuzzy inference systems.
→ represent Sugeno e Tsukamoto fuzzymodels.
→ use a hybrid learning algorithm
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
ANFIS
Scuola Superiore Sant'Anna
19/03/2014
26
51
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems ANFIS
Sugeno model
Scuola Superiore Sant'Anna
Assume that the fuzzy inference system has two inputs x and y and oneoutput z .
A simple first-order Sugeno fuzzy model has rules as the following:
• Rule1:If x is A1 and y is B1 , then f1 = p1 x + q1 y + r1• Rule2:If x is A2 and y is B2 , then f2 = p2x + q2y + r2
RECALLMamdami rules:IF x1 is A1 and x2 is A2 and . . . and xN is AN THEN y1 is B1 and y2 is B2 and . . . and yM is BM
Takagi-Sugeno rules:IF x1 is A1 and x2 is A2 and . . . and xN is AN THEN y = fk (x1 , x2 , . . . , xN )
52
Output of the Sugeno model (for a given x, y):
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems ANFIS
Sugeno model
Scuola Superiore Sant'Anna
1111 ryqxpf
2222 ryqxpf
19/03/2014
27
53
Corpo della slide
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
ANFIS Structure
Scuola Superiore Sant'Anna
54
Layer 1
→ Ol,i is the output of the ith node of the layer l .
Every node i in this layer returns the membership degree of the input crisp variable with respect to the associated fuzzy set
Typical membership function:
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
ANFIS Structure
Scuola Superiore Sant'Anna
Parameters: ai, bi, ciPremise parameters
19/03/2014
28
55
Layer 2
Every node in this layer performs product of all incoming signals:→ O2,i = w i = μAi(x) · μ Bi(y), i = 1, 2→ Each node represents the fire strength of the rule→ Any other T-norm operator that performs the AND operator canbe used
Layer 3
Every node returns the normalized firing strength for thecorresponding rule
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
ANFIS Structure
Scuola Superiore Sant'Anna
56
Layer 4
Every node i in this layer is an adaptive node which returns
Introducing three more parameters (called consequent parameters) → pi, qi, ri
Layer 5
Overall output is calculated
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems
ANFIS Structure
Scuola Superiore Sant'Anna
19/03/2014
29
57
The ANFIS can be trained by a hybrid learning Algorithm derived(and very similar) from the ANN back-propagation
As back-propagation, it works in two passes:• In the forward pass the algorithm uses least-squares method toidentify the consequent parameters on the layer 4.• In the backward pass the errors are propagated backward and thepremise parameters are updated by gradient descent.
Fuzzy logic, fuzzy inferenceAnd neuro-fuzzy systems ANFIS
Training algorithm
Scuola Superiore Sant'Anna
Thank you for Your attention!