uwhpsc-2016 / homework1

Homework #1
1 stars 1 forks source link

Problem #2 - Range of Functions to Test? #20

Open cswiercz opened 8 years ago

cswiercz commented 8 years ago

A student asked:

For problem 2. What range of functions should we include in order to test the gradient descent algorithm that we create? Are polynomial and trig functions enough?

cswiercz commented 8 years ago

The functions that I will use to test your code will be relatively simple. Polynomial and trigonometric functions are good since you can construct all sorts of cases that would be good tests of your code.

A decent, but not sufficient test would be a convex function (e.g. f = lambda x: x**2) This function has a global minimum and is convex, implying that gradient descent will "always work".

A more robust test would be to use a function that has several local minima as well as several local maxima. In this case, what might happen if our initial guess was at a maxima?

Marisa67 commented 8 years ago

Thanks!

Marisa67 commented 8 years ago

In the example for the test provided for problem 2 there are some variables like x0, x1 and x1_actual. Are these variable names we have to respect in order for our code to pass the instructors test?

cswiercz commented 8 years ago

In the example for the test provided for problem 2 there are some variables like x0, x1 and x1_actual. Are these variable names we have to respect in order for our code to pass the instructors test?

Not at all. The actual test suite I will use on your code is a completely separate script that I will inject into your project. You can use whatever variable names you want for your own tests. The tests given to you only serve as an example of what a test may look like.

Marisa67 commented 8 years ago

Great! Thanks