choosing weight and threshold values for single perceptrons n cs/py 231 lab presentation # 2 n...

11
Choosing Weight and Threshold Values for Single Perceptrons CS/PY 231 Lab Presentation # 2 January 24, 2005 Mount Union College

Upload: mabel-gardner

Post on 02-Jan-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Choosing Weight and Threshold Values for Single Perceptrons

CS/PY 231 Lab Presentation # 2 January 24, 2005 Mount Union College

Page 2: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Is there a systematic method for choosing weights and Problem: choose a set of weight and

threshold values that produce a certain output for specific inputs– ex. x1 x2 y– 0 0 0– 0 1 0– 1 0 1– 1 1 0

Page 3: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

When is output zero or one?

Perceptron firing rules: Sum of weighted inputs :

– Perceptron fires!– Output of perceptron = 1

Sum of weighted inputs < :– Output of perceptron = 0

Sum = x1·w1 + x2 ·w2 – xk: input signal; wk: weight

Page 4: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Inequalities for this Problem

for each input pair, sum = x1·w1 + x2 ·w2 since the xi´s are either 0 or 1, the sums

can be simplified to:– x1 x2 sum– 0 0 0– 0 1 w2

– 1 0 w1

– 1 1 w1 + w2

Page 5: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Inequalities for this Problem

output is 0 if sum < , or 1 if sum is > we obtain 4 inequalities for each possible

input pair:– x1 x2 y inequality – 0 0 0 0 < – 0 1 0 w2 <

– 1 0 1 w1 >

– 1 1 0 w1 + w2 <

Page 6: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Choosing Weights and Based on these Inequalities 0 < means that can be any positive

value; arbitrarily choose 4.5 w2 < , so pick a weight smaller than 4.5

(say 1.2) w1 > , so let’s choose w1 = 6.0

w1 + w2 < : oops, our values don’t work! This means we’ll have to adjust our values

Page 7: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Choosing Weights and Based on these Inequalities we know that w1 must be larger than , which

must be positive, yet the sum of w1 and w2 must be LESS THAN

the only way this can happen is if w2 is NEGATIVE

does w2 = -1.0 work?

how about w2 = -2.0? Still guesswork, but with some guidance

Page 8: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

A more systematic approach

try this example:– ex. x1 x2 y– 0 0 0– 0 1 1– 1 0 0– 1 1 0

First, 0 < , so pick = 7 Next, w2 > , say 10

Page 9: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

A more systematic approach

Now consider w1 + w2 < : w1 + 10 < 7

Solving this for w1, we find that any value of w1 < -3 will work

also, w1 < ; i.e. w1 < 7

– this constraint will be satisfied for any value of w1 less than -3

Try these weights and threshold to see if they work

Page 10: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

An Example

Can you find a set of weights and a threshold value to compute this output?– ex. x1 x2 y– 0 0 1– 0 1 0– 1 0 1– 1 1 1

Page 11: Choosing Weight and Threshold Values for Single Perceptrons n CS/PY 231 Lab Presentation # 2 n January 24, 2005 n Mount Union College

Choosing Weight and Threshold Values for Single Perceptrons

CS/PY 231 Lab Presentation # 2 January 24, 2005 Mount Union College