Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... ·...

36
Fuzzy Reasoning Outline Introduction Bivalent & Multivalent Logics Fundamental fuzzy concepts Fuzzification Defuzzification Fuzzy Expert System Neuro-fuzzy System

Transcript of Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... ·...

Page 1: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Reasoning

Outline

●Introduction

●Bivalent & Multivalent Logics

●Fundamental fuzzy concepts

●Fuzzification

●Defuzzification

●Fuzzy Expert System

●Neuro-fuzzy System

Page 2: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Introduction

●Fuzzy concept first introduced by Lotfi Zadeh in the 1965

●Form of many-valued logic; it deals with reasoning that is approximate rather

than fixed and exact. Compared to traditional binary sets, fuzzy logic variables

may have a truth value that ranges in degree between 0 and 1

●Resembles human reasoning in its use of imprecise information to generate

decisions, unlike classical logic which requires a deep understanding of a system,

exact equations, and precise numeric values

Page 3: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Bivalent Logics

●Classical logic, often described as Aristotelian logic

– True or false

●Bayesian Reasoning and probabilistic models

– Each fact is either True or false

– Often unclear whether a given fact is true or false

●Probability

– A particular expression will turn out to be true

Page 4: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Multivalent Logics

●Three-valued logic

– True , false, and undetermined

– 1 represents true, 0 represents false, and real numbers between 0 and 1 represent degree of truth

Page 5: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Bivalent Logic vs. Multivalent Logic

●A fact has a probability value of 0.5, means it is as likely to be true as it is to be

false, or it will be either true or false

– There is Uncertainty , (at the moment we don’t know whether theproposition will be true or false, but it will definitely either be true orfalse—not both, not neither, and not something in between)

●A proposition has a logical value of 0.5, means it is about the degree to which that

statement is true

– We are Certain of the truth value of the proposition, it is just vague (it isneither true nor false, or it is both true and false)

Page 6: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Linguistic Variables

●Often used to facilitate the expression of rules and facts

●A linguistic variable such as “height” may have a value from a range of fuzzy values

including “tall” “short” and “medium.”

●It may be defined over the Universe of discourse from 2 feet up to 8 feet.

●The values “tall”, “short”, and “medium” define subsets of this universe of

discourse.

Page 7: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Sets vs. Traditional Sets

●Taditional set, Crisp set

– Defined by the values that are contained within it.

– A value is either within the set, or it is not. e.g a set of natural number

●Fuzzy set

– Each value is a member of the set to some degree, or is not a member of the set to some degree.

– Example: the tall people. Bill is 7 feet tall, so he is definitely included in the set of tall people, John is 4 feet tall, so most say that he is not included in the set, and Jane is 5 feet tall, some would say she is tall, but others would say she is not

Page 8: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Set

●Fuzzy set membership function

– Fuzzy set A is defined by membership function MA.

– Choose entirely arbitrarily, reflect a subjective view on the part of the author.

– A list of pairs for representing fuzzy set in computer like A = {(x1,MA(x1)), . . . , (xn,MA(xn))}

Page 9: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Set operator

●Traditional set theory

– Not A the complement of A, Intersection, and Union

– Commutative, Associative, Distributive, and DeMorgan's law

●Fuzzy set

– Complement of A, M¬A(x) = 1 - MA(x)

– Intersection, MA ∩ B (x) = MIN (MA (x),MB (x))

– Union, MA ∪ B (x) = MAX (MA (x),MB (x))

– Containment, B ⊂ A iff ∀x (MB (x) ≤ MA (x))

Page 10: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Hedges

●Fuzzy set qualifier such as “very”, “quite”, “extremely”, or “somewhat”

●Produce a new set when of them is applied to a fuzzy set

●Raise the set's membership function to an appropriate power. e.g a membership

value of “very tall people” is (MA(x))², or a membership value of “quite tall

people” is (MA(x))¹·³

Page 11: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Logic

●Form of logic that applies to fuzzy variables

●Each fuzzy variable can take a value from 0 (not at all true) to 1 (entirely true).

e.g 0.5 might indicate “somewhat true”, or “about as true as it is false”

●Use Min, Max for calculating the conjunction (˄)and disjunction (˅) of two fuzzy

variables

●If A and B are fuzzy logic values,

● A ˅ B ≡ MAX (A,B)

● A ˄ B ≡MIN (A,B)

¬A = 1- A

Page 12: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Classical Logic vs. Fuzzy Logic

●Classical logic

– A ∨¬A = TRUE

– A ∧¬A = FALSE

●Fuzzy logic

– A ∨¬A can be to some extend false

– A ∧¬A can be to some extend true

Page 13: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Logic

●Fuzzy truth table for a finite set of input. Set {0, 0.5, 1}

A B A˅B

0 0 0

0 0.5 0.5

0 1 1

0.5 0 0.5

0.5 0.5 0.5

0.5 1 1

1 0 1

1 0.5 1

1 1 1

Page 14: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy LogicA ̚A

0 1

0.5 0.5

1 0

Page 15: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

●Fuzzy logic implication, or →

A B A->B

0 0 1

0 0.5 1

0 1 1

* 0.5 0 0.5

* 0.5 0.5 0.5

0.5 1 1

1 0 0

1 0.5 0.5

1 1 1

Page 16: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

●One of alternative for fuzzy implication is Godel implication A→B ≡ (A ≤ B) ∨ B

A B A->B

0 0 1

0 0.5 1

0 1 1

0.5 0 0

0.5 0.5 1

0.5 1 1

1 0 0

1 0.5 0.5

1 1 1

Page 17: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Logic as Applied to

Traditional Logic Paradox●Rusell's paradox :

● “ A barber, who himself has a beard, shaves all men who do not shave themselves.

He does not shave man who shave themselves.”

●Paradox: conclusion contradicts one or more of the premises

Page 18: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

●“All Cretan are liar,” said the Cretan.

●The Paradox can be resolved by Fuzzy logical values, instead of the two logical

values “true” and “false”, the Cretan's statement is true and false, to some extend,

at the same time.

Page 19: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Rules

●Ordinary rule: IF A THEN B

●Fuzzy rule : IF A=x THEN B=y

●IF A op x THEN B=y

●e.g. IF temperature > 50 then fan speed = fast

IF study time = short then grades = poor

Page 20: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Inference

●Mamdani implication : an alternative to Godel implication

●It allows a system to take in a set of crisp input values and apply a set of fuzzy

rules to those values, in order to derive a single, crisp, output value or action

recommendation.

Page 21: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy Logic System

Page 22: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

How this form of reasoning work?

Example: Braking system for a car to cope when the roads are icy and the wheels

lock.

Page 23: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step 1 – Define the Rules

●Rule 1: IF pressure on brake pedal is medium THEN apply the brake

●Rule 2: IF pressure on brake pedal is high AND car speed is fast AND wheel speed

is fast THEN apply the brake

●Rule 3: IF pressure on brake pedal is high AND car speed is fast AND wheel speed

is low THEN release the brake

●Rule 4: IF pressure on brake pedal is low THEN release the brake

Page 24: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step 2 : Fuzzification

●Define fuzzy set for various linguistic variables

●Pressure from 0 to 100, so brake measure can be defined such as having 3

linguistic values, such as High(H),Medium(M), Low(L).

●H={(50,0),(100,1)}

●M={(30,0),(50,1),(70,0)}

●L={(0,1),(50,0)}

●Suppose pressure value is 60, so fuzzy membership for the 3 sets: MH(60)=0.2 ,

MM(60)=0.5, ML(60)=0

Page 25: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step 2 : Fuzzification

●Define wheel speed with having 3 linguistic values: Slow, Medium, Fast

●Membership function: S={(0,1),(60,0)}

●M={(20,0),(50,1),(80,0)}

●F={(40,0),(100,1)}

●If wheel speed is 55 then MS(55)=0.083, MM(55)=0.833, MF(55)=0.25

Page 26: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step 2 : Fuzzification

●Define car speed with having 3 linguistic values: Slow, Medium, Fast

●Membership function: S={(0,1),(60,0)}

●M={(20,0),(50,1),(80,0)}

●F={(40,0),(100,1)}

●If car speed is 80 then MS(80)=0, MM(80)=0, MF(80)=0.667

Page 27: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step3: Apply Fuzzy Values To The

System's Rules●Rule 1: MM(60)=0.5 , it shows “Apply the brake”

●Rule 2: MH(60)=0.2, MF(80)=0.667, MF(55)=0.25, So fuzzy value of 0.2 for

“Apply the brake”

●Rule 3: MH(60)=0.2, MF(80)=0.667, MS(55)=0.083, So fuzzy value of 0.083

for “Release the brake”

●Rule 4: ML(60)=0, So fuzzy value of 0.083 for “Release the brake”

Page 28: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

●How to combine the differing values for each of the two fuzzy variables? Sum the

values

●So we have 0.7 for “Apply the brake” and 0.083 for “Release the brake”

Page 29: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

●Clip the membership function to the values, the member function of A has been

clipped to 0.7 and the member function of R has been clipped to 0.083

Page 30: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Step 4: Defuzzification

●Process of obtaining the crisp value from a set of fuzzy variables

●This can be done by the center of gravity

●C=∑(MA(x)*x)/∑MA(x) ,

●=((5*0.083)+(10*0.1)+(15*0.15)+......+(100*1))/(0.083+0.1+0.15+.....+

1) = 68.13

●C shows the pressure applied by the brake to the wheel in the car

Page 31: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Fuzzy expert system

●Expert system contains a set of rules that are developed in collaboration with an

expert

●The fuzzy expert system can be built by choosing a set of linguistic variables

appropriate to the problem and defining membership functions for those variables.

Rules are then generated based on the expert’s knowledge and using the linguistic

variables. The fuzzy rules can then be applied as described above using Mamdani

inference.

Page 32: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Create The Fuzzy Expert System

●Obtain information from one or more experts.

●Define the fuzzy sets.

●Define the fuzzy rules

Page 33: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Use The Fuzzy Expert System

●Relate observations to the fuzzy sets.

●Evaluate each case for all fuzzy rules.

●Combine information from the rules.

●Defuzzify the results.

Page 34: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Neuro-fuzzy System

●Neural network that learns to classify data using fuzzy rules and fuzzy

classification

●A fuzzy neural network is a five-layer feed-forward network

●Layer 1: input layer- Receives crisp inputs

●Layer 2: fuzzy input membership functions

●Layer 3: fuzzy rules

●Layer 4: fuzzy output membership functions

●Layer 5: output layer- outputs crisp values

Page 35: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

References

1. Ben Coppin, “Artificial intelligence illuminated,”2004

2. “A Short Fuzzy LogicTutorial,”,April 2010

3. Robert Fuller, “Fuzzy Reasoning and Fuzzy Optimization,”, 1998

4. “Fuzzy logic,”, http://en.wikipedia.org/wiki/Fuzzy_logic

5. Walter Banks, “Linguistic Variables: Clear Thinking with Fuzzy Logic,”,

Waterloo, Ontario

Page 36: Fuzzy Reasoning - University of Arkansascsce.uark.edu/~cwt/COURSES/2013-08--CSCE-4613--AI... · Fuzzy Sets vs. Traditional Sets Taditional set, Crisp set –Defined by the values

Thank You