Mean Square Error
\[cost(t,o)=\frac{1}{n}\sum\limits_{i=1}^n{(o-t)^2}\]
Binary Cross-Entropy
用於計算 target 和 output 之間的binary 交叉熵。\[cost(t,o)=-{[t\ln(o) + (1-t)\ln (1-o)]}\]
也可以寫作:
\[cost(t,o)=\left\{\begin{array}{*{20}{l}}
{\ln o, ~~~~~~t=1,}\\ {\ln (1-o), t=0} \end{array}\right.\]
只不過上面的是一個分段函數,計算的時候不方便。
Categorical Cross-Entropy
度量兩個分布之間的距離,記為 $H(p,q)$。
\[H(p,q)=-\sum\limits_x{p(x)\log (q(x))}\]
其中 $p$是 真實分布, $p=[p_1,p_2\cdots,p_n]$. $q$ 是近似分布,$q=[q_1,q_2\cdots,q_n]$.
當兩個概率分布完全相同時,即:
\[p(x)=q(x),x=1,2,\cdots,n\]
其相對熵為0。