1 / 20

0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0

Input Training data:. 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0. Input Training data:. 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0. Last column is the known label for each datum. Input Training data:. 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0.

wpamela
Download Presentation

0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Input Training data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0

  2. Input Training data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Last column is the known label for each datum

  3. Input Training data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Last column is the known label for each datum Label is not part of data, Keep the column for label separate from data

  4. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Such that: w0*1 + w1*0 + w2*6 + w3*5 + w4*0>0 w0*1 + w1*5 + w2*2 + w3*2 + w4*9>0 w0*1 + w1*3 + w2*5 + w3*0 + w4*0<=0 w0*1 + w1*9 + w2*4 + w3*1 + w4*5<=0

  5. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Such that: w0*1 + w1*0 + w2*6 + w3*5 + w4*0 >0 w0*1 + w1*5 + w2*2 + w3*2 + w4*9 >0 w0*1 + w1*3 + w2*5 + w3*0 + w4*0 <=0 w0*1 + w1*9 + w2*4 + w3*1 + w4*5 <=0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4

  6. Make sure your input columns are enhanced: w0 1 0 6 5 0 1 1 5 2 2 9 1 1 3 5 0 0 0 1 9 4 1 5 0 Such that: w0*1 + w1*0 + w2*6 + w3*5 + w4*0 >0 w0*1 + w1*5 + w2*2 + w3*2 + w4*9 >0 w0*1 + w1*3 + w2*5 + w3*0 + w4*0 <=0 w0*1 + w1*9 + w2*4 + w3*1 + w4*5 <=0 Perceptron training is to find best approximations for w0,w1, w2, w3, w4

  7. Input Test data: 1 2 3 4 2 2 3 3 1 1 4 4 4 4 8 9 Problem: find respective labels

  8. T1  Input Test data: 1 2 3 4 2 2 3 3 1 1 4 4 4 4 8 9 T1  Problem: find respective labels, from computed w0, w1, w2, w3, w4 over training data Ifw0*1 + w1*1 + w2*2 + w3*3 + w4*4 >0, then the predicted label N=1 Else the predicted label N=0

  9. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Such that: w0*1 + w1*0 + w2*6 + w3*5 + w4*0 >0 w0*1 + w1*5 + w2*2 + w3*2 + w4*9 >0 w0*1 + w1*3 + w2*5 + w3*0 + w4*0 <=0 w0*1 + w1*9 + w2*4 + w3*1 + w4*5 <=0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set

  10. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set Suppose, For x1, [w0*1 + w1*0 + w2*6 + w3*5 + w4*0] comes out to be >0 X is a vector (x0 = 1, x1, x2, x3, x4)

  11. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 wi wi + alpha*(yj - N(xj))xi;j (i = 0; ... ; 4) Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set, start with arbitrary w’s Suppose, [w0*1 + w1*0 + w2*6 + w3*5 + w4*0] comes out to be <=0, Then, N(xj=x1) = 0

  12. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 wi wi + alpha*(yj - N(xj))xi;j (i = 0; ... ; 4) Perceptron training is to find best approximations for w0, w1, w2, w3, w4, w5 Let us see how to compute these from the training set, start with arbitrary w’s Suppose, [w0*1 + w1*0 + w2*6 + w3*5 + w4*0] comes out to be <=0, Then, Predicted label N(x1) = 0, but for data point x1, given label y1 = 1

  13. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 wi wi + alpha*(yj - N(xj))xi;j (i = 0; ... ; 4) Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set, start with arbitrary w’s Suppose, [w0*1 + w1*0 + w2*6 + w3*5 + w4*0] comes out to be <=0, Then, Predicted label N(x1) = 0, but for data point x1, given label y1 = 1 Then, update w0, w0w0+ alpha*(y1 - N(x1))x0;1 Note, x0;1 = 1 for all data points j=1..4

  14. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 wi wi + alpha*(yj - N(xj))xi;j (i = 0, ... ,4) Perceptron training is to find best approximations for w0, w1, w2, w3, w4, w5 Let us see how to compute these from the training set, start with arbitrary w’s Suppose, [w0*1 + w2*0 + w3*6 + w4*5 + w5*0] comes out to be <=0, Then, Predicted label N(xjor xj=1)= 0, but for the data point 1, given label y1 = 1 Then, update w0, w0w0+ alpha*(yj - N(xj))*1 update w1, w1w1+ alpha*(yj- N(xj))x1;1

  15. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 wi wi + alpha*(yj - N(xj))xi;j (i = 0; ... ; n) Perceptron training is to find best approximations for w0, w1, w2, w3, w4, w5 Let us see how to compute these from the training set, start with arbitrary w’s Suppose, [w0*1 + w2*0 + w3*6 + w4*5 + w5*0] comes out to be <=0, Then, Predicted label N(xjor xj=1)= 0, but for the data point 1, given label y1 = 1 Then, for each data point j, update w0, w0w0+ alpha*(yj- N(xj))*1 update w1, w1w1+ alpha*(yj- N(xj))xj;1 update for all five w’s

  16. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set Then, for the second data point x2 Suppose, For x1, [w0*1 + w1*5 + w2*2 + w3*2 + w4*9] comes out to be …..

  17. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4, w5 Let us see how to compute these from the training set Then, for the second data point x2 Suppose, For x1, [w0*1 + w2*5 + w3*2 + w4*2 + w5*9] comes out to be ….. If the prediction is correct label, N=1 and y2 = 1, then no update takes place,

  18. Real Input data: 0 6 5 0 1 5 2 2 9 1 3 5 0 0 0 9 4 1 5 0 Perceptron training is to find best approximations for w0, w1, w2, w3, w4 Let us see how to compute these from the training set Then, for the second data point x2 Suppose, For x1, [w0*1 + w1*5 + w2*2 + w3*2 + w4*9] comes out to be ….. If it is correct label, y2 = 1, then no update takes place, w0w0+ alpha*(y2- N(x2))x2;1, but (N – y) = 0 w1, …..

  19. Perceptron training is to find best approximations for w0, w1, w2, w3, w4 For a number of predetermined epochs k : For each data point xj: for each wi: update wiusing the formula

  20. Perceptron training is to find best approximations for w0, w1, w2, w3, w4 // TRAINING PHASE Start with arbitrary w’s, e.g., all 1’s For a number of predetermined “epochs” k : For each data point xj: if (w0*xj,0+ w1*xj,1+ w2*xj,2+ w3*xj,3+ w4*xj,4) >0, then N(xj) =1 else N(xj) = 0; for each wi: update wiusing, wiwi+ alpha*(yj- N(xj))*xj;i(i = 0, ... , 4) // set alpha=0.5 // Now we have a perceptron model (w0, w1, … , w4) to predict // TESTING PHASE For each test data xi: If w0*1 + w1*1 + w2*2 + w3*3 + w4*4 >0, then the predicted label N=1 elsethe predicted label N=0

More Related