You are on page 1of 41

Course : Artificial Intelligence

Effective Period : September 2018

Fuzzy Systems

Session 7

1
Learning Outcomes
At the end of this session, students will be able to:

• LO 3: Explain how to use knowledge representation in


reasoning purpose

2
Outline
1. Introduction
2. Fuzzy Sets
3. Membership Function
4. Fuzzy Logic
5. Linguistic Variable
6. Fuzzy Rules
7. Fuzzification
8. Inferencing
9. Defuzzification
3
Introduction
• Traditional set theory requires elements to be either part of a
set or not.

• Similarly, binary-valued logic requires the values of parameters


to be either 0 or 1, with similar constraints on the outcome of
an inferencing process

• Human reasoning is, however, almost always not this exact.

• Our observations and reasoning usually include a measure of


uncertainty.

4
Introduction
• For example, humans are capable of understanding the
sentence: “Some Computer Science students can program
in most languages”.

• But how can a computer represent and reason with this fact?

5
Fuzzy Sets and Fuzzy Logic
• Fuzzy sets and fuzzy logic allow what is referred to as
approximate reasoning.

• With fuzzy sets, an element belongs to a set to a certain


degree of certainty.

• Fuzzy logic allows reasoning with these uncertain facts to


infer new facts, with a degree of certainty associated with each
fact.

• Fuzzy sets and logic allow the modeling of common sense.

6
Applications of Fuzzy Systems
• Control Systems

• Gear Transmission and Braking System in Vehicles

• Controlling Lifts

• Home Appliances

• Controlling Traffic Signals

• Etc

7
Fuzzy Sets
• Fuzzy sets are an extension of crisp (two-valued) sets to
handle the concept of partial truth, which enables the
modeling of the uncertainties of natural language.

• Different to classical sets, elements of a fuzzy set have


membership degrees to that set.

• The degree of membership to a fuzzy set indicates the


certainty (or uncertainty) that the element belongs to that set.

8
Fuzzy Sets
• Suppose 𝑋 is the domain, or universe of discourse, and 𝑥 ∈ 𝑋
is a specific element of the domain 𝑋

• The fuzzy set 𝐴 is characterized by a membership mapping


function:
𝝁𝑨 : 𝑿 → [𝟎, 𝟏]

• Therefore, for all 𝑥 ∈ 𝑋 , 𝜇𝐴 (𝑥) indicates the certainty to which


element 𝑥 belongs to fuzzy set 𝐴

• For two-valued sets, 𝜇𝐴 (𝑥) is either 0 or 1


9
Fuzzy Sets
• Fuzzy sets can be defined for discrete (finite) or continuous
(infinite) domains.

• The notation used to denote fuzzy sets differ based on the type
of domain over which that set is defined.

10
Fuzzy Sets
• In the case of a discrete domain 𝑋, the fuzzy set can either be
expressed in the form of an 𝑛𝑥 -dimensional vector or using the
sum notation.

• If 𝑋 = 𝑥1 , 𝑥2 , … , 𝑥𝑛 , then:
𝑛𝑥
𝐴 = σ𝑖=1 𝜇𝐴 𝑥𝑖 / 𝑥𝑖

• where the sum should not be confused with algebraic


summation. The use of sum notation above simply serves as
an indication that 𝐴 is a set of ordered pairs.

11
Fuzzy Sets
• In the case of a continuous domain 𝑋, 𝐴 is denoted as:

𝐴 = න 𝜇 𝑥 /𝑥
𝑥

• the integral notation should not be algebraically interpreted

12
Membership Function
• A membership function is the essence of fuzzy sets and
referred to as the characteristic function of the fuzzy set which
defines the fuzzy set

• Membership function is used to associate a degree of


membership of each of the elements of the domain to the
corresponding fuzzy set.

• Membership functions for fuzzy sets can be of any shape or


type as determined by experts in the domain over which the
sets are defined.
13
Membership Function

• Consider the domain 𝑋 of all floating-point numbers in the


range 0,100 . Define the crisp set 𝐴 ⊂ 𝑋 of all floating-point
numbers in the range [10,50].
• Then, the membership function for the crisp set 𝐴 is:

• All 𝑥 ∈ [10,50] have 𝜇𝐴 𝑥 = 1,


• while all other floating-point numbers have 𝜇𝐴 𝑥 = 0 .
14
Constraint of Membership Function
• A membership function must satisfy the following constraints:

– A membership function must be bounded from below by 0


and from above by 1.

– The range of a membership function must therefore be


[0,1].

– For each 𝑥 ∈ 𝑋, 𝜇𝐴 𝑥 must be unique. The same element


cannot map to different degrees of membership for the
same fuzzy set

15
Example of Membership Function
• For a tall fuzzy set, a possible membership function can be
defined as:

Assume that a person has


a height of 1.75 m, then
𝜇𝐴 1.75 = 0.5

16
Membership Functions
• While the previous tall membership function uses a discrete tap
step function, more complex discrete and continuous function can
be used:
– Triangular function
– Trapezoidal function
– T-membership function
– S-membership function
– Logistic function
– Exponential-like function
– Gaussian function

17
Fuzzy Operators
• As for crisp sets, relations and operators are defined for fuzzy
sets.
• Let X be the domain, or universe, and A and B are fuzzy sets
defined over the domain X.
– Equality of fuzzy sets
– Containment of fuzzy sets:
– Complement of a fuzzy set (NOT)
– Intersection of fuzzy sets (AND)
– Union of fuzzy sets (OR)

18
Fuzzy Logic
• Fuzzy Logic can be defined as logical system, which is an
extension if multi-valued logic that is intended to serve as a
logic for approximate reasoning

• The two most important concepts within Fuzzy Logic is a


linguistic variable and fuzzy if-then rule

19
Linguistic Variable
• Linguistic variable (fuzzy variable) are variables with values that
are words or sentences from natural language.

• For example, referring to the set of tall people, tall is a linguistic


variable.

• Sensory inputs are linguistic variables, or nouns in a natural


language, for example: temperature, pleasure, displacement, etc.

• Linguistic variables allow the translation of natural language into


logical or numerical statements, which provide the tools for
approximate reasoning.

20
Linguistic Variable
• Linguistic can be divided into different categories:

– Quantification variables (e.g. all, most, many, none, etc)

– Usuality variables (e.g. sometimes, frequently, always,


seldom, etc)

– Likelihood variables (e.g. possible, likely, certain, etc)

• In natural language, nouns are frequently combined with


adjectives for quantifications of these nouns.

• In fuzzy system theory, these adjectives are referred to as


hedges
21
Linguistic Variable - Hedges
• A hedge serves as a modifier of fuzzy values

• Hedges are implemented through subjective definitions of


mathematical functions, to transform membership values in a
systematic manner.

22
Linguistic Variable - Hedges
• Example:
• Assume the membership function 𝜇𝑡𝑎𝑙𝑙 characterizes the degree
of membership of elements to the set of tall. If we create a new
set, very_tall of people , that are very tall, the hedge can be
2
implemented as the square function or 𝜇𝑣𝑒𝑟𝑦_𝑡𝑎𝑙𝑙 𝑥 = 𝜇𝑡𝑎𝑙𝑙 𝑥
• Hence, if Peter belongs to the set tall with certainty 0.9, then he
also belongs to the set very tall with certainty 0.81
• This makes sense according to our natural understanding of the
phrase very tall: Degree of membership to the set very tall should
be less than membership to the set tall.
23
Fuzzy Rules
• For fuzzy systems in general, the dynamic behavior of that system is
characterized by a set of linguistic fuzzy rules.
• These rules are based on the knowledge and experience of a human
expert within that domain.
• Fuzzy rules are of the general form : if antecedent(s) then
consequent(s)
• or can be expressed as: if A is a and B is b then C is c
• where A and B are fuzzy sets with universe of discourse X1, and C is a
fuzzy set with universe of discourse X2.
• Therefore, the antecedent of a rule form a combination of fuzzy sets
through application of the logic operators (i.e. complement, intersection,
union).
24
Fuzzy Rule-Based Reasoning System

25
Fuzzy Rule-Based Reasoning System
• Together, the fuzzy sets and fuzzy rules form the knowledge
base of a fuzzy rule-based reasoning system.

• In addition to the knowledge base, a fuzzy reasoning system


consists of three other components, each performing a specific
task in the reasoning process, i.e. fuzzification, inferencing
and defuzzification

26
Fuzzification
• The antecedents of the fuzzy rules form the fuzzy “input space,” while
the consequents form the fuzzy “output space”
• The input space is defined by the combination of input fuzzy sets, while
the output space is defined by the combination of output sets
• The fuzzification process is concerned with finding a fuzzy representation
of non-fuzzy input values.
• This is achieved through application of the membership functions
associated with each fuzzy set in the rule input space
• That is, input values from the universe of discourse are assigned
membership values to fuzzy sets.

27
Inferencing
• The task of the inferencing process is to map the fuzzified inputs
(as received from the fuzzification process) to the rule base, and
to produce a fuzzified output for each rule.
• For the consequents in the rule output space, a degree of
membership to the output sets are determined based on the
degrees of membership in the input sets and the relationships
between the input sets
• The relationships between input sets are defined by the logic
operators that combine the sets in the antecedent.
• The output fuzzy sets in the consequent are then combined to
form one overall membership function for the output of the rule.
28
Inferencing
• Assume input fuzzy sets A and B with universe of discourse X1 and the
output fuzzy set C with X2 as universe of discourse.
• Consider the rule if A is a and B is b then C is c
• From the fuzzification process, the inference engine knows μ𝐴 𝑎 and
μ𝐵 𝑏

• The first step of the inferencing process is then to calculate the firing
strength of each rule in the rule base, which is achieved through
combination of the antecedent sets using the operators

• Assuming the min-operator, the firing strength for the above example is
𝑚𝑖𝑛 μ𝐴 𝑎 , μ𝐵 𝑏
• For each rule k, the firing strength 𝑎𝑘 is thus computed.
29
Inferencing
• The next step is to accumulate all activated outcomes. During this
step, one single fuzzy value is determined for each 𝑐𝑖 ∈ 𝐶.
• The final fuzzy, associated with 𝛽𝑖 , associated with each outcome
of 𝑐𝑖 , is computed using the max-operator

𝛽𝑖 = max 𝛼𝑘𝑖
∀𝑘

• Where 𝛼𝑘𝑖 is the firing strength of rule 𝑘, which has the outcome
of 𝑐𝑖
• The end result of the inferencing process is a series of fuzzified
output values.
• Rules that are not activated have a zero firing strength.
30
Inferencing
• Rules can be weighted a priori with a factor (in the range [0,1]),
representing the degree of confidence in that rule.

• These rule confidence degrees are determined by the human


expert during the design process.

31
Defuzzification
• The firing strengths of rules represent the degree of
membership to the sets in the consequent of the
corresponding rule.

• Given a set of activated rules and their corresponding firing


strengths, the task of the defuzzification process is to convert
the output of the fuzzy rules into a scalar, or non-fuzzy value.

32
Defuzzification

• Suppose the following hedges are defined for linguistic variable C, for
the definition of the membership functions:

• large decrease (LD), slight increase (SI), no change (NC), slight


increase (SI), and large increase (LI).

• The illustration can be seen in the following figure:

33
Defuzzification
• Several inference methods exist to find an approximate scalar
value to represent the action to be taken:

– The max-min method

– The averaging method

– The root-sum-square method

– The clipped center of gravity method

34
Defuzzification –
The max-min
method
• The max-min method:

• The rule with the largest firing strength is selected, and it is


determined which consequent membership function is
activated.

• The centroid of the area under that function is calculated and


the horizontal coordinate of that centroid is taken as the output
of the controller.
35
Defuzzification –
The averaging
method
• The averaging method:
• For this approach, the average rule firing strength is calculated,
and each membership function is clipped at the average.
• The centroid of the composite area is calculated and its
horizontal coordinate is used as output of the controller.
• All rules therefore play a role in determining the action of the
controller.
36
Defuzzification –
The root-sum
-square method

• The root-sum-square method:


• Each membership function is scaled such that the peak of the
function is equal to the maximum firing strength that
corresponds to that function.
• The centroid of the composite area under the scaled functions
are computed and its horizontal coordinate is taken as output
37
Defuzzification –
The clipped center
of gravity method

• The clipped center of gravity method:

• For this approach, each membership function is clipped at the


corresponding rule firing strengths.

• The centroid of the composite area is calculated and the


horizontal coordinate is used as the output of the controller.

38
Defuzzification
• The calculation of the centroid of the trapezoidal areas
depends on whether the domain of the functions is discrete or
continuous.

• For a discrete domain of a finite number of values,𝑛𝑥 , the


output of the defuzzification process is calculated as:

(σ has its algebraic meaning)


39
Defuzzification
• In the case of a continuous domain,

• ‫ ׬‬has its algebraic meaning

• where X is the universe of discourse

40
References
• Andries P. Engelbrecht. 2007. Computational Intelligence:
An Introduction. Wiley. ISBN: 978-0-470-03561-0

41

You might also like