Question: def gradientDescent (X, y, theta, alpha, num_iters): This function returns a tuple (theta, cost_array) m len(y) cost array - for i in range(0, num_iters): START

 def gradientDescent (X, y, theta, alpha, num_iters): This function returns atuple (theta, cost_array) m len(y) cost array - for i in range(0,

def gradientDescent (X, y, theta, alpha, num_iters): This function returns a tuple (theta, cost_array) m len(y) cost array - for i in range(0, num_iters): START TODO # Make predictions # Hint: y.hat = theta-0 + (theta-1 * x_1 ) + (theta-2 * x-2) # Shape of y-hat: m by 1 Y_hat- # Compute the difference between predictions and true values # Shape of residuals: m by 1 residuals y_hat-y # Calculate the current cost cost = cost_array.append(cost) # Compute gradients # Shape of gradients: 3 by 1, i.e., same as theta gradients # Update theta theta return theta, cost_array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!