![]() |
#31
|
|||
|
|||
![]() Quote:
A word of warning to others (although it sounds like everyone else on the forums is already past this point): You do in fact need to include w_0 (with x_i,0 = 1). I spent quite a while wrestling with my non-converging PLA until I realized this was the issue (and then some more time wondering why my P(f(x) != g(x)) values were so weird, until I realized that I'd failed to account for the extra w_0 when computing f(x) using a 2D x instead of the appropriate 3D version...) I'd interpreted the value of w_0 from the in-class example as a threshold set by the bank for a credit-worthy customer, but now I realize that in fact it's one of the learned parameters, which makes perfect sense in retrospect. ![]() |
#32
|
|||
|
|||
![]()
While running through the population I first collect all the misfit points and then choose a random point to adjust the weights. The other approach could be to stop at the first misfit and correct the weights. What is practiced?
|
#33
|
|||
|
|||
![]()
I chose to correct the weights at the first misfit, increase the count of iterations and start the algorithm again from the first point... it works fast so far... but I'm wondering if I should continue with the algorithm without re-starting again and stopping only when all points satisfy h(x)=g(x)...
|
#34
|
|||
|
|||
![]() Quote:
|
#35
|
|||
|
|||
![]()
I think it would be interesting to obtain a detailed example with the first few steps used to initialize and train the perceptron. Or a complete example if anybody is willing to share their code.
I was unable to implement correctly the perceptron before the deadline, and after spending an additional 5h in this exercise today, I still don't have a proper implementation. Programming is not the issue, I'm a developer, but my issue is how to apply the theory. I feel it's important to successfully code this algorithm, so I can successfully apply the theories we will learn in the next few lectures. |
#36
|
|||
|
|||
![]() Quote:
|
#37
|
|||
|
|||
![]() Quote:
|
#38
|
|||
|
|||
![]() Quote:
Code:
w = np.zeros( 3 ) done = False while not done: wrongpoints = 0 for p in points: if np.sign( np.dot(w, p) ) != targetFunction( p ): w = np.add( w, targetFunction( p ) * p ) wrongpoints += 1 break if wrongpoints == 0: done = True https://gist.github.com/2395395 and the one for the experiments: https://gist.github.com/2395409 |
#39
|
|||
|
|||
![]() Quote:
Correction: My bad! Missed the 'break' statement ![]() |
#40
|
|||
|
|||
![]() Quote:
Yes, numpy is the best thing ever made for Python! Pseudoinverse of a matrix? np.pniv :-) |
![]() |
Thread Tools | |
Display Modes | |
|
|