Cost Function, Gradient Descent.
def gradient_descent(theta, X, y, learning_rate, n_iterations): m = len(y) costs = [] for iteration in range(n_iterations): h = sigmoid(X.dot(theta)) gradient = 1/m * X.T.dot(h - y) theta -= learning_rate * gradient cost = cost_function(theta, X, y) costs.append(cost) return theta, costs #