# 分類問題之損失函數

${\displaystyle I[f]=\textstyle \int _{X\times Y}^{}\displaystyle V(f({\vec {x}},y))p({\vec {x}},y)d{\vec {x}}dy}$

${\displaystyle S=\{({\vec {x_{1}}},y_{1}),...,({\vec {x_{n}}},y_{n})\}}$作为训练集，將樣本空間所得到的经验風險做為預期風險的替代，其定義為：
${\displaystyle I_{S}[f]={\frac {1}{n}}\sum _{i=1}^{n}V(f({\vec {x_{i}}},y_{i}))}$

${\displaystyle V(f({\vec {x}},y))=H(-yf({\vec {x}}))}$

## 分類問題之界線

${\displaystyle f^{*}({\vec {x}})={\begin{cases}1,&{\text{if }}p(1\mid {\vec {x}})>p(-1\mid {\vec {x}})\\-1,&{\text{if }}p(1\mid {\vec {x}})

${\displaystyle p(1\mid {\vec {x}})\neq p(-1\mid {\vec {x}})}$

## 簡化分類問題預期風險

{\displaystyle {\begin{alignedat}{4}I[f(x)]&=\int _{X\times Y}^{}V(f({\vec {x}},y))p({\vec {x}},y)d{\vec {x}}dy\\&=\int _{X}^{}\int _{Y}^{}V(f({\vec {x}},y))p({\vec {x}},y)p({\vec {x}})dyd{\vec {x}}\\&=\int _{X}^{}[V(-f({\vec {x}})p(1\mid x)+V(f({\vec {x}})p(-1\mid x)]p({\vec {x}})d{\vec {x}}\\&=\int _{X}^{}[V(-f({\vec {x}})p(1\mid x)+V(f({\vec {x}})(1-p(1\mid x))]p({\vec {x}})d{\vec {x}}\end{alignedat}}}

## 平方損失

${\displaystyle V(f({\vec {x}},y))=(1-yf({\vec {x}}))^{2}}$

${\displaystyle f_{Square}^{*}=2p(1\mid x)-1}$

## 鏈結損失

${\displaystyle V(f({\vec {x}}),y)=\max(0,1-yf({\vec {x}}))=|1-yf({\vec {x}})|_{+}}$

${\displaystyle f_{Square}^{*}=2p(1\mid x)-1}$

## 廣義平滑鏈結損失

${\displaystyle f_{\alpha }^{*}(z)\;=\;{\begin{cases}{\frac {\alpha }{\alpha +1}}&{\text{if }}z<0\\{\frac {1}{\alpha +1}}z^{\alpha +1}-z+{\frac {\alpha }{\alpha +1}}&{\text{if }}0

## 邏輯損失

${\displaystyle V(f({\vec {x}}),y)={\frac {1}{\ln 2}}\ln(1+e^{-yf({\vec {x}})})}$

${\displaystyle f_{\text{Logistic}}^{*}=\ln \left({\frac {p(1\mid x)}{1-p(1\mid x)}}\right).}$

## 交叉熵損失

${\displaystyle V(f({\vec {x}}),t)=-t\ln(f({\vec {x}}))-(1-t)\ln(1-f({\vec {x}}))}$

## 指數損失

${\displaystyle V(f({\vec {x}}),y)=e^{-\beta yf({\vec {x}})}}$
1. ^ Shen, Yi, Loss Functions For Binary Classification and Class Probability Estimation (PDF), University of Pennsylvania, 2005 [6 December 2014], （原始内容存档 (PDF)于2019-06-14）
2. ^ Rosasco, Lorenzo; Poggio, Tomaso, A Regularization Tour of Machine Learning, MIT-9.520 Lectures Notes, Manuscript, 2014