costFunction <- function(theta, X, y){ # Compute cost and gradient for logistic regression # # J <- costFunction(theta, X, y) computes the cost for logistic regression, # using theta parameters # Initialize some useful values m <- length(y) # number of training examples # ====================== YOUR CODE HERE ====================== # Instructions: Compute the cost of a particular choice of theta. # You should set J to the cost. # ============================================================ return(J) }