-
multi-class vs multi-label * multi-class: 很多class但最終預測只有一個class(1,0,0), eg.動物分類器, MNIST數字分類器 * mulyi-label: 很多class,最終預測多個class(1,1,0), eg. 電影分類(可能同時是科幻, 劇情, 動作)
-
classification loss * only right or wrong * 0.1, 0.9 vs 0.4, 0.6 的loss都是一樣的, 但很明顯後者需要改變 * cant backprob?
-
0/1 loss * $loss_i = 0$ only when $y_{i,true} = y_{i,pred}$, 太嚴格 * not convex, 難以優化
-
perceptron loss * 0/1 loss 的改進版 * $loss_i = 0$ when * 有另一版本是hinge loss的變種? $|y_{i,true}-y_{i,pred}|>t,\ t$為thread value
-
cross entropy * information gain
- 公式: $\ I(x) = -log(p_i)$
- 越確定的訊息量越低 $p = 100%$ * entropy
- 公式: $\ H(X) = \sum_{i=0}^{N}-p_ilog(p_i)$
- 測量不確定性
- 越不確定越隨機($p = 50\%$), entropy越高 * 公式(有些人有除以N): $\ L(X)=H(X) = \sum_{i=1}^{N}\sum_{c=1}^{C}-y_{true,i,c}log(p_{i,c})$
- 二分類問題: $y_{true,i}= 0\ or\ 1\ for\ label_1\ or\ label_2\ \\y_{pred,i,1},y_{pred,i,2}=(p_1, p_2),\ 其中p_1+p_2=1\ \\L(X)=\sum_{i=1}^{N}ylog(a)+(1-y)log(1-a),\ 其中
\\y=y_{true,i}\ and\ a=y_{pred,i,1}\ and\ (1-a)=y_{pred,i,2}$
- **多分類問題:***可以簡化, 因為 multi-classification 中y_true向量為OHE, 其中只會有一個類別=1, 其餘=0
- log loss 即為簡化後之結果: $\ H(X) = \sum_{i=1}^{N}-log(p_{i})$
- 通常用於logistic regression * 應用
- categorical vs sparse CE
- 其實loss func都一樣, pred也都是prob vector, 差別在label的格式不一樣:OHE or int-encoded
- categorical CE is for OHE Label, eg. [1, 0, 0], [0, 0, 1]
- sparese CE is for int label, eg. [1], [3], [2]
- 其實只是運算過程簡化, 直接取出label對應的pred vector element
- when you have many classes (and samples), in which case a one-hot encoding can be significantly more wasteful than a simple integer
- integer encoding is more compact than one-hot encoding and thus more suitable for encoding sparse binary data.
- only suitable for "sparse labels", where original vector has exactly one value is 1 and all others are 0
- sigmoid vs softmax
- sigmoid is for 二元分類, softmax 則是泛化於多分類multi-classification
- why sigmoid+BCE 用於二分類:$y_{pred,i,1} = \frac{e^{-\betaX}}{1+e^{-\betaX}}\ \ (1)\y_{pred,i,2} = \frac{1}{1+e^{-\beta*X}}\ \ (2)\y_{pred,i,1}+y_{pred,i,2} = 1\ \ (1)+(2)$
- 承上, 可推 softmax+CE 用於多分類
- multi-label
- 要用BCE而不是Categorical CE, 因為後者只計算唯一個標籤值為1的狀況
- 也可用Sigmoid activation + normal CE
-
hinge loss * 公式: $loss_i = max(0, 1-y_{true,i}y_{pred,i}),其中\y_{true,i}=-1\ or\ 1$ * 並不鼓勵分類器太過自信:让某个正确分类的样本距离分割线超过1并不会有任何奖励,从而使分类器可以更专注于整体的误差。$if\ y_{true,i}, y_{pred,i} = 1, 100\=>\ max(0, 1-1100)\ is\ still\ 0$ * 用於二分類, SVM, 間隔最大化問題