Introduction to Artificial Intelligence

47
Fuzzy Logic By Manoj Harsule

description

Fuzzy logic set

Transcript of Introduction to Artificial Intelligence

Page 1: Introduction to Artificial Intelligence

Fuzzy Logic

By Manoj Harsule

Page 2: Introduction to Artificial Intelligence

OverviewOverview

• A Little History• Fuzzy Logic – A Definition• Fuzzy set theory• Introduction to fuzzy set• Fuzzy Relations

Page 3: Introduction to Artificial Intelligence

A little History

In the 1960’s Lotfi A. Zadeh Ph.D,. University of California, Berkeley, published an obscure paper on fuzzy sets . His unconventional theory allowed for approximate information and uncertainty when generating complex solutions; a process that previously did not exist.

Fuzzy Logic has been around since the mid 60’s but was not readily excepted until the 80’s and 90’s. Although now prevalent throughout much of the world, China, Japan and Korea were the early adopters

Page 4: Introduction to Artificial Intelligence

WHAT IS FUZZY LOGIC?WHAT IS FUZZY LOGIC?

Definition of fuzzy

Fuzzy – “not clear, distinct, or not precise;

uncertain”

Definition of fuzzy logic

A form of knowledge representation suitable for

notions that cannot be defined precisely, but which

depend upon their contexts.

Page 5: Introduction to Artificial Intelligence

TRADITIONAL REPRESENTATION OF LOGIC

Slow (Low) Fast (High)

Speed = 0 Speed = 1

Page 6: Introduction to Artificial Intelligence

FUZZY LOGIC FUZZY LOGIC REPRESENTATIONREPRESENTATION

For every problem must represent in terms of fuzzy sets.

Slowest

Fastest

Slow

Fast

[ 0.0 – 0.25 ]

[ 0.25 – 0.50 ]

[ 0.50 – 0.75 ]

[ 0.75 – 1.00 ]

Page 7: Introduction to Artificial Intelligence

Introduction to Introduction to Fuzzy Set TheoryFuzzy Set Theory

Fuzzy SetsFuzzy Sets

Page 8: Introduction to Artificial Intelligence

Types of UncertaintyTypes of Uncertainty

• Stochastic uncertaintyStochastic uncertainty– E.g., rolling a diceE.g., rolling a dice

• Linguistic uncertaintyLinguistic uncertainty– E.g., low price, tall people, young ageE.g., low price, tall people, young age

• Informational uncertaintyInformational uncertainty– E.g., credit worthiness, honestyE.g., credit worthiness, honesty

Page 9: Introduction to Artificial Intelligence

Crisp or Fuzzy LogicCrisp or Fuzzy Logic

• Crisp LogicCrisp Logic– A proposition can be A proposition can be truetrue oror falsefalse only.only.

• Ajay is a student (true)Ajay is a student (true)• Smoking is healthy (false)Smoking is healthy (false)

– The degree of truth is The degree of truth is 0 or 10 or 1..

• Fuzzy LogicFuzzy Logic– The degree of truth is The degree of truth is between 0 and 1between 0 and 1..

• Raj is young (0.3 truth) Raj is young (0.3 truth) • Amol is smart (0.9 truth) Amol is smart (0.9 truth)

Page 10: Introduction to Artificial Intelligence

Crisp SetsCrisp Sets

• Classical sets are called crisp setsClassical sets are called crisp sets– either an element either an element belongsbelongs to a set or to a set or

not, i.e.,not, i.e.,

• Member Function of crisp setMember Function of crisp set

x A or x A

0( )

1A

x Ax

x A

( ) 0,1A x

Page 11: Introduction to Artificial Intelligence

P

Crisp SetsCrisp Sets

P : the set of all people.

Y : the set of all young people. YY

( ) 25,ageYoung y y x x P

1

y

( )Young y

25

Page 12: Introduction to Artificial Intelligence

Fuzzy SetsFuzzy SetsCrisp sets ( ) 0,1A x

( ) [0,1]A x

1

y

( )Young y

Example

Page 13: Introduction to Artificial Intelligence

Definition:Fuzzy Sets and Membership Functions

If U is a collection of objects denoted generically by x, then a fuzzy set A in U is defined as a set of ordered pairs:

( , ( ))AA x x x U membership

function

: [0,1]A U

U : universe of discourse.

Page 14: Introduction to Artificial Intelligence

Example (Discrete Universe)

{1,2,3,4,5,6,7,8}U # courses a student may take in a semester.

(1,0.1) (2,0.3) (3,0.8) (4,1)

(5,0.9) (6,0.5) (7,0.2) (8,0.1)A

#appropriate courses taken

0.5

1

02 4 6 8

x : # courses

( )A x

Page 15: Introduction to Artificial Intelligence

Example (Discrete Universe)

{1,2,3,4,5,6,7,8}U # courses a student may take in a semester.

(1,0.1) (2,0.3) (3,0.8) (4,1)

(5,0.9) (6,0.5) (7,0.2) (8,0.1)A

appropriate # courses taken

Alternative Representation:

1 2 3 40.1/ 0.3 / 0.8 / 1.0 / 0.9 / 0.5 / 0.2 / 0.1/5 6 7 8A

Page 16: Introduction to Artificial Intelligence

Example (Continuous Universe)

possible agesU : the set of positive real numbers

( , ( ))BB x x x U

4

1( )

501

5

B xx

about 50 years old

0

0.2

0.4

0.6

0.8

1

1.2

0 20 40 60 80 100

x : age

( )B x

4505

1

1 xRB x

Alternative Representation:

Page 17: Introduction to Artificial Intelligence

Alternative NotationAlternative Notation

( , ( ))AA x x x U

U : discrete universe

U : continuous universe

( ) /i

A i ix U

A x x

( ) /AUA x x

Note that and integral signs stand for the union of membership grades; “

/ ” stands for a marker and does not imply division.

Page 18: Introduction to Artificial Intelligence

Mem

bers

hip

valu

e

height

1

0

Membership Functions (MF’s)

• A fuzzy set is completely characterized A fuzzy set is completely characterized by a membership function.by a membership function.– a a subjectivesubjective measure. measure.– notnot a a probabilityprobability measure. measure.

“tall” in Asia

“tall” in USA“tall” in Aus

5’10”

Page 19: Introduction to Artificial Intelligence

Fuzzy Partition

• Fuzzy partitions formed by the Fuzzy partitions formed by the linguisticlinguistic values “values “youngyoung”, “”, “middle agedmiddle aged”, and “”, and “oldold”:”:

Page 20: Introduction to Artificial Intelligence

Introduction to Fuzzy Set Theory

Set-Theoretic Operations

Page 21: Introduction to Artificial Intelligence

Set-Theoretic OperationsSet-Theoretic Operations

• SubsetSubset

• ComplementComplement

• UnionUnion

• IntersectionIntersection

( ) ( ), A BA B x x x U

( ) max( ( ), ( )) ( ) ( )C A B A BC A B x x x x x

( ) min( ( ), ( )) ( ) ( )C A B A BC A B x x x x x

( ) 1 ( )AAA U A x x

Page 22: Introduction to Artificial Intelligence

Set-Theoretic Operations

A BA B

A BA B

AA

A BA B

Page 23: Introduction to Artificial Intelligence

PropertiesProperties

A AInvolutionA B B A

Commutativity A B B A

A B C A B C Associativity A B C A B C

A B C A B A C Distributivity A B C A B A C

A A A Idempotence A A A

A A B A Absorption A A B A

A B A B De Morgan’s laws

A B A B

Page 24: Introduction to Artificial Intelligence

Properties

• The following properties are The following properties are invalidinvalid for fuzzy sets:for fuzzy sets:

– The laws of contradictionThe laws of contradiction

– The laws of excluded middleThe laws of excluded middle

A A

A A U

Page 25: Introduction to Artificial Intelligence

Other Definitions for Set Operations

• UnionUnion

• IntersectionIntersection

( ) min 1, ( ) ( )A B A Bx x x

( ) ( ) ( )A B A Bx x x

Page 26: Introduction to Artificial Intelligence

Other Definitions for Set Operations

• UnionUnion

• IntersectionIntersection

( ) ( ) ( ) ( ) ( )A B A B A Bx x x x x

( ) ( ) ( )A B A Bx x x

Page 27: Introduction to Artificial Intelligence

Generalized Union/Intersection

• Generalized IntersectionGeneralized Intersection

• Generalized UnionGeneralized Union

t-norm

t-conorm

Page 28: Introduction to Artificial Intelligence

T-Norm

:[0,1] [0,1] [0,1]T

Or called triangular norm.

1.1. SymmetrySymmetry

2.2. AssociativityAssociativity

3.3. MonotonicityMonotonicity

4.4. Border ConditionBorder Condition

( , ) ( , )T x y T y x

( ( , ), ) ( , ( , ))T T x y z T x T y z

1 2 1 2 1 1 2 2, ( , ) ( , )x x y y T x y T x y

( ,1)T x x

Page 29: Introduction to Artificial Intelligence

T-ConormT-Conorm

:[0,1] [0,1] [0,1]S

Or called s-norm.

1.1. SymmetrySymmetry

2.2. AssociativityAssociativity

3.3. MonotonicityMonotonicity

4.4. Border ConditionBorder Condition

( , ) ( , )S x y S y x

( ( , ), ) ( , ( , ))S S x y z S x S y z

1 2 1 2 1 1 2 2, ( , ) ( , )x x y y S x y S x y

( ,0)S x x

Page 30: Introduction to Artificial Intelligence

Fuzzy Relations

Review Fuzzy Relations

Page 31: Introduction to Artificial Intelligence

Aa1

a2

a3

a4

B

b1

b2

b3

b4

b5

Binary Relation (Binary Relation (RR))R A B

1 1 1 3 2 5

3 1 3 4 4 2

( , ), ( , ), ( , )

( , ), ( , ), ( , )

a b a b a bR

a b a b a b

1 0 1 0 0

0 0 0 0 1

1 0 0 1 0

0 1 0 0 0

RM

1 1a Rb 1 3a Rb 2 5a Rb

3 1a Rb 3 4a Rb 4 2a Rb

Page 32: Introduction to Artificial Intelligence

The Real-Life Relation

• x is close to y – x and y are numbers

• x depends on y– x and y are events

• x and y look alike– x and y are persons or objects

• If x is large, then y is small– x is an observed reading and y is a corresponding

action

Page 33: Introduction to Artificial Intelligence

Fuzzy RelationsFuzzy Relations

A fuzzy relation R is a 2D MF:

( ,,( , ) ( , )) |R x yx y x yR X Y

Page 34: Introduction to Artificial Intelligence

Example (Approximate Equal)

( ,,( , ) ( , )) |R x yx y x yR X Y

{1,2,3,4,5}X Y U

1 0.8 0.3 0 0

0.8 1 0.8 0.3 0

0.3 0.8 1 0.8 0.3

0 0.3 0.8 1 0.8

0 0 0.3 0.8 1

RM

1 0

0.8 1( , )

0.3 2

0

R

u v

u vu v

u v

otherwise

Page 35: Introduction to Artificial Intelligence

A fuzzy relation defined on X an Z.

Max-Min Composition

X Y ZR: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.

R 。 S: the composition of R and S.

( , ) max min ( , ), ( , )R S y R Sx z x y y z

( , ) ( , )y R Sx y y z

Page 36: Introduction to Artificial Intelligence

Example

1 0.1 0.2 0.0 1.0

2 0.3 0.3 0.0 0.2

3 0.8 0.9 1.0 0.4

R a b c d0.9 0.0 0.3

0.2 1.0 0.8

0.8 0.0 0.7

0.4 0.2 0.3

S

a

b

c

d

1 0.4 0.2 0.3

2 0.3 0.3 0.3

3 0.8 0.9 0.8

R S

0.1 0.2 0.0 1.00.9 0.2 0.8 0.4min0.1 0.2 0.0 0.4max

( , ) max min ( , ), ( , )S R v R Sx y x v v y

Page 37: Introduction to Artificial Intelligence

Max-Product CompositionMax-Product Composition

( , ) max ( , ) ( , )R S y R Sx z x y y z

A fuzzy relation defined on X an Z.

X Y ZR: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.

R 。 S: the composition of R and S.

Max-min composition is not mathematically tractable, therefore other compositions such as max-product composition have been suggested.

Page 38: Introduction to Artificial Intelligence

ProjectionProjectionR

XR R X YR R Y

Dimension Reduction

Page 39: Introduction to Artificial Intelligence

ProjectionProjectionR

XR R X YR R Y

R

XR R X YR R Y

XR R X YR R Y max ( , ) /RX y

x y xmax ( , ) /RY xx y y

( ) max ( , )YR R

xy x y ( ) max ( , )

XR Ry

x x y

Dimension Reduction

Page 40: Introduction to Artificial Intelligence

Cylindrical Extension Cylindrical Extension Dimension Expansion

A : a fuzzy set in X.

C(A) = [AXY] : cylindrical extension of A.

( ) ( ) | ( , )AX YC A x x y

( ) ( , ) ( )C A Ax y x

Page 41: Introduction to Artificial Intelligence

Types of Fuzzy Relations

• Reflexive– Irreflexive– Antireflexive– Epsilon Reflexive

• Symmetric– Asymmetric– Antisymmetric

XxxxR allfor 1),(

XxxxR somefor 1),(

XxxxR allfor 1),(

XxxxR allfor ),(

XxxyRyxR allfor ),(),(

XxxyRyxR somefor ),(),(

XyxyxxyRyxR , allfor 0 ),( and 0),(

Page 42: Introduction to Artificial Intelligence

Types of Fuzzy Relations

• Transitive (max-min transitive)

– Non-transitive: For some (x,z), the above do not satisfy.– Antitransitive:

• Example: X = Set of cities, R=“very far” Reflexive, symmetric, non-transitive

X allfor )],(),,(min[max),(

x,zzyRyxRzxRYy

X allfor )],(),,(min[max),(

x,zzyRyxRzxRYy

Page 43: Introduction to Artificial Intelligence

Types of Fuzzy Relations

• Transitive Closure– Crisp: Transitive relation that contains R(X,X)

with fewest possible members– Fuzzy: Transitive relation that contains

R(X,X) with smallest possible membership– Algorithm:

TRR

RRRR

RRRR

'

''

'

:Stop 3.

1 step togo and make , If .2

).( .1

Page 44: Introduction to Artificial Intelligence

Types of Fuzzy Relations

• Fuzzy Equivalence or Similarity Relation– Reflexive, symmetric, and transitive– Decomposition:

– Partition Tree[0,1]}|) ({(R)

:partitions ofSet

relation. eequivalenc crisp a is

]1,0[

R

R

RR

Page 45: Introduction to Artificial Intelligence

Types of Fuzzy Relations

• Fuzzy Compatibility or Tolerance Relation– Reflexive and symmetric– Maximal compatibility class and complete cover

• Compatibility class• Maximal compatibility class: largest compatibility class• Complete cover: Set of maximal compatibility classes

– Maximal alpha-compatibility class– Complete alpha-covers– Note: Relation from distance metrics forms tolerance

relation in clustering.

Ryx,such that of Subset XA

Page 46: Introduction to Artificial Intelligence

BibliographyBibliography

• J. R. Jang, C. Sun, E. Mizutani, “Neuro-J. R. Jang, C. Sun, E. Mizutani, “Neuro-Fuzzy and Soft Computing: A Fuzzy and Soft Computing: A Computational Approach to Learning and Computational Approach to Learning and Machine Intelligence, Prentice HallMachine Intelligence, Prentice Hall

• Slides and notes: Slides and notes: http://equipe.nce.ufrj.br/adriano/fuzzy/bibliogr-ic.htm

Page 47: Introduction to Artificial Intelligence