Logistic Regression 中的函数
f,g
f(x)=ln(1+ex),x∈R,g(x)=f(−x)
f,g
的性质
f′(x)=ex1+ex>0,x∈R
f′′(x)=(ex1+ex)′=ex(1+ex)2>0,x∈R
limx→+∞f(x)=+∞,limx→−∞f(x)=0
limx→−∞f(x)x=limx→−∞f′(x)=1
limx→+∞[f(x)−x]=limx→+∞ln(1+e−x)=0
g(x)=f(−x)=ln(1+e−x),x∈R
g′(x)=11+e−xe−x(−1)=−11+ex<0,x∈R
g′′(x)=−(11+ex)′=ex(1+ex)2>0,x∈R
SVM 的函数
cost0,cost1
cost0(x)=max(0,x−1)
cost1(x)=max(0,1−x)
Cost function of Logistic Regression
hθ(Xi)=11+e−θ⊺Xi
J(θ)=−1m∑i=1m{yiln(hθ(Xi))+(1−yi)ln(1−hθ(Xi))}+λ2m∑j=1nθ2j
则
−lnhθ(Xi)=g(θ⊺Xi)
−ln(1−hθ(Xi))=f(θ⊺Xi)
于是
J(θ)=∑i=1m[yig(θ⊺Xi)+(1−yi)f(θ⊺Xi)]+λ2m∑j=1nθ2j
Cost function of Support Vector Machine
hθ(Xi)={1,0,θ⊺Xi≥0,otherwise,
J(θ)=C∑i=1m[yicost1(θ⊺Xi)+(1−yi)cost0(θ⊺Xi)]+∑j=1nλ2θ2j