added regularized cost function for ex2