0% found this document useful (0 votes)
10 views29 pages

CS235 Artificial Intelligence 10

Fuzzy Logic (FL) is a reasoning method that mimics human decision-making by allowing for degrees of truth between binary values. It is applied in various practical fields, enabling systems to manage uncertainty through fuzzy sets and rules. Fuzzy Inference Systems (FIS) utilize fuzzy rules to process inputs and produce outputs, incorporating linguistic variables to enhance human-like reasoning.

Uploaded by

lalit24027
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views29 pages

CS235 Artificial Intelligence 10

Fuzzy Logic (FL) is a reasoning method that mimics human decision-making by allowing for degrees of truth between binary values. It is applied in various practical fields, enabling systems to manage uncertainty through fuzzy sets and rules. Fuzzy Inference Systems (FIS) utilize fuzzy rules to process inputs and produce outputs, incorporating linguistic variables to enhance human-like reasoning.

Uploaded by

lalit24027
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Artificial Intelligence

CS

Kaustuv Nag

/
Fuzzy Logic in Artificial Intelligence

▶ Fuzzy Logic (FL) is a method of reasoning that resembles human reasoning.


▶ The approach of FL imitates the way of human decision-making that involves all
intermediate possibilities between digital values YES and NO.
▶ Unlike computers, human decision-making includes a range of possibilities between
YES and NO, such as
▶ CERTAINLY YES
▶ POSSIBLY YES
▶ CANNOT SAY
▶ POSSIBLY NO
▶ CERTAINLY NO

/
Use of Fuzzy Logic

▶ Fuzzy logic is useful for commercial and practical purposes.


▶ It can control machines and consumer products.
▶ It may not give accurate reasoning, but acceptable reasoning.
▶ Fuzzy logic helps to deal with the uncertainty in engineering.

/
Fuzzy Logic Systems Architecture

Rules

Crisp Crisp
Fuzzifier Defuzzifier
Input Output

Intelligence
Fuzzy Input Set Fuzzy Output Set

/
Classical Set (Crisp Set)
▶ A classical set is a collection of distinct objects. For example, a set of students, a set
of even numbers etc.
▶ Each individual entity in a set is called a member or an element of the set.
▶ The classical set is defined such that the universe of discourse is split into two
groups: members and non-members. Hence, no partial membership exists.
▶ For example:
▶ A = {a1 , a2 , a3 , a4 }
▶ A = {2, 4, 6, 8}
Expressing the second example using a formula:
A = {x | x is an even natural number}
▶ Using a membership function µA (x), the membership value of an element x in a
crisp set A is: (
1 if x ∈ A
µA (x) =
0 if x ∈
/A
/
Fuzzy Sets
▶ Fuzzy set theory introduces vagueness (ambiguity) using the concept of a
membership function.
▶ Membership value µÃ (y) permits any value between [0, 1].
▶ Formal representation of a fuzzy set Ã:
à = {(y, µÃ (y)) | y ∈ U }.

▶ U is the universe of discourse.


▶ µÃ (y) is the membership value of element y in the fuzzy set Ã.
▶ Common shapes for membership functions: µ
▶ Triangular (most common).
▶ Trapezoidal. Membership function of Ã
▶ Singleton.
▶ Gaussian. 1

0 y /
Example for Fuzzy Set

▶ Let the universe of discourse be U = {a1 , a2 , a3 , a4 , a5 }.


▶ Examples of fuzzy sets over U :
. A = {(a1 , 0.4), (a2 , 0.7), (a3 , 0), (a4 , 0.1), (a5 , 1)}
. B = {(a1 , 0.2), (a2 , 0.6), (a3 , 0.2), (a4 , 0.1), (a5 , 0.8)}
. C = {(a1 , 0), (a2 , 1), (a3 , 0), (a4 , 1), (a5 , 0)}
▶ What is the corresponding crisp set representation for fuzzy set C?
▶ A crisp set contains only elements with full membership (value = 1).
▶ For fuzzy set C, the elements a2 and a4 have membership value 1.
Ccrisp = {a2 , a4 }

/
An Example for Fuzzy Set: Age
Young Middle-Aged Old

Membership, µ
.

“Age”

▶ Human age groups illustrated as fuzzy sets (“Young,” “Middle-Aged,” “Old”) with
corresponding membership functions (µ).
▶ Example: The set “Young” might include ages 0 to 37. Membership µ could be 1 up
to age 23, then decrease linearly to 0 by age 37. An age of 30 might have µ = 0.5 in
“Young”.
▶ Solid lines: Fuzzy membership functions. Dashed lines: Example of a crisp
(non-fuzzy) definition for “Young” (e.g., ages 0 to 30).
▶ Any specific age may belong to multiple sets (e.g., “Young” and “Middle-Aged”) but
with different membership values.
/
Operations on Fuzzy Sets
▶ Let A and B be fuzzy sets in universe U (A, B ⊆ U ), and u ∈ U .
▶ Standard complement (¬A or Ā):

µ¬A (u) = 1 − µA (u).

▶ Standard intersection (A ∩ B):

µA∩B (u) = min{µA (u), µB (u)} (Fuzzy AND).

▶ Standard union (A ∪ B):

µA∪B (u) = max{µA (u), µB (u)} (Fuzzy OR).

▶ Example: Let A = {(x1 , 0.5), (x2 , 0.7)} and B = {(x1 , 0.8), (x2 , 0.2)}.
▶ Complement (¬A): ¬A = {(x1 , 1 − 0.5), (x2 , 1 − 0.7)} = {(x1 , 0.5), (x2 , 0.3)}.
▶ Intersection:
A ∩ B = {(x1 , min{0.5, 0.8}), (x2 , min{0.7, 0.2})} = {(x1 , 0.5), (x2 , 0.2)}.
▶ Union: A ∪ B = {(x1 , max{0.5, 0.8}), (x2 , max{0.7, 0.2})} = {(x1 , 0.8), (x2 , 0.7)}.
/
Triangular Fuzzy Membership Function
▶ Defined by three parameters: a, b, c.


 0 if x ≤ a



 x−a
b−a if a < x ≤ b
µtri (x; a, b, c) =

 c−x
if b < x < c

 c−b

0 if x ≥ c

▶ max(0, min( x−a c−x


b−a , c−b )) is another form.

1.0

µA (x)

a b c

/
Gaussian Fuzzy Membership Function
▶ Defined by center c, width s, and sometimes fuzzification factor m.
▶ A common form (with m = 2 implicitly):
 2 !
1 x−c
µgauss (x; c, s) = exp −
2 s
▶ Generalized form from slide (with factor m):
 m
1 x−c
µ(x; c, s, m) = exp −
2 s
1
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10 /
Introducing Linguistic Variables

▶ We often want to use natural language terms like ‘young’, ‘not young’, ‘middle age’,
‘possibly yes’, ‘possibly no’ etc. in our knowledge-base or rule-base.
▶ Linguistic variables allow us to represent and use these terms, incorporating
vagueness/ambiguity into rules.

/
Linguistic Variable: Definition and Examples

▶ A linguistic variable is a variable whose values are words or sentences in a natural


language (called linguistic terms).
▶ Examples:
. Height can be a linguistic variable.
▶ Linguistic values (terms): tall, very tall, medium, short, etc.
▶ ‘Tall’ itself is a linguistic value or primary term. Modifiers like ‘very’ can be applied.
. Age can be a linguistic variable.
▶ The set of terms T(age) could be: {young, not young, middle aged, old, very old, etc.}
▶ Each term (e.g., ‘young’) corresponds to a fuzzy set.
▶ Every member of the term set is a linguistic term, covering some portion of the
overall range of values (e.g., the range of possible ages).

/
Fuzzy Rules

▶ Fuzzy rules help model human-like reasoning and perception.


▶ The common fuzzy if-then rule structure is:
“IF x is A THEN y is B.”
▶ x, y are variables (often linguistic variables).
▶ A, B are linguistic values (fuzzy sets) defined over the universes of discourse for x and
y.
▶ “x is A” is the antecedent (premise or condition).
▶ “y is B” is the consequent (conclusion).

/
Examples: Fuzzy Rules

▶ Consider the rule: “IF pressure is high THEN volume is small”


▶ Here, ‘pressure’ (x) and ‘volume’ (y) are variables.
▶ ‘high’ (A) and ‘small’ (B) are linguistic values represented by fuzzy sets.
▶ The rule can be written as: IF x is A THEN y is B.
▶ If we have a specific input value for pressure (x), we can calculate its membership value
µA (x) in the fuzzy set ‘high’ using its pre-defined membership function. This value
indicates the degree to which the antecedent is true.

/
Fuzzy Inference System (FIS)
▶ Fuzzy Inference Systems (FIS) take inputs, process them using fuzzy reasoning based
on fuzzy rules, and produce outputs.
▶ Inputs and outputs are typically crisp (real-valued) numbers, while the internal
processing uses fuzzy sets, fuzzy logic, and fuzzy rules.
▶ Basic structure includes three main components:
. Rule Base: Contains the collection of fuzzy IF-THEN rules.
. Database (Dictionary): Defines the membership functions (MFs) for the fuzzy sets used
in the rules.
. Reasoning Mechanism (Inference Engine): Performs the inference procedure based on
the rules and input facts to derive a conclusion or output.

Rule Base Database


(Fuzzy Rules) (Membership Functions)

Input Output

Fuzzy Reasoning

/
Structure of Fuzzy Inference Systems (FISs)
Provided by Experts
or Extracted from
Numerical Data

Activates the Provides a Crisp


Rules
Linguistic Rules Output Value

Crisp Crisp
Fuzzification Defuzzification
Input Output

Inference
Fuzzy Set of Input Variables Fuzzy Output Set

. Maps fuzzysets into fuzzysets


. Determines how the rules are activated and combined
/
Structure of Fuzzy Inference Systems (FISs)

▶ Fuzzification: Maps crisp inputs to fuzzy sets (degrees of membership).


▶ Inference: Applies fuzzy rules based on fuzzified inputs. Determines how rules are
activated and combines their results.
▶ Defuzzification: Maps the resulting output fuzzy set back to a crisp output value.
▶ Rules can be provided by experts or extracted from data.

/
Popular Models of Fuzzy Inference Systems (FISs)

▶ Popular Fuzzy Inference System models include:


▶ Mamdani Fuzzy Models (and Assilian).
▶ Sugeno Fuzzy Models (or Takagi-Sugeno-Kang, TSK).
▶ Tsukamoto Fuzzy Models.
▶ The primary differences between these models lie in:
▶ The format of the consequents (THEN part) of their fuzzy rules.
▶ Consequently, their methods for rule aggregation and defuzzification differ.

/
Mamdani Inference System

▶ The Mamdani model is the most commonly used fuzzy inference technique.
▶ It typically performs inference in four main steps:
. Fuzzification of input variables.
. Rule evaluation (applying fuzzy operators for antecedents and implication).
. Aggregation of rule outputs (combining results from all relevant rules).
. Defuzzification (converting the aggregated fuzzy output to a crisp number).

Example Application
Design a Mamdani FIS to predict risk in a project funding system.
▶ Inputs: Project Funding (pf ), Project Staffing (ps ) (crisp values).
▶ Output: Risk Prediction (e.g., linguistic values like low/normal/high, or a crisp value
after defuzzification).

/
Knowledge Base for the FIS: Example
▶ Crisp Inputs: x (for pf ), y (for ps ). Crisp Output: z (for risk).
▶ Linguistic Variable: Project Funding (pf )
▶ Terms/Fuzzy Sets: Inadequate (A1 ), Marginal (A2 ), Adequate (A3 ).
▶ Linguistic Variable: Project Staffing (ps )
▶ Terms/Fuzzy Sets: Small (B1 ), Large (B2 ).
▶ Linguistic Variable: Risk (z)
▶ Terms/Fuzzy Sets: Low (C1 ), Normal (C2 ), High (C3 ).
▶ Pre-specified membership functions exist for each fuzzy set
(A1 , A2 , A3 , B1 , B2 , C1 , C2 , C3 ).
Rule Base Example
. IF pf is Adequate (A3 ) OR ps is Small (B1 ) THEN Risk is Low (C1 ).
(IF x is A3 OR y is B1 THEN Z is C1 )
. IF pf is Marginal (A2 ) AND ps is Large (B2 ) THEN Risk is Normal (C2 ).
(IF x is A2 AND y is B2 THEN Z is C2 )
. IF pf is Inadequate (A1 ) THEN Risk is High (C3 ).
(IF x is A1 THEN Z is C3 )
/
Fuzzy Sets Defined Over Input/Output Variables

µA1 (x) µA2 (x) µA3 (x) µB1 (y) µB2 (y) µC1 (z) µC2 (z) µC3 (z)

x y z
Figure: Membership functions for Input x (Funding: A1 , A2 , A3 ), Input y (Staffing: B1 , B2 ), and
Output z (Risk: C1 , C2 , C3 ).

/
Designing FIS - Step : Fuzzification
▶ Convert crisp input values into degrees of membership in the relevant fuzzy sets.
▶ Example: Take crisp inputs for Project Funding (x1 ) and Project Staff (y1 ).
▶ Use the defined membership functions to find the membership values.
Example results from the graph:
▶ For input x1 : µA1 (x1 ) = 0.5, µA2 (x1 ) = 0.2, µA3 (x1 ) = 0.0.
▶ For input y1 : µB1 (y1 ) = 0.1, µB2 (y1 ) = 0.7.

µA1 (x) µA2 (x) µA3 (x) µB1 (y) µB2 (y)

.
.

.
.
x1 x y1 y

Figure: Example Fuzzification Step: Finding membership values for crisp inputs x1 and y1 . /
Step : Rule evaluation - Antecedent
▶ Determine the degree to which the antecedent (IF part) of each rule is satisfied by
the current inputs.
▶ If a rule’s antecedent has multiple parts connected by fuzzy operators (AND, OR):
▶ Apply the corresponding fuzzy operation to the membership values obtained during
fuzzification.
▶ The result is a single number representing the rule’s antecedent truth value (firing
strength).
▶ Evaluating operators (using standard fuzzy logic):
▶ OR (Disjunction): Typically uses the maximum operator. For antecedent “X is A OR Y
is B”:
Truth Value = max[µA (X), µB (Y )]
▶ AND (Conjunction): Typically uses the minimum operator. For antecedent “X is A AND
Y is B”:
Truth Value = min[µA (X), µB (Y )]

/
Mamdani Style of Rule Evaluation for Project System I

Figure: Calculating the firing strength for each rule using the fuzzified inputs and fuzzy operators
(min for AND, max for OR).
/
Mamdani Style of Rule Evaluation for Project System II

Rule Firing Strengths: µA1 = 0.5, µA2 = 0.2, µA3 = 0.0, µB1 = 0.1, µB2 = 0.7
▶ Rule (A OR B ): max(0.0, 0.1) = 0.1.
▶ Rule (A AND B ): min(0.2, 0.7) = 0.2.
▶ Rule (A ): 0.5 (single antecedent)

/
Step : Rule evaluation - Fuzzy Implication
▶ Apply the calculated firing strength of each rule to its consequent (THEN part). This
reshapes the consequent’s fuzzy set.
▶ The result of this step is one output fuzzy set for each rule, shaped by its firing
strength.
▶ Mamdani Implication Methods:
Clipping (min): The consequent Scaling (prod): The consequent
membership function is truncated (cut off) membership function is scaled (multiplied)
at the level of the firing strength. (Most by the firing strength.
common). 1
1 µC2 (z)
µC2 (z)

0.2 µR2 (z)


0.2 µR2 (z)
0 z
z Scaling
0
Clipping
/
µC1 (z)
Step : Aggregation of Rules 1

▶ Unify the output fuzzy sets from all contributing µR1 (z)

rules into a single aggregate fuzzy set 0 z

representing the overall conclusion. µC2 (z)


1
▶ Input: The clipped or scaled consequent
µR2 (z)
membership functions from each rule.
▶ Output: One combined fuzzy set for the output 0 z

variable. µC2 (z)


1
▶ Common Method (max): The membership value µR3 (z)

of the aggregate set at any point z is the


maximum of the membership values of the 0 z

individual rule output sets at that point z. µC1 (z) µC2 (z) µC2 (z)
1
µAGG (z)
µAGG (z) = max[µR1 (z), µR2 (z), µR3 (z), ...]

0 z

/
Step : Defuzzification
▶ Convert the final aggregate fuzzy set (which represents the fuzzy conclusion) into a
single crisp output number.
▶ Input: The aggregate output fuzzy set. Output: A single crisp value.
▶ Methods: Many exist (Mean of Maximum, Bisector, etc.).
▶ Centroid (Center of Gravity - COG): Most popular method. Finds the point on the
x-axis (z) that represents the “center of mass” or “balance point” of the aggregate
fuzzy set.
R
▶ For a continuous set, COG = Rz·µAGG (z)dz .
µAGG (z)dz
▶ For discrete points or sampled representation:
P
zi · µAGG (zi )
COG = P
µAGG (zi )

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy