Docsity

Understanding Fuzzy Logic: Capturing Vague Concepts with Degrees of Membership, Slides of Artificial Intelligence

Toggle sidebar
bg1
1
Fuzzy ES
What is fuzzy logic?
• Words (and the thoughts they describe) are
often vague and imprecise: How hot is ā€œhotā€?
How tall is ā€œtallā€?
• Even more concrete concepts are not
necessarily black and white. What makes a chair
a chair?
• Fuzzy logic attempts to capture the idea of
degrees of membership in a class. Contrast with
Boolean logic, in which membership is absolute.
• Class question: What makes a chair a chair?
www.moosemaple.com/ www.johnston.k12.ia.us
www.greenwoodworking.com
www.backstreet.demon.co.uk www.petdiscounters.com
Which of these is the most ā€œchair-likeā€? What features make a chair a chair?
Classical (ā€œcrispā€) sets
If X is the universe of discourse (also called the finite
reference super set), with elements x, then the
characteristic function of crisp set A is:
1,0:)(
→
Xxf
A
Where:



=0
1
)(xf
AAx
A
x
āˆ‰
∈
Fuzzy sets
]1,0[:)(
→
Xx
A
µ
If X is the universe of discourse, with
elements x, then the characteristic function
of fuzzy set A is:
Where:
If x is totally in A
If x is totally not in A
If x is partially in A
1)(0
0)(
1)(
<<
=
=
x
x
x
A
A
A
µ
µ
µ
Defining fuzzy sets with fit
vectors
A can be defined as:
Where linear fit functions join the points given in the set definition.
So, for example:
Tall men = (0/180, 1/190)
Short men=(1/160, 0/170)
Average men=(0/165,1/175,0/185)
}/)(}...{/)({A
11A nnA
xxxx
µµ
=
pf3
pf4
pf5

Partial preview of the text

Download Understanding Fuzzy Logic: Capturing Vague Concepts with Degrees of Membership and more Slides Artificial Intelligence in PDF only on Docsity!

Fuzzy ES

What is fuzzy logic?

  • Words (and the thoughts they describe) are often vague and imprecise: How hot is ā€œhotā€? How tall is ā€œtallā€?
  • Even more concrete concepts are not necessarily black and white. What makes a chair a chair?
  • Fuzzy logic attempts to capture the idea of degrees of membership in a class. Contrast with Boolean logic, in which membership is absolute.
  • Class question: What makes a chair a chair?

www.moosemaple.com/ www.johnston.k12.ia.us

www.greenwoodworking.com

www.backstreet.demon.co.uk (^) www.petdiscounters.com

Which of these is the most ā€œchair-likeā€? What features make a chair a chair?

Classical (ā€œcrispā€) sets

If X is the universe of discourse (also called the finite reference super set) , with elements x, then the characteristic function of crisp set A is:

f (^) A ( x ): X → 0 , 1 Where:







0

1 f (^) A ( x ) x A

x A

āˆ‰

∈

Fuzzy sets

μ A ( x ): X →[ 0 , 1 ]

If X is the universe of discourse , with elements x, then the characteristic function of fuzzy set A is:

Where: If x is totally in A If x is totally not in A 0 ( ) 1 If x is partially in A

x

x

x

A

A

A

μ

μ

μ

Defining fuzzy sets with fit vectors A can be defined as:

Where linear fit functions join the points given in the set definition. So, for example: Tall men = (0/180, 1/190) Short men=(1/160, 0/170) Average men=(0/165,1/175,0/185)

A ={μA ( x 1 )/ x 1 }...{ μ A ( xn )/ xn }

Graphical representation of set definition

short average tall

0

Degree of membership 1

Height

160165 170 180 185 190

What if key features don’t have a

scale?

  • Determine list of binary features (either present or absent)
  • Determine weight (importance) of each feature
  • Sum over weights, and normalize
  • This gives your membership function! Class exercise: develop a membership function for ā€œchairā€.

Hedges

Hedges are fuzzy set qualifiers, and modify the shape of the set. Can be:

  • Truth values: e.g. quite true, mostly false
  • Probabilities: e.g. likely, unlikely
  • Quantifiers: e.g. most, several, few
  • Possibilities: e.g. almost impossible, quite possible

Interpretations of hedges

Hedges are given mathematical interpretations, for example, the operation of concentration (i.e. making the set smaller):

2 4

3

2

( ) [ ( )] [ ( )]

( ) [ ( )]

( ) [ ( )]

x x x

x x

x x

A

very A

veryvery A

A

extremely A

A

very A

μ μ μ

μ μ

μ μ

= =

=

=

Interpretation of hedges (2)

Also, operations of dilation (i.e. make set bigger):

( x ) (^) A ( x )

moreorless μ (^) A = μ And operations of intensification (exaggerates the extremes of the set):

2

1 2 [ 1 ( )]

2 [ ( )]

x

x x A

indeed A A μ

μ μ

  1. 5 ( ) 1

x

x A

A μ

μ

Fuzzy Operations (1)

The complement of a set is its opposite, given by:

μ (^) ¬ A ( x ) = 1 āˆ’ μ A ( x )

Monotonic selection

Allows estimation of the variable in the consequent. However, it only works for monotonic membership functions – not common!

0

1

height weight

Tall men Heavy men

180 90

Antecedents/consequents with multiple parts

  • Antecedents: Use unification (OR) or intersection (AND) operations to calculate a membership value for the whole antecedent.
  • Consequents: Each consequent is affected equally by the membership in the antecedent class(es).

Fuzzy inference: Mamdani-style

(see Negnevitsky)

  1. Fuzzify the input variables
  2. Evaluate the rules
  3. Aggregate the rule outputs
  4. Defuzzify the output

Fuzzification

  • Using the crisp inputs from the user, turn them into fuzzy memberships for all the relevant (i.e. right Universe of Discourse) classes.

Rule evaluation

  • Apply the fuzzified inputs to all the relevant rules, using union and intersection operations to handle complex antecedents.

Aggregate the results

Build a membership function for each output UoD, by aggregating all the relevant classes.

Defuzzify

Use a center of mass formula to calculate the crisp output value (integration approximated as summation):

=

b x a A

b

x a

A

x

x x

COG

μ

μ

Class exercise

Write 3-5 fuzzy rules that determine heart attack risk, using:

  • Three ā€˜universes of discourse’ (UoD): diet, exercise, and risk
  • 2 or 3 fuzzy classes per UoD, and their membership functions (represent graphically)
  • Show fuzzy inference for one set of sample data

One solution: Rules

  • diet is poor AND exercise is low  risk is high
  • diet is good AND exercise is high  risk is low
  • diet is good OR exercise is high  risk is average Your rules and membership functions may vary.

Membership function: Diet

0

0.

0.

0.

0.

1

1000 2000 3000 4000 Calories ingested per day

Membership

Poor Good

Membership function: Exercise

0

0.

0.

0.

0.

1

1000 2000 3000 4000 Calories used per day

Membership

High Low

Membership function: Risk

0

0.

0.

0.

0.

1

0 25 75 100 Likelihood of heart disease

Membership

Low Medium High

Defuzzification

  • Use the COG formula to determine the center the aggregate function.

āˆ‘

āˆ‘

=

= = b x a A

b

xa

A

x

xx COG ( )

( )

μ

μ

Defuzzification(2)

  • To simplify the calculation, we will sample every 12.5 units (better to do more, or to integrate properly):

COG =^12.^5 *.^2 +(^25 +^37.^5 +. 250 +) 3 **..^44 ++^62. 5 .+^53 *.^5. 6 +(^75 +^87.^5 +^100 ).^6 = 70

Result

  • So, the likelihood of heart disease for our patient is 70%.
  • Please keep in mind that I made up these membership functions and rules without any medical knowledge – they are just for the exercise!!