[group] Homework 2 quick question about Gradient Descent while loop.

29 views
Skip to first unread message

Virgil Pavlu

unread,
Oct 3, 2012, 1:30:21 PM10/3/12
to Teaching Assistant



Hi,
I think I have figured out my question to end loop termination using:

*while (abs(new_x - old_x) > precision)*.

Precision = 0.000025 when learning rate = 0.25.

I hope this is right because it seems to work for now.




Teaching Assistant

unread,
Oct 3, 2012, 1:33:30 PM10/3/12
to cs1500...@googlegroups.com, Teaching Assistant, v...@ccs.neu.edu
If it works, its fine. 
For this HW, the intension is for students to play with the values and discover what/when works. 
For real, there is more theory about gradient decent stopping conditions, learning rates etc; you can read more about it in a Machine Learning or Numerical Methods book

Teaching Assistant

unread,
Oct 3, 2012, 1:35:29 PM10/3/12
to cs1500...@googlegroups.com, Teaching Assistant, v...@ccs.neu.edu

from the same student:

I have everything working in Homework 2 except for the termination of the
Gradient Descent while loop.
For example, polynomial *(x-2)^2 + 1*, has gradient descent *2.5, 2.25,
2.125 .... 2 with x = 3* and *learning rate = 0.25*. Eventually the x value
reaches 2, and is a never ending loop. If I set while(learning_rate>2) it
will terminate, but how do I put that into effect for all values of x?

Reply all
Reply to author
Forward
0 new messages