Neural Networks, Gradient Descent.
x_new = x - learning_rate * grad xs.append(x_new) if abs(x_new - x) < tol: break x = x_new return x, xs # Initial guess and learning rate x_start = 6 learning_rate = 0.001 # Run gradient descent minimum, xs = gradient_descent(dg, x_start, learning_rate) # Plotting x = np.linspace(-7, 7, 400) y =