各种代理损失函数的曲线。蓝色为0–1指示函数,绿色为平方损失函数,紫色为铰链损失函数,黄色为逻辑损失函数。注意所有代理损失函数对y=f(x= 0) 均给出1的惩罚。 在機器學習和最佳化領域中,分類問題之損失函數可以用來表達預測不準確之程度,其中分類問題主要是用來判斷所偵測到的物件屬於什麼類別。將一個向量空間
做為所有的輸入值,而向量空間
做為所有的輸出值。我们希望能夠找到最佳的公式
將
映射到
[1]。然而,由于信息不完整、雜訊、计算過程中的非确定性模块等因素,有可能會有相同的輸入值
映射到不同的輸出值
[2]。因此,這個學習過程的目的就是要最小化預期風險(更详细的介绍参见统计学习理论),預期風險之定義為:
![{\displaystyle I[f]=\textstyle \int _{X\times Y}^{}\displaystyle V(f({\vec {x}},y))p({\vec {x}},y)d{\vec {x}}dy}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c513eaa2127b38b6cbf4a2983cb2083bdc805b88)
其中
即損失函數,而
為機率密度函數。而實作上概率分布
通常是未知的,因此我们使用由数据样本空间中取出的
個獨立且同分布(i.i.d.)的樣本點
作为训练集,將樣本空間所得到的经验風險做為預期風險的替代,其定義為:
![{\displaystyle I_{S}[f]={\frac {1}{n}}\sum _{i=1}^{n}V(f({\vec {x_{i}}},y_{i}))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/625450ad58714b69472a0319deb70706742f2dd7)
基於分類問題的二元性,可定義0-1函數做為匹配值之基準。因此損失函數為:

其中
為步階函數。然而損失函數並不是凸函數或平滑函數,是一種NP-hard的問題,因此做為替代,需要使用可以追蹤的機器學習演算法(透過凸損失函數)。
使用貝式定理,可以基於問題的二元性最佳化映射公式
為:

當
![{\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}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/953d0aa17d4b1cea72b74e62153f75b62e6a9ee6)

平方損失凸且平滑,但容易過度懲罰錯誤預測,導致收斂速度比邏輯損失和鏈結損失慢。它的優點為有助於簡化交叉驗證之正則化(regularization)。
最小化預期風險之映射函數為:


鏈結損失公式等同於支持向量機(SVM)的損失公式。鏈結損失凸但不平滑(在
不可微分),因此不適用於梯度下降法和隨機梯度下降法,但適用次梯度下降法。 最小化預期風險之映射函數為:


其中

適用於梯度下降法,但不會對錯誤預測做懲罰。 最小化預期風險之映射函數為:


其中
so that
屬於凸函數,適用於隨機梯度下降法。

- ^ Shen, Yi, Loss Functions For Binary Classification and Class Probability Estimation (PDF), University of Pennsylvania, 2005 [6 December 2014], (原始内容存档 (PDF)于2019-06-14)
- ^ Rosasco, Lorenzo; Poggio, Tomaso, A Regularization Tour of Machine Learning, MIT-9.520 Lectures Notes, Manuscript, 2014
可微分计算 |
---|
概论 | |
---|
概念 | |
---|
应用 | |
---|
硬件 | |
---|
软件库 | |
---|
架构 | |
---|
主题 分类 |