👍 Loss Functions

👍 Loss Functions

  • Quantifies what it means to have a “good” model
  • Different types of loss functions for different tasks, such as:
    • Classification
    • Regression
    • Metric Learning
    • Reinforcement Learning

Classification

  • Classification: Predicting a discrete class label

  • Negative log-likelihood loss (per sample xx) / Cross-Entropy loss

    L(x,y)=_jyjlogp(c_jx) L(\boldsymbol{x}, y)=-\sum\_{j} y_{j} \log p\left(c\_{j} \mid \boldsymbol{x}\right)
    • Used in various multiclass classification methods for NN training
  • Hinge Loss: used in Support Vector Machines (SVMs)

    L(x,y)=_jmax(0,1x_iy_i) L(x, y)=\sum\_{j} \max \left(0,1-x\_{i} y\_{i}\right)

Regression

  • Regression: Predicting a one or multiple continuous quantities y1,,y_ny_1, \dots, y\_n

  • Goal: Minimize the distance between the predicted value y^_j\hat{y}\_j and true values yjy_j

  • L1-Loss (Mean Average Error)

    L(y^,y)=_j(y^_jx_j) L(\hat{y}, y)=\sum\_{j}\left(\hat{y}\_{j}-x\_{j}\right)
  • L2-Loss (Mean Square Error, MSE)

    L(y^,y)=_j(y^_jx_j)2 L(\hat{y}, y)=\sum\_{j}\left(\hat{y}\_{j}-x\_{j}\right)^2

Metric Learning / Similarity Learning

  • A model for measuring the distance (or similarity) between objects

  • Triplet Loss

    截屏2020-08-17 12.20.34

    \sum_{(a, p, n) \in T} \max \left\\{0, \alpha-\left\|\mathbf{x}\_{a}-\mathbf{x}\_{n}\right\|\_{2}^{2}+\left\|\mathbf{x}\_{a}-\mathbf{x}\_{p}\right\|\_{2}^{2}\right\\}