function [J, grad] = logisticRegressionCostFunction(w, X, y, lambda)
%Compute cost and gradient for logistic regression with 
% regularization

m = numel(y);
% compute cost an gradient for loss function
dec_vals = w'*X';
[l,g] = logistic(dec_vals,y);
[lr, gr] = omega2(w, lambda);

J = sum(l)/m + lr;
grad = (X' * g) / m + gr;
grad = grad(:);
% disp(['cost: ' num2str(J)]);

end
