Error when running week 3 practice-lab-logistic-regression/

When creating a post, please add:

  • Week # 3

  • Link to the classroom item you are referring to: N/A

  • Description

Getting the error :


TypeError Traceback (most recent call last)
in
8
9 w,b, J_history,_ = gradient_descent(X_train ,y_train, initial_w, initial_b,
—> 10 compute_cost, compute_gradient, alpha, iterations, 0)

<ipython-input-21-f8ee211aa9ea> in gradient_descent(X, y, w_in, b_in, cost_function, gradient_function, alpha, num_iters, lambda_)
     74 
     75         # Calculate the gradient and update the parameters
---> 76         dj_db, dj_dw = gradient_function(X, y, w_in, b_in, lambda_)
     77 
     78         # Update Parameters using w, b, alpha and gradient

TypeError: compute_gradient() takes 4 positional arguments but 5 were given

actually this error is coming when running def gradient_descent(X, y, w_in, b_in, cost_function, gradient_function, alpha, num_iters, lambda_):
when calling : gradient_function which actually passed with 4 arguments accepted but when calling from method : gradient_descent its expecting 5 argument

if any one had success and any pointer please solve the issue

Thanks ,
Muthu Selvan SR

What does the first line of your compute_gradient() function look like?

It should be this:
image

Did you modify it?

Thanks , Yes i have modified by mistaken , after modified its passed
but when submitting my assignment , getting this error : Comment line with index: UNQ_C3 wasn’t found in code

This means you also deleted the first line of the sample I posted.

You are correct , added this cell : UNQ_C3: works for me , Thanks a lot !