gradient <- function(theta, X, y){ # Compute gradient for logistic regression # # grad <- costFunction(theta, X, y) computes the gradient of the cost # for logistic regression w.r.t. to the parameters. # Initialize some useful values m <- length(y) # number of training examples # ====================== YOUR CODE HERE ====================== # Instructions: Compute the partial derivatives and set grad # to the partial derivatives of the cost # w.r.t. each parameter in theta # # Note: grad should have the same dimensions as theta # # ============================================================ return(grad) }