In [5]:
def iteration_step(X,y_target, num_it,alpha, w1, w2, b):
    
    # repeat calculation of derivatives to find global optimum
    w1_list = []
    w2_list = []
    b_list = []
    J_list = []
    for i in range(num_it):
        dw1, dw2, db, J_cost = derivative_calculations(X,y_target, w1, w2, b)
    
        # update parameters
        w1 = w1 - alpha * dw1 
        w2 = w2 - alpha * dw2
        b = b - alpha * db 
        
        # append value for each iteration
        w1_list.append(w1)
        w2_list.append(w2)
        b_list.append(b)
        J_list.append(J_cost)
    
    return w1_list, w2_list, b_list, J_list