uwhpsc-2016 / homework1

Homework #1
1 stars 1 forks source link

Can we change arguments in gradient_descent function ? #56

Open junzhang3366 opened 8 years ago

junzhang3366 commented 8 years ago

If I change original

def gradient_descent(f, df, x, sigma=0.5, epsilon=1e-8)

to

def gradient_descent(f, df, x, sigma, epsilon).

Do you allow us to do it?

mvelegar commented 8 years ago

@junzhang3366 please don't change the signature of the functions, these are in place so that default values for sigma/epsilon are set, so you can call the function with just 3 arguments f,df and x. If you want these values changed you can just call the function with

gradient_descent(f,df,x,sigma=0.25,epsilon=1e-16)

for example.

cswiercz commented 8 years ago

Keyword arguments can be called positionally as well, the following is equivalent to Meghana's example:

# define: f, df, and x
gradient_descent(f, df, x, 0.25, 1e-16)