nn & fl - gnits.ac.in · artificial intelligence artificial intelligence (ai) is a branch of...

100
Introduction NN & FL

Upload: others

Post on 26-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Introduction

NN & FL

Page 2: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Artificial Intelligence

Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior.

it is possible to build machines that can demonstrate intelligence similar to human beings.

A I can be obtained in two ways. soft computing methods (NN, FL, GA etc) Hard computing methods (conventional PID cont.

etc)

Page 3: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Artificial Intelligence

Hard computing methods are predominantlybased on mathematical approaches .

Soft computing techniques have drawn their inherent characteristics from biological systems

Soft computing methods are

Neural networks

Fuzzy logic

Genetic algorithms

Combination of above

Page 4: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Neural Networks

Neural Networks (NN) are simplified models of

the biological nervous systems

An NN can be massively parallel and therefore is

said to exhibit parallel distributed processing

NN architectures have been broadly classified as

Single layer feed forward networks.

Multi layer feed forward networks and

Page 5: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Logic

Fuzzy logic is a set of mathematical principles forknowledge representation based on themembership function

Fuzzy logic provides simple way to draw definiteconclusions from vague, ambiguous or impreciseinformation.

Fuzzy logic is similar to that of Boolean logic

Page 6: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Logic

If the Level is low then open V1

If the Level is High then Close V1

If the level is Medium then open V1 by 50%

Page 7: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Need of fuzzy logic controller

Rigorous mathematical model of some linear process.

in the case of complex process, which are difficult to model.

Non-Linear Systems

Page 8: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Comparison of conventional & fuzzy logiccontrollers:

Page 9: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Sets & Fuzzy Sets

Fuzzy Logic

Page 10: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Set (Crisp set)

Well defined collection of objects

If X is Universe of discourse

(Universal set)

A is any set from X.

x is any element in X

Page 11: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Set & membership function

Def: Let X be the universe of discourse and its elements be denoted as x.

In the classical set theory, crisp set A of X is defined as: Called membership function of A

where

)(xfA

1,0:)( XxfA

Axif

AxifxfA

0

,1)(

Page 12: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

membership function (crisp set)

Crisp set of “ tall persons”

Degree of

Membership

Figure 1: A crisp way of modeling tallness

Page 13: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

membership function (crisp set)

Figure 2: The crisp version of short

Crisp set of “ Short persons” or “ NOT tall ”

Page 14: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

membership function (crisp set)

Different heights have same ‘tallness’

Page 15: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Set

Def: Let X be the universe of discourse and its elements be denoted as x.

In the fuzzy set theory, fuzzy set A of X is defined as: Called membership function of fuzzy set A

Where

1...0:)( toXxA

)( xA

Ainpartiallyisxifx

Ainnotisxif

Aintotallyisxif

x

A

A

,1)(0

,0

,1

)(

Page 16: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets & membership

The shape you see is known as the membership function

Degree of A = “Set of TALL persons”

membership

Page 17: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets & memberships

Shows two membership functions: ‘tall’

and ‘short’

Degree of

membership

Page 18: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets

Fuzzy Operations

Page 19: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets ( Notation)

Formal definition:

A fuzzy set A in X is expressed as a set of ordered pairs:

Universe or

universe of discourseFuzzy set

Membership

function

(MF)

}{ XxxxA A /))(,(

ExampleA = { ( x1, 0.2 ) ( x2, 0.8 ) ( x3, 0.4 ) }

Page 20: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Alternative Notation

A fuzzy set A can be alternatively denoted as follows:

i

iA

Xx x

xA

i

)(

i

iA

Xx

xA

)(

X is discrete

X is continuous

Note that S and integral signs stand for the union of

membership grades; “__” stands for a marker and does

not imply division.

Page 21: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets with Discrete Universes

Fuzzy set C = “desirable city to live in”

X = {SF, Boston, LA} (discrete and non ordered)

C = {(SF, 0.9), (Boston, 0.8), (LA, 0.6)}

Page 22: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets with Cont. Universes

Fuzzy set B = “temperature about 50 degrees”

X = Set of positive real numbers (continuous)

B = {(x, B(x)) / x in X}

0.5

40 50 c60

1

600

6050)5060(

)60(

5040)4050(

)40(

400

)(

xif

xifx

xifx

xif

xA

Page 23: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Sets with Cont. Universes

Fuzzy set B = “Age about 50 Years”

X = Set of positive real numbers (continuous)

B = {(x, B(x)) / x in X}

B xx

( )

1

150

10

2

Page 24: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Partition

Fuzzy partitions formed by the linguistic values “young”, “middle aged”, and “old”:

Page 25: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Set-Theoretic Operations

Union:

Intersection:

Complement:

BAC

BAC

A

Page 26: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Membership

value

Height

1.0

0.0

A

ShortB

Tall

Union (OR)

If you have x degree of faith in statement A, and y degree of faith in statement B, how much faith do you have in the statement A or B?

• Eg: How much faith in “that person is short ortall”

Page 27: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Union (OR)

Membership

value

Height

1.0

0.0

Short Tall

Take the max of your beliefs in each individual statement

The union of two fuzzy sets A and B is a new fuzzy set A B is defined as

))(,)((max)( xxx BABA

Page 28: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Intersection (AND)

If you have x degree of faith in statement A, and y degree of faith in statement B, how much faith do you have in the statement A and B?

• Eg: How much faith in “that person is short and tall”

Membership

value

Height

1.0

0.0

A

Short

B

Tall

Page 29: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Intersection (AND)

Membership

Height

1.0

0.0

A

Short

B

Tall The Intersection of Fuzzy Sets A and B

is a new fuzzy set

A B defined asShort and tall

))(,)((min)( xxx BABA

Page 30: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Complement ( NOT )

The degree to which you believe something is notin the set is 1.0 minus the degree to which you believe it is in the set

The complement of a fuzzy set A is a new fuzzy set A’

Membership

value

Units

1.0

0.0

FS

FS’

)(1)( xx AA C

0.7

0.3

X 1 X 2

Page 31: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Set-Theoretic Operations

Subset:

Union:

Intersection:

Complement:

))(,)((max)( xxx BABA

BA

BAC

BAC

A)(1)( xx AA C

))(,)((min)( xxx BABA

))()( xx BA

Page 32: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Equality of fuzzy sets:

The two fuzzy sets A and B are said to be equal (A =B)if

Example:

A = { (x1, 0.2) (x2, 0.8) }

B = { (x1, 0.6) (x2, 0.8) }

C = { (x1, 0.2) (x2, 0.8) }

A B and A = C

)()( xx BA

Page 33: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Product of two fuzzy sets:

The product of two fuzzy sets A and B is a new fuzzyset A B with a membership function defined as

Example:

A = { ( x1, 0.2 ) ( x2, 0.8 ) ( x3, 0.4 ) }

B = { ( x1, 0.4 ) ( x2, 0 ) ( x3, 0.1) }

A B = { ( x1, 0.08 ) ( x2, 0 ) ( x3, 0.04 ) }

)(.)()(. xxx BABA

Page 34: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Product of a fuzzy set with a crisp number:

Multiplying a fuzzy set A by a crisp number `a’ resultsin a new fuzzy product a. Ã with the membershipfunction

Example:

A = { ( x1, 0.2 ) ( x2, 0.8 ) ( x3, 1 ) } and

a = 0.5

Then a.A = { (x1, 0.1) (x2, 0.4)( x3, 0.5) }

)(.)(. xax AAa

Page 35: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Power of a fuzzy set

The’ k’ power of a fuzzy set A is a new fuzzy set whosemembership function is given by

Example:

A = { (x1, 0.4) (x2, 0.2) ( x3, 0.7) } and k = 2

Then

A2 = { (x1, 0.16) (x2, 0.04) ( x3, 0.49) }

k

A

k

A xx ])([)(

Page 36: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Difference:The difference of two fuzzy sets A and B is a newfuzzy set A - B is defined as

Example:

A = { ( x1, 0.2 ) ( x2, 0.5 ) ( x3, 0.6) }

B = { ( x1, 0.9 ) ( x2, 0.4 ) ( x3, 0.5) }

B’ = { ( x1, 0.1 ) ( x2, 0.6 ) ( x3, 0.5) }

A – B = { ( x1, 0.1) ( x2, 0.5) ( x3, 0.5 ) }

)( CBABA

Page 37: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Cardinality :

The cardinality of a set is the total membership of elements in the set

Example:

A = { ( x1,0.2 ) ( x2,0.8 ) ( x3,1) }

Card(A) = 0.2+0.8+1 = 2

Height:

The height of a fuzzy set is the highest membership value of its membership function.

Example: A = { (x1,0.2)( x2,0.8)( x3,1)}

Height(A) = 1

i

iA xACard )()(

)(max)( iA xAHeight

Page 38: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Support :

The support of a fuzzy set A is the set of elements whose degree of membership in A is greater than 0.

mathematically,

Example:

Support of fuzzy set A is the

open interval (10,20)

0)(/)( xXxASpt A1

0.5

10 15 20

Page 39: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

α- Level Cut :

The α- cut of a fuzzy set A at α denoted as Aα, is the set of elements whose degree of membership in A is greater than or equal to α

mathematically,

)(/ xXxA A

10 20 30 40 50 60 70

Temperature

}60,50,40,30,20,10{2.0 A

}50,40,30,20{4.0 A

}40,30{6.0 A

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

Page 40: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Properties of fuzzy sets

Commutative:

Associative:

Distributive:

Identity:

ABBA ABBA

)()( CBACBA

)()( CBACBA

)()()( CABACBA

)()()( CABACBA

AA AXA A XXA

Page 41: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Properties of fuzzy sets

Idempotence:

Involution:

Demorgan’s Law:

AAA AAA

AA CC )(

CCC BABA )(CCC BABA )(

Page 42: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Problem:

Two fuzzy sets (discrete) are given as

Calculate the following fuzzy operations

1. :

2. Show that

3. Verify DeMorgan’s Laws

4. Cardinalities of , , and

5

2.0

4

3.0

3

5.0

2

1

1

0A

5

4.0

4

2.0

3

7.0

2

5.0

1

0B

CA

,

BA

,

BA, AB

CCC BABA )(

CB BA

A BAB BA

Page 43: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Crisp & Fuzzy Relations

Page 44: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Crisp/Fuzzy Relations

• A crisp relation represents the presence

or absence of association, interaction, or

interconnections between the elements of

two or more sets.

• Fuzzy relations allow various degrees or

strengths of relations between elements.

Page 45: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

• A classical relation can be considered as

a set of pair of elements.

• A binary pair is denoted by (u, v).

Crisp or classical Relation

Page 46: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Notation: Crisp or classical Relation

},|),{( ByAxyxR

Definition

Let A is set defined on X and B is another set defined on Y.

Then a relation R of A and B is

“ Set of element pairs each pair consists elements from

both the sets”

Cartesian Product

Cartesian product X X Y is Set of All possible element pairs

},(|),{( YyXxyxYX

Page 47: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Membership function

• Membership function of a classical relation

is given by

Ryxif

Ryxif

yxR

),(0

),(1

),(

Page 48: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

1. Crisp Relations• Example 1: Let X and Y be two sets given as follows.

Present the relation R: “x is smaller than y” in the form of a

relational matrix

X = { 1,2,3 }, Y = { 2,3,4 }, R: x<y

R = { (1,2),(1,3),(1,4),(2,3),(2,4),(3,4) }.

R =

x/y 2 3 4

1

2

3

1 1 1

0 1 1

0 0 1

Page 49: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy RelationDefinition

Let assume that X and Y are sets. Fuzzy relation R of

X and Y is a fuzzy subset of X x Y represented as pair

of elements and its membership function

R x y x y x y X YR {(( , ), ( , ))|( , ) }

))(),(min(),( yxyx BAR

Membership functionIf A and B are two fuzzy sets on X and Y

Then membership function is

Page 50: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

2. Fuzzy Relations• Example 2: Let X and Y be two sets given as follows.

Present the relation R: “x is approximately equal to y” in

the form of a relational matrix

X = { 1,2,3 }, Y = { 2,3,4 }, R:

R = { ((1,2),0.66),((1,3),0.33),((1,4),0.0),((2,2),1.0),

((2,3),0.66),((2,4), 0.33),((3,2),0.66),((3,3),1.0),((3,4),0.66) }.

R =

x/y 2 3 4

1

2

3

0.66 0.33 0

1 0.66 0.33

0.66 1 0.66

yx

Page 51: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

2.2 Fuzzy Relations

• Example 3. Relation R is given as an association or

interconnection between (Tomato) fruit color and state.

Present R as a crisp relational matrix.

X = { green, yellow, red }, Y= { unripe, semi ripe, ripe}

R unripe semiripe ripe

green

yellow

red

1 0 0

0 1 0

0 0 1

R unripe semiripe ripe

green

yellow

red

1 0.5 0

0.3 1 0.4

0 0.2 1

Page 52: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

2.3 Fuzzy Relations

Example:

Let A = { (x1, 0.2), (x2, 0.7), (x3, 0.4) } and

B = { (y1, 0.5), (y2, 0.6) } be two fuzzy sets

Find the fuzzy relation R resulting out of the fuzzy Cartesian product A x B

R = A x B =

)(),(min),(),( yxyxyx BABAR

4.04.0

6.05.0

2.02.0

3

2

1

x

x

x

21 yy

Page 53: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Operations on fuzzy Relations

1. Union

2. Intersection

3. Compliment

SR )),(),,(max(),( yxyxyxSRSR

SR

R ),(),( 1 yxyxRR

)),(),,(min(),( yxyxyxSRSR

Page 54: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of crisp Relations

Let X,Y,Z are three sets

= ?

YXR :

ZYS :

ZXT :

SRT

}),(),,(),,(),,({ 33222111 yxyxyxyxR

}),(),,({ 2411 zyzyS }),({ 11 zxSRT

x1

x2

x3

y1

y2

Y3

y4

z1

z2

R S

X Y Z

Page 55: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition

}),({ 11 zxSRT

R y1 y2 y3 y4

x1

x2

x3

1 1 0 0

0 1 0 0

0 0 1 0

S z1 z2

y1

y2

y3

y4

1 0

0 0

0 0

0 1

}),(),,(),,(),,({ 33222111 yxyxyxyxR }),(),,({ 2411 zyzyS

R/S z1 z2

x1

x2

x3

1 0

0 0

0 0

Page 56: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition

})},(),,(min{

)},,(),,(min{

)},,(),,(min{

}),,(),,(min{{max),(

1441

1331

1221

111111

zyyx

zyyx

zyyx

zyyxzx

SR

SR

SR

SRSR

)},0,0min(),0,0min()0,1min(),1,1min({max),( 11 zxSR

},0,0,0,1{max),( 11 zxSR

Page 57: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Relations

Definition [Composition of Fuzzy Relations]

Let R and S are fuzzy relations, i.e.,

),/(),( ),,/(),( zyzySyxyxRZY

SYX

R

Composition of fuzzy relations,

R and S, is a fuzzy set defined by

),/(),( zxzxSRZX

SR

X Y Z

R S

SR

Page 58: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition

• Max-Min composition:

• The max-min composition of two fuzzy relations R

(defined on X and Y) and S (defined on Y and Z) is

)],(),([),( zyyxzx SRy

SR

Max-product composition:

)],().,([),( zyyxzx SRy

SR

Page 59: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy Relations

• MAX-MIN composition

• MAX-PROD composition

},|)),(),,({(),( ZzXxzxzxzxSR SR

})},(),,(min{{max),( zyyxzx SRy

SR

}),().,({max),( zyyxzx SRy

SR

Page 60: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy Relations

Example:

R =

S =

R S (x1, z1) = max { (min (0.5, 0.6), min (0.1, 0.5)) }

= max (0.5, 0.1) = 0.5

X = { x1, x2, x3 } Y = { y1, y2 } Z= { z1, z2, z3 }

21 yy

6.08.0

9.02.0

1.05.0

3

2

1

x

x

x

321 zzz

9.08.05.0

7.04.06.0

2

1

y

y

Page 61: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

MAX-MIN composition

7.06.06.0

9.08.05.0

5.04.05.0

)6.0,7.0()6.0,4.0()5.0,6.0(

)9.0,2.0()8.0,2.0()5.0,2.0(

)01,5.0()1.0,4.0()1.0,5.0(

)9.0^60(),7.0^8.0()8.0^60(),4.0^8.0()5.0^60(),6.0^8.0(

)9.0^90(),7.0^2.0()8.0^90(),4.0^2.0()5.0^90(),6.0^2.0(

)9.0^10(),7.0^5.0()8.0^10(),4.0^5.0()5.0^10(),6.0^5.0(

MAX

MAX

SRT

9.08.05.0

7.04.06.0

6.08.0

9.02.0

1.05.0

oRoST

Page 62: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy Relations

Example:

R =

S =

R S (x1, z1) = max { ( 0.5x 0.6), (0.1x 0.5)) }

= max (0.3, 0.01) = 0.3

X = { x1, x2, x3 } Y = { y1, y2 } Z= { z1, z2, z3 }

21 yy

6.08.0

9.02.0

1.05.0

3

2

1

x

x

x

321 zzz

9.08.05.0

7.04.06.0

2

1

y

y

Page 63: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

MAX-PROD composition

56.048.048.0

81.072.045.0

35.02.03.0

)54.0,56.0()48.0,32.0()3.0,48.0(

)81.0,14.0()72.0,08.0()45.0,12.0(

)09.0,35.0()08.0,2.0()05.0,3.0(

)9.060(),7.08.0()8.060(),4.08.0()5.060(),6.08.0(

)9.090(),7.02.0()8.090(),4.02.0()5.090(),6.02.0(

)9.010(),7.05.0()8.010(),4.05.0()5.010(),6.05.0(

MAX

MAX

SRT

9.08.05.0

7.04.06.0

6.08.0

9.02.0

1.05.0

oRoST

Page 64: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy Relations

• Example 4: R is a relation that describes an

interconnection between color x and ripeness y

of a tomato, and S represents an

interconnection between ripeness y and taste z

of a tomato.

Present relational matrices for the MAX-MIN and

MAX-PROD composition

Page 65: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy RelationsThe rational matrix R (x-y connection) is given as

The rational matrix S (y-z connection) is given as

R (x,y) unripe semiripe ripe

green

yellow

red

1 0.5 0

0.3 1 0.4

0 0.2 1

S (y,z) sour sweet-sour sweet

unripe

semiripe

ripe

1 0.2 0

0.7 1 0.3

0 0.7 1

Page 66: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy Relations

The MAX-MIN composition R= R 。S results in the

relational matrix

R (x,z) sour sweet-sour sweet

green

yellow

red

1 0.5 0.3

0.7 1 0.4

0.2 0.7 1

1)0,5.0,1())0,0min(),7.0,5.0min(),1,1(min( MAXMAX

4.0)4.0,3.0,0())1,4.0min(),3.0,1min(),0,3.0(min( MAXMAX

Page 67: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Composition of Fuzzy RelationsR (x,z) sour sweet-sour sweet

green

yellow

red

1 0.5 0.15

0.7 1 0.4

0.14 0.7 1

A linguistic interpretation in the form of rules for the

relational matrix above is as follows:

Rule1: IF the tomato is green, THEN it is sour, less likely

to be sweet-sour, and unlikely to be sweet.

Rule2: IF the tomato is yellow, THEN it is sweet-sour,

possibly sour, and unlikely to be sweet.

Rule3: IF the tomato is red, THEN it is sweet, possibly

sweet-sour, and unlikely to be sour.

Page 68: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Properties of Fuzzy Relations

Page 69: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

x1

x2

x3

Y1

y2

Y3

y4

RX Y

Page 70: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 71: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 72: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 73: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 74: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Projection on X ( First projection ) is given by

Similarly calculate for all pairs, the X

projection is

Page 75: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Projection on Y ( Second projection ) is given by

Similarly calculate for all pairs, the Y projection is

Total projection is

Page 76: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Tolerance and Equivalence Relation

Crisp Equivalence Relation

R X x X

Relation has the following properties:

Reflexivity

Symmetry

Transitivity

Page 77: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Tolerance and Equivalence Relation

Reflexivity

X = { x1,x2,x3 } R X x X

(xi , xi ) R

or

µR (xi , xi ) = 1x1

x2

x3

Page 78: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 79: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Tolerance and Equivalence Relation

Symmetry (classical)

(xi xJ) R (xJ xi) R

or µR(xi xj) = µR(xj xi)

x1

x3

x2

Page 80: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 81: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Tolerance and Equivalence Relation

Transitivity: (Classical)

(xi xJ) R and (xJ xk) R (xi xk) R

or µR(xi xJ) = 1 and µR(xJ xk) = 1 µR(xi xk) = 1

x1 x2

x3

Page 82: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 83: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 84: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible
Page 85: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

FUZZY LOGIC & FUZZY RULES

Page 86: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Linguistic variables

• Example:

Age = 65

Age is OLD

Temperature = { cold, cool, warm, hot }

Speed = { stop, slow, medium, fast }

Height = { short , medium , Tall }

Linguistic Value is a fuzzy set

Linguistic variable Linguistic Value

Page 87: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Linguistic Hedges

• Modifying the meaning of a fuzzy set using hedges such as very, more or less, slightly, etc.

• Very TALL

• Very very TALL

• More or less TALL

• etc.

tall

More or less tallVery tall

Page 88: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

FUZZY LOGIC

Page 89: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

What is Fuzzy Logic?• In Propositional Logic, truth values are either True or False

• Fuzzy logic is a type of Many-Valued Logic

• There are more than two truth values

• The interval [0,1] represents the possible truth values

• 0 is absolute falsity

• 1 is absolute truth

Page 90: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

CRISP LOGIC

“Logic is a human capacity to reason” or “ Science of reasoning”

Proposition:

A statement which is either ‘True' or 'False' but not both

Example: P: Water boils at 90°C.

Q: Vapor is produced by water.

Connectives:

Disjunction ( ) OR

Conjunction () AND

Negation ( - or ~) NOT

Implication ()

Equivalence (=)

Page 91: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

CRISP LOGIC

Let Sets A and B are defined from Universe X

P and Q are two propositions

P: truth that x Є A

Q: truth that x Є B

Disjunction ( ): P Q : x Є A or x Є B

Conjunction (): P Q : x Є A and x Є B

Implication (): P Q : x Є A or x Є B

Page 92: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

CRISP LOGIC skip

Propositional logic connectives

Symbol Connective Usage Description

And P Q P and Q are true.

Or P Q Either P or Q is true,

¬ or ~ Not ~P or ¬ P P is not true.

implication P Q P implies Q is true.

= Equality P = Q P and Q are equal (in truth

values) is true.

Page 93: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Implication skip

P Q P Q

T T T

T F F

F T T

F F T

P Qq

p

qp

When in Rome, do like the Romans

Truth table

Page 94: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

CRISP LOGIC skip

• The following table illustrates the truth table for the five connectives.

P Q P Q P Q ~ P P Q P = Q

T T T T F T T

T F F T F F F

F F F F T T T

F T F T T T F

Page 95: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Tautology / contradiction skip

• A formula which has all its interpretations recording true is known as a tautology and the one which records false for all its interpretations is known as contradiction.

Example:

• Obtain a truth table for the formula (P v Q) (~P). Is it a tautology?

P Q P Q ~P P Q ~P

T

F

T

F

F

T

T

F

T

T

T

F

F

T

F

T

F

T

F

T

it is not a tautology

Page 96: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy logical operations

• AND, OR, NOT, etc.

• NOT A = A’ = 1 - A(x)

• A AND B = A B = min(A (x), B (x))

• A OR B = A B = max(A (x), B (x))

A not A

0.4 0.6

0.8 0.2

1-A

A B A or B

0.4 0.7 0.7

0.8 0.6 0.8

1 0.3 1

0.1 1 1

max(A,B)

A B A and B

0.4 0.7 0.4

0.8 0.6 0.6

1 0.3 0.3

0.1 1 0.1

min(A,B)

From the following

truth tables it is

seen that fuzzy

logic is a superset

of Boolean logic.

Page 97: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

FUZZY RULES

Page 98: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Rules

• Rules often of the form:

IF x is A THEN y is B

where A and B are fuzzy sets defined on the universes of discourse X and Y respectively.

• if pressure is high then volume is small;

• if a tomato is red then a tomato is ripe.

where high, small, red and ripe are fuzzy sets.

Page 99: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Fuzzy Rules

• Crisp rule:

• Example:

“If Self is TALL and Enemy is SHORT, Then Attack.”

The Condition of a Rule:

“If Self is Tall and Enemy is Short”

• Fuzzy rule:

“ Self is 0.3 TALL and Enemy is 0.6 SHORT ” ,

Then 0.3 Attack

then this condition is 0.3 True.

So, should we attack?

Page 100: NN & FL - gnits.ac.in · Artificial Intelligence Artificial Intelligence (AI) is a branch of science that is concerned with the automation of intelligent behavior. it is possible

Decision Making

• For example:

• Rule 1: If Self is TALL and Enemy is SHORT, then Attack

• Rule 2: If Self is BIG and Enemy is LEAN, then Attack.

• Rule 3: If Self’s Power is greater than 10,

and Self’s Health is greater than 5, then Attack.

Average of the 3 rules NOT TO ATTACK

0.6 0.8

0.6 0.9

0

0.6

0.6

0