function loss = logistic_loss(z, b)
%Requirement: b in {-1,1}
	ztmp = z .* b;
	negative = (ztmp < 0);
	loss = sum(-negative.*ztmp+ log(1 + exp(ztmp.* (2*negative-1)))); %To avoid numerical errors, copied from liblinear
end
