cs623: introduction to computing with neural nets (lecture-15)

23
CS623: Introduction to Computing with Neural Nets (lecture-15) Pushpak Bhattacharyya Computer Science and Engineering Department IIT Bombay

Upload: maxime

Post on 05-Jan-2016

28 views

Category:

Documents


2 download

DESCRIPTION

CS623: Introduction to Computing with Neural Nets (lecture-15). Pushpak Bhattacharyya Computer Science and Engineering Department IIT Bombay. Finding weights for Hopfield Net applied to TSP. Alternate and more convenient E problem E P = E 1 + E 2 where - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS623: Introduction to Computing with Neural Nets (lecture-15)

CS623: Introduction to Computing with Neural Nets

(lecture-15)

Pushpak BhattacharyyaComputer Science and Engineering

DepartmentIIT Bombay

Page 2: CS623: Introduction to Computing with Neural Nets (lecture-15)

Finding weights for Hopfield Net applied to TSP

• Alternate and more convenient Eproblem

• EP = E1 + E2

where

E1 is the equation for n cities, each city in one position and each position with one city.

E2 is the equation for distance

Page 3: CS623: Introduction to Computing with Neural Nets (lecture-15)

Expressions for E1 and E2

n n

i

n

i

n

ii xxA

E1 1 1 1

221 ])1()1([2

n

i

n

j

n

jjiij xxxdE1 1 1

1,1,2 )(2

1

Page 4: CS623: Introduction to Computing with Neural Nets (lecture-15)

Explanatory example3

1 2

1 2 3

1 x11 x12 X13

2 X21 x22 x23

3 x31 x32 x33

pos

city

Fig. 1 shows two possible directions in which tour can take place

Fig. 1

For the matrix alongside, xiα = 1, if and only if, ith city is in position α

Page 5: CS623: Introduction to Computing with Neural Nets (lecture-15)

Expressions of Energy

])1(

)1(

)1(

)1(

)1(

)1[(2

2332313

2322212

2312111

2333231

2232221

21312111

21

xxx

xxx

xxx

xxx

xxx

xxxA

E

EEEproblem

Page 6: CS623: Introduction to Computing with Neural Nets (lecture-15)

Expressions (contd.)

)...](

)(

)(

)(

)(

)([2

1

32311313

31331213

33321113

22211312

21231212

232211122

xxxd

xxxd

xxxd

xxxd

xxxd

xxxdE

Page 7: CS623: Introduction to Computing with Neural Nets (lecture-15)

Enetwork

...]

[

331133,11321132,11311131,11

231123,11221122,11211121,11

131213,12131113,11121112,11

xxwxxwxxw

xxwxxwxxw

xxwxxwxxwEnetwork

Page 8: CS623: Introduction to Computing with Neural Nets (lecture-15)

Find row weight

• To find, w11,12

= -(co-efficient of x11x12) in Enetwork

• Search a11a12 in Eproblem

w11,12 = -A ...from E1. E2 cannot contribute

Page 9: CS623: Introduction to Computing with Neural Nets (lecture-15)

Find column weight

• To find, w11,21

= -(co-efficient of x11x21) in Enetwork

• Search co-efficient of x11x21 in Eproblem

w11,21 = -A ...from E1. E2 cannot contribute

Page 10: CS623: Introduction to Computing with Neural Nets (lecture-15)

Find Cross weights

• To find, w11,22

= -(co-efficient of x11x22)• Search x11x22 from Eproblem. E1 cannot

contribute• Co-eff. of x11x22 in E2

(d12 + d21) / 2

Therefore, w11,22 = -( (d12 + d21) / 2)

Page 11: CS623: Introduction to Computing with Neural Nets (lecture-15)

Find Cross weights

• To find, w11,33

= -(co-efficient of x11x33)

• Search for x11x33 in Eproblem

w11,33 = -( (d13 + d31) / 2)

Page 12: CS623: Introduction to Computing with Neural Nets (lecture-15)

Summary

• Row weights = -A

• Column weights = -A

• Cross weights = -[(dij + dji)/2], j = i ± 1

0, j>i+1 or j<(i-1)s

• Threshold = -2A

Page 13: CS623: Introduction to Computing with Neural Nets (lecture-15)

Interpretation of wts and thresholds

• Row wt. being negative causes the winner neuron to suppress others: one 1 per row.

• Column wt. being negative causes the winner neuron to suppress others: one 1 per column.

• Threshold being -2A makes it possible to for activations to be positive sometimes.

• For non-neighbour row and column (j>i+1 or j<i-1) neurons, the wt is 0; this is because non-neighbour cities should not influence the activations of corresponding neurons.

• Cross wts when non-zero are proportional to negative of the distance; this ensures discouraging cities with large distances between them to be neighbours.

Page 14: CS623: Introduction to Computing with Neural Nets (lecture-15)

Can we compare Eproblem and Enetwork?

n n

i

n

i

n

ii xxA

E1 1 1 1

221 ])1()1([2

E1 has square terms (xiα)2 which evaluate to 1/0. It also has constants again evaluating to 1. Sum of square terms and constants

<=n X (1+1+…n times +1) + n X (1+1+…n times +1)=2n(n+1)

Additionally, there are linear terms of the form const* xiα

which will produce the thresholds of neurons by equating with the linear terms in Enetwork.

Page 15: CS623: Introduction to Computing with Neural Nets (lecture-15)

Can we compare Eproblem and Enetwork? (contd.)

n

i

n

j

n

jjiij xxxdE1 1 1

1,1,2 )(2

1

This expressions can contribute only product terms which areequated with the product terms in Enetwork

Page 16: CS623: Introduction to Computing with Neural Nets (lecture-15)

Can we compare Eproblem and Enetwork

(contd)• So, yes, we CAN compare Eproblem and

Enetwork.

• Eproblem <= Enetwork + 2n(n+1)

• When the weight and threshold values are chosen by the described procedure, minimizing Enetwork implies minimizing Eproblem

Page 17: CS623: Introduction to Computing with Neural Nets (lecture-15)

Principal Component Analysis

Page 18: CS623: Introduction to Computing with Neural Nets (lecture-15)

Purpose and methodology

• Detect correlations in multivariate data

• Given P variables in the multivariate data, introduce P principal components Z1, Z2, Z3, …ZP

• Find those components which are responsible for the biggest variation

• Retain them only and thereby reduce the dimensionality of the problem

Page 19: CS623: Introduction to Computing with Neural Nets (lecture-15)

Example: IRIS Data (only 3 values out of 150)

ID Petal Length (a1)

Petal Width (a2)

Sepal Length (a3)

Sepal Width (a4)

Classification

001 5.1 3.5 1.4 0.2 Iris-setosa

051 7.0 3.2 4.7 1.4, Iris-versicolor

101 6.3 3.3 6.0 2.5 Iris-virginica

Page 20: CS623: Introduction to Computing with Neural Nets (lecture-15)

Training and Testing Data

• Training: 80% of the data; 40 from each class: total 120• Testing: Remaining 30• Do we have to consider all the 4 attributes for

classification? • Do we have to have 4 neurons in the input layer?• Less neurons in the input layer may reduce the overall

size of the n/w and thereby reduce training time• It will also likely increase the generalization performance

(Occam Razor Hypothesis: A simpler hypothesis (i.e., the neural net) generalizes better

Page 21: CS623: Introduction to Computing with Neural Nets (lecture-15)

The multivariate data

X1 X2 X3 X4 X5… Xp

x11 x12 x13 x14 x15 … x1p

x21 x22 x23 x24 x25 … x2p

x31 x32 x33 x34 x35 … x3p

x41 x42 x43 x44 x45 … x4p

……

xn1 xn2 xn3 xn4 xn5 … xnp

Page 22: CS623: Introduction to Computing with Neural Nets (lecture-15)

Some preliminaries

• Sample mean vector: <µ1, µ2, µ3,…, µp>

For the ith variable: µi= (Σnj=1xij)/n

• Variance for the ith variable:

σi 2= [Σnj=1 (xij - µi)2]/ [n-1]

• Sample covariance:

cab= [Σnj=1 ((xaj - µa)(xbj - µb))]/ [n-1]

This measures the correlation in the dataIn fact, the correlation coefficient

rab= cab/ σa σb

Page 23: CS623: Introduction to Computing with Neural Nets (lecture-15)

Standardize the variables

• For each variable xij

Replace the values by

yij = (xij - µi)/σi 2

Correlation Matrix

1

1

1

321

22321

11312

ppp

p

p

rrr

rrr

rrr

R