LFD Book Forum Perceptron Learning Algorithm
 User Name Remember Me? Password
 Register FAQ Calendar Mark Forums Read

 Thread Tools Display Modes
#21
04-09-2012, 12:21 PM
 htlin NTU Join Date: Aug 2009 Location: Taipei, Taiwan Posts: 610
Re: Perceptron Learning Algorithm

Quote:
 Originally Posted by fattie 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.
#22
04-09-2012, 12:31 PM
 kurts Invited Guest Join Date: Apr 2012 Location: Portland, OR Posts: 70
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
#23
04-09-2012, 01:58 PM
 davies Junior Member Join Date: Apr 2012 Posts: 3
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
#24
04-09-2012, 05:06 PM
 mlore Junior Member Join Date: Apr 2012 Posts: 3
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.
#25
04-09-2012, 06:43 PM
 virginiatraweek@gmail.com Junior Member Join Date: Apr 2012 Posts: 7
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.
#26
04-09-2012, 08:14 PM
 tcristo Member Join Date: Apr 2012 Posts: 23
Re: Perceptron Learning Algorithm

Quote:
 Originally Posted by virginiatraweek@gmail.com 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.
#27
04-09-2012, 08:53 PM
 eghri Junior Member Join Date: Apr 2012 Posts: 1
Re: Perceptron Learning Algorithm

Quote:
 Originally Posted by davies 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.
#28
04-09-2012, 09:27 PM
 tcristo Member Join Date: Apr 2012 Posts: 23
Re: Perceptron Learning Algorithm

Quote:
 Originally Posted by eghri 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 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
#29
04-09-2012, 10:50 PM
 virginiatraweek@gmail.com Junior Member Join Date: Apr 2012 Posts: 7
Re: Perceptron Learning Algorithm

How do you calculate the desired output (dj), as shown on the wikipedia page?
#30
04-09-2012, 11:08 PM
 ManUtd Junior Member Join Date: Apr 2012 Posts: 6
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.

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General     General Discussion of Machine Learning     Free Additional Material         Dynamic e-Chapters         Dynamic e-Appendices Course Discussions     Online LFD course         General comments on the course         Homework 1         Homework 2         Homework 3         Homework 4         Homework 5         Homework 6         Homework 7         Homework 8         The Final         Create New Homework Problems Book Feedback - Learning From Data     General comments on the book     Chapter 1 - The Learning Problem     Chapter 2 - Training versus Testing     Chapter 3 - The Linear Model     Chapter 4 - Overfitting     Chapter 5 - Three Learning Principles     e-Chapter 6 - Similarity Based Methods     e-Chapter 7 - Neural Networks     e-Chapter 8 - Support Vector Machines     e-Chapter 9 - Learning Aides     Appendix and Notation     e-Appendices

All times are GMT -7. The time now is 10:30 AM.

 Contact Us - LFD Book - Top

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