Skip to main content
. Author manuscript; available in PMC: 2012 Sep 30.
Published in final edited form as: J Neurosci Methods. 2011 Jul 27;201(1):196–203. doi: 10.1016/j.jneumeth.2011.06.027

Algorithm 2.

(Training and prediction with the logistic regression classifier)

Training (model generation) stage
 1. Initialize wm = 0
 2. Estimate log-odds ratio wm using maximum likelihood
estimation
wm = argmax l(w), where log-likelihood
l(w)=i=1n(yilogp(xi,w)+(1yi)2log(1p(x,w)) and
p(x,w)=Pr(Y=1,X=x)=11+e(xTw)
Prediction (testing) stage
 1. Calculate posterior probability Pr(Y = −1|X = x) using
p(x,w)11+e(xTwm)
 2. Predicty={1,ifPr(Y=1X=x)>Pr(Y=1X=x)+1,otherwise}