% [G,E,C] = slinfsgd(X,Y,Xv,Yv,o,eta,maxit,B,g0)
% Train logistic regression for binary classification y = s(w'.x+w0)
% with stochastic gradient descent, by maximum likelihood (min. cross-entropy)
% or by least-squares errors.
%
% In:
%   X: NxL matrix, N L-dim data points rowwise, training set inputs.
%   Y: Nx1 matrix, N labels in {0,1}, training set outputs.
%   Xv: MxL matrix, M L-dim data points rowwise, validation set inputs.
%   Yv: Mx1 matrix, M labels in {0,1}, validation set outputs.
%   o: objective function (0: maximum likelihood, 1: least-squares errors).
%   eta: positive scalar, the learning rate (step size).
%   maxit: number of iterations to run.
%   B: minibatch size, between 1 and N.
%   g0: (struct) initial logistic regressor (see definition in slinf.m).
% Out:
%   G: (ceil(N/B))x(maxit+1) cell array where G{n,i} is a struct containing
%      the logistic regressor at minibatch n and iteration i-1 (see struct
%      definition in slinf.m).
%   E: 2x(ceil(N/B))x(maxit+1) array where E(1,n,i) and E(2,n,i) contain the
%      training and validation error at minibatch n and iteration i-1.
%   C: 2x(ceil(N/B))x(maxit+1) array where C(1,n,i) and C(2,n,i) contain the
%      training and validation classification error (in [0,1]) at minibatch
%      n and iteration i-1.

function [G,E,C] = slinfsgd(X,Y,Xv,Yv,o,eta,maxit,B,g0)

