- Deep Learning with Theano
- Christopher Bourez
- 232字
- 2021-07-15 17:17:00
Classification loss function
The loss function is an objective function to minimize during training to get the best model. Many different loss functions exist.
In a classification problem, where the target is to predict the correct class among k classes, cross-entropy is commonly used as it measures the difference between the real probability distribution, q, and the predicted one, p, for each class:

Here, i is the index of the sample in the dataset, n is the number of samples in the dataset, and k is the number of classes.
While the real probability

of each class is unknown, it can simply be approximated in practice by the empirical distribution, that is, randomly drawing a sample out of the dataset in the dataset order. The same way, the cross-entropy of any predicted probability, p
, can be approximated by the empirical cross-entropy:

Here,

is the probability estimated by the model for the correct class of example

.
Accuracy and cross-entropy both evolve in the same direction but measure different things. Accuracy measures how much the predicted class is correct, while cross-entropy measure the distance between the probabilities. A decrease in cross-entropy explains that the probability to predict the correct class gets better, but the accuracy may remain constant or drop.
While accuracy is discrete and not differentiable, the cross-entropy loss is a differentiable function that can be easily used for training a model.
- Mastering AWS Lambda
- INSTANT FreeMarker Starter
- C++面向對象程序設計(微課版)
- Offer來了:Java面試核心知識點精講(原理篇)
- Ext JS 4 Web Application Development Cookbook
- Scala編程實戰(原書第2版)
- Android程序設計基礎
- PHP+Ajax+jQuery網站開發項目式教程
- Scala編程(第5版)
- 大學計算機基礎實驗指導
- 測試架構師修煉之道:從測試工程師到測試架構師
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- 零基礎C#學習筆記
- 產品架構評估原理與方法
- Effective C++:改善程序與設計的55個具體做法(第三版)中文版(雙色)