% LOGISTIC REGRESSION LOG LIKELIHOOD - GLOBAL VAR FUDGE.  Computes 
% minus the log probability of the training data with inputs and targets taken 
% from global variables lrest_X and lr_y, using the parameters in beta.

function loglike = lr2loglike (beta)

  global lr_y
  global lr_X

  ys = 2*lr_y-1;

  lin = beta(1) + lr_X * beta(2:end)';
  loglike = sum (log(1+exp(-ys.*lin)));
