Problem with simple perceptron implmenetation
So I wanted to do a little bit of experimenting with the perceptron algorithm to understand it better and I came up with a simple match making scenario. Essentially i have a 100x2 training data matrix with the first feature being height between 165 and 185 and the second feature is weight (as in physical weight of a person :D) between 60 and 80. My target function is a very simple one :
Code:
function [res] = target(X) The next logical step is to learn a hypothesis function g(X) which would act much in the same way as the target function  which I assume is unknown. So here is my implementation of the perceptron: Code:
function [w] = perceptron(X, y) 
Re: Problem with simple perceptron implmenetation
I haven't looked at your implementation of the perceptron; however, I think there will be a problem with convergence regardless of the implementation since the target function is not linearly separable.

Re: Problem with simple perceptron implmenetation
I think you are mistaken. It is linearly separable since the 170/65 act as the threshold i.e. that's where the linear separation occurs.

Re: Problem with simple perceptron implmenetation
The function, height > 170 and weight > 65, is not linearly separable because it does not bisect the plane but instead defines an infinite rectangular region on the plane. There is no single line that separates this region from the rest of the plane.

Re: Problem with simple perceptron implmenetation
John is right. It can't be fit with a linear line. This is what I get with your data (the points are randomly chosen and sorry for not including the axis, legends and labels)
http://i.imgur.com/vfa0E.png So it isn't a straight line. So it can't converge with a simple 1D perceptron 
Re: Problem with simple perceptron implmenetation
Thanks for the answers. So if I have understood you correctly in this case I will need to train 2 perceptrons  one for each feature and then when a new sample is given run each of the perceptrons for height/weight and my final hypothesis would return 1 only if the 2 perceptrons return 1 on each respective feature? Is this correct?

Re: Problem with simple perceptron implmenetation
At this point the course hasn't provided us with sufficient tools to address the problem you pose, but I think you are on the right track for a method of resolving the categories. Two perceptrons, one for height and one for weight, could feed a third perceptron that would perform the logical operation (AND is a linearly separable logical operation). This approach probably requires backpropogation in order to train the network.

All times are GMT 7. The time now is 02:26 PM. 
Powered by vBulletin® Version 3.8.3
Copyright ©2000  2021, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. AbuMostafa, Malik MagdonIsmail, and HsuanTien Lin, and participants in the Learning From Data MOOC by Yaser S. AbuMostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.