LFD Book Forum  

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

Reply
 
Thread Tools Display Modes
  #21  
Old 04-09-2012, 12:21 PM
htlin's Avatar
htlin htlin is offline
NTU
 
Join Date: Aug 2009
Location: Taipei, Taiwan
Posts: 601
Default Re: Perceptron Learning Algorithm

Quote:
Originally Posted by fattie View Post
Another question: My PLA converges, there's no problem with that. But given sample sizes (N = 10 and N = 100), I have to choose the same answer for both iterations questions. Is that OK?
The homework asks you to choose whatever you observe. It is hard to comment on the correctness here before the deadline.
__________________
When one teaches, two learn.
Reply With Quote
  #22  
Old 04-09-2012, 12:31 PM
kurts kurts is offline
Invited Guest
 
Join Date: Apr 2012
Location: Portland, OR
Posts: 70
Default Re: Perceptron Learning Algorithm

I also had mixed feelings about the choices we were given on problem #9. My result from simulation was right between two answers, and, strictly speaking, if I were to take the absolute closest answer, I got an answer that I felt was wrong, so I chose the other one. I felt that the purpose of the question was to highlight what, if any, difference N makes in the number of steps to converge. So, based on the professor's response about choosing the absolute closest answer, I think I chose poorly.

Last edited by kurts; 04-09-2012 at 12:32 PM. Reason: spelling
Reply With Quote
  #23  
Old 04-09-2012, 01:58 PM
davies davies is offline
Junior Member
 
Join Date: Apr 2012
Posts: 3
Default Re: Perceptron Learning Algorithm

Hello Professor,

I have a question regarding updating w on each PLA iteration. If we always assign x0 = 1, how are we reasonably updating w0? By the vector addition, it will always be updated by the value y * x0 = -1 or +1, and if the true w0 is not an integer the PLA will never be able to converge to that value.

Would it be more appropriate to setup such that we divide each component of the true w by w0, so that w0 = 1 always? This way I know it is an integer and my PLA does not have to wander for a non-integer value. Or even, if I know w0 is always 1, I might not even include it in the PLA since I know it is 1 by setup.

Thank you,
-Aaron
Reply With Quote
  #24  
Old 04-09-2012, 05:06 PM
mlore mlore is offline
Junior Member
 
Join Date: Apr 2012
Posts: 3
Default Re: Perceptron Learning Algorithm

Hmm, I have the same problem. The average number of iterations for the case where N = 10 and the case where N = 100 are clearly "different" in the way that one would expect, but with respect to the answer choices they are different relatively but identical absolutely.
Reply With Quote
  #25  
Old 04-09-2012, 06:43 PM
virginiatraweek@gmail.com virginiatraweek@gmail.com is offline
Junior Member
 
Join Date: Apr 2012
Posts: 7
Default Re: Perceptron Learning Algorithm

Can you explain the math in terms of the points I listed?

(1,1,3), (1,3,7), (1,2,3), and (1,4,7). These map ++ and - -

What exactly happens? During the first iteration, what actual numbers does the computer compare?

My eventual f vector should be (1,2,-1),right? That represents the line y=2x when rewritten 0=2x-y in matrix notation. Shouldn't my eventual result look pretty darn similar to that?

I really am trying on this, and I've literally taken all of the required prereq. courses. It's just that I'm not an engineer. The notations don't make as much sense unless I see it in some sort of context. I copied a python PLA script from the net, but python isn't my "native" language, so I'm still trying to figure out exactly what it does.
Reply With Quote
  #26  
Old 04-09-2012, 08:14 PM
tcristo tcristo is offline
Member
 
Join Date: Apr 2012
Posts: 23
Default Re: Perceptron Learning Algorithm

Quote:
Originally Posted by virginiatraweek@gmail.com View Post
Can you explain the math in terms of the points I listed?

(1,1,3), (1,3,7), (1,2,3), and (1,4,7). These map ++ and - -

What exactly happens? During the first iteration, what actual numbers does the computer compare?

My eventual f vector should be (1,2,-1),right? That represents the line y=2x when rewritten 0=2x-y in matrix notation. Shouldn't my eventual result look pretty darn similar to that?

I really am trying on this, and I've literally taken all of the required prereq. courses. It's just that I'm not an engineer. The notations don't make as much sense unless I see it in some sort of context. I copied a python PLA script from the net, but python isn't my "native" language, so I'm still trying to figure out exactly what it does.
There is a nice writeup in the Wiki which might help.

http://en.wikipedia.org/wiki/Perceptron

In particular, look at the section called Learning Algorithm Steps. It hopefully will get you started.
Reply With Quote
  #27  
Old 04-09-2012, 08:53 PM
eghri eghri is offline
Junior Member
 
Join Date: Apr 2012
Posts: 1
Default Re: Perceptron Learning Algorithm

Quote:
Originally Posted by davies View Post
Hello Professor,

I have a question regarding updating w on each PLA iteration. If we always assign x0 = 1, how are we reasonably updating w0? By the vector addition, it will always be updated by the value y * x0 = -1 or +1, and if the true w0 is not an integer the PLA will never be able to converge to that value.

Would it be more appropriate to setup such that we divide each component of the true w by w0, so that w0 = 1 always? This way I know it is an integer and my PLA does not have to wander for a non-integer value. Or even, if I know w0 is always 1, I might not even include it in the PLA since I know it is 1 by setup.

Thank you,
-Aaron
I had the exact same question. I believe your method of updating is the correct way:

w_0 = w_0 + y_i

However, there is usually a learning rate associated with the perceptron such as alpha, which would make the update on the intercept:

w_0 = w_0 + alpha * y_i

So you can see here that the algorithm would accommodate non-integer values. In our case, without a learning rate, we just have to hope it converges with an integer value intercept.

I actually had one case myself where it wouldn't converge. To avoid biasing my average results, I'm going to just run the algorithm to 100k iterations and throw out anything that doesn't fully converge.
Reply With Quote
  #28  
Old 04-09-2012, 09:27 PM
tcristo tcristo is offline
Member
 
Join Date: Apr 2012
Posts: 23
Default Re: Perceptron Learning Algorithm

Quote:
Originally Posted by eghri View Post
However, there is usually a learning rate associated with the perceptron such as alpha, which would make the update on the intercept:

w_0 = w_0 + alpha * y_i

So you can see here that the algorithm would accommodate non-integer values. In our case, without a learning rate, we just have to hope it converges with an integer value intercept.
Take a look at this thread. http://book.caltech.edu/bookforum/sh...43&postcount=6. Using the default alpha of 1 shouldn't have any effect on the number of iterations required to converge.

Quote:
Originally Posted by eghri View Post
I actually had one case myself where it wouldn't converge. To avoid biasing my average results, I'm going to just run the algorithm to 100k iterations and throw out anything that doesn't fully converge.
Assuming the data classes are linearly separable, the PLA should always converge. You might want to plot the training data for those cases where it won't converge. I had a problem during my initial implementation and after reviewing the plot realized that I had a bug in my update method.

Last edited by tcristo; 04-09-2012 at 09:28 PM. Reason: Grammer
Reply With Quote
  #29  
Old 04-09-2012, 10:50 PM
virginiatraweek@gmail.com virginiatraweek@gmail.com is offline
Junior Member
 
Join Date: Apr 2012
Posts: 7
Default Re: Perceptron Learning Algorithm

How do you calculate the desired output (dj), as shown on the wikipedia page?
Reply With Quote
  #30  
Old 04-09-2012, 11:08 PM
ManUtd ManUtd is offline
Junior Member
 
Join Date: Apr 2012
Posts: 6
Default Re: Perceptron Learning Algorithm

Virginia -

Desired output is a set of -1/+1 based on the signum function on N (x,y) points compared to the original line in the x-y plane.
Reply With Quote
Reply

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 04:46 PM.


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.