LFD Book Forum

LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 1 (http://book.caltech.edu/bookforum/forumdisplay.php?f=130)
-   -   PLA - Need Guidance (http://book.caltech.edu/bookforum/showthread.php?t=838)

iamtrk 01-16-2013 04:00 AM

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

alternate 01-16-2013 04:40 AM

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.

iamtrk 01-16-2013 08:14 PM

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.

alternate 01-17-2013 02:57 AM

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.

mvellon 04-06-2013 03:54 PM

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)

yaser 04-06-2013 06:31 PM

Re: PLA - Need Guidance
 
Quote:

Originally Posted by mvellon (Post 10179)
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.


All times are GMT -7. The time now is 06:07 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, 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.