LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > Homework 1

Reply
 
Thread Tools Display Modes
  #21  
Old 01-16-2013, 04:00 AM
iamtrk iamtrk is offline
Junior Member
 
Join Date: Jan 2013
Posts: 8
Default Re: PLA - Need Guidance

Hi butterscotch,

Thanks for the tip now its converging consistently, but it is taking much lesser iterations , for 10 training points avg iterations are 1.5 and for 100 touchpoints it
is around 10. These values are wrong according to the answer sheet.Can you help me with this. now i am using ax+by = c line equation. The bias term i am initiating it to
the constant term of the line that i created initially from two random points. For
misclassified points bias term is w = w+/- 1. Is this correct or still am i missing something.

Thanks,
Trk
Reply With Quote
  #22  
Old 01-16-2013, 04:40 AM
alternate alternate is offline
Member
 
Join Date: Jan 2013
Posts: 14
Default Re: PLA - Need Guidance

Does your program print out the number of iterations and probability of error after every individual trial?

If not, you might want to add that so that you can watch it calculate and compare those numbers to the mean you get at the end. It will help narrow down whether the problem is in your algorithm or a simple math error.

I.e., if you're getting 1.5 for the average iterations per trial, then most of your individual trials should have numbers like 1 or 2 iterations.
Reply With Quote
  #23  
Old 01-16-2013, 08:14 PM
iamtrk iamtrk is offline
Junior Member
 
Join Date: Jan 2013
Posts: 8
Default Re: PLA - Need Guidance

Hi all,

I did a little mistake in check for convergence , now i corrected it still its taking far lesser iterations to converge . I am checking how the final values seperate the trainig
Points, it is matching perfectly . WHAT I THINK IS THAT I AM INITIATING W0 TO THE
CONSTANT TERM OF THE ORIGINAL LINE so the algo is taking lesser iterations . But If i initiate it to 0. It is not converging.

MY CONCERN IS IF W0 IS INITIATED TO 0. THEN IT IS NOT CONVERGING.
SHOULD I INITIATE W0 WITH SOME RANDOM NUMBER . Fellow students please
Help me here . I am stuck on this.
Reply With Quote
  #24  
Old 01-17-2013, 02:57 AM
alternate alternate is offline
Member
 
Join Date: Jan 2013
Posts: 14
Default Re: PLA - Need Guidance

w0 is definitely supposed to be initialized to zero, so there's a logic error in your code somewhere. If whether or not you converge depends on the initial value, you're probably not actually updating w0. w0 should update every iteration.

It would be helpful if you can run a 1-trial test and manually examine the results of every iteration (see what the new weights are, how many points are currently misclassified.) This is really easy to do in the language I'm using but I'm not familiar with Java. You could probably print out the values or graph them visually.

Either way, changing the trials from 1000 to 1 and stepping through the algorithm may show you an obvious source of error. Then once one trial gives you the results you're supposed to get, doing multiple trials should work out cleanly. If you still can't figure out what's going wrong, then you could post here the output of the program for one trial.
Reply With Quote
  #25  
Old 04-06-2013, 03:54 PM
mvellon mvellon is offline
Junior Member
 
Join Date: Apr 2013
Posts: 9
Default Re: PLA - Need Guidance

I think I've got the PLA working correctly, but I'm not sure that I can see how w0 ends up being anything other than 1, 0 or -1. Is this correct?

if w = w + xn*yn, but x0 always is 1 and yn is 1 or -1, then w0 is only ever going to change by 1 or -1. No?

(Correction: w0 only ever changes by 1 or -1)

Last edited by mvellon; 04-06-2013 at 04:28 PM. Reason: mistake
Reply With Quote
  #26  
Old 04-06-2013, 06:31 PM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,476
Default Re: PLA - Need Guidance

Quote:
Originally Posted by mvellon View Post
I think I've got the PLA working correctly, but I'm not sure that I can see how w0 ends up being anything other than 1, 0 or -1. Is this correct?

if w = w + xn*yn, but x0 always is 1 and yn is 1 or -1, then w0 is only ever going to change by 1 or -1. No?

(Correction: w0 only ever changes by 1 or -1)
You are correct, and the result is that w_0 will always be an integer under this scheme. However, if the entire vector {\bf w} is scaled up or down, the separating line it represents does not change, so the {\bf w} you get is equivalent to other {\bf w}'s in which w_0 is not an integer.
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
Reply

Tags
convergence, iterations, perceptron, pla

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:56 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.