- 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.
- Learning Microsoft Windows Server 2012 Dynamic Access Control
- Java 9 Concurrency Cookbook(Second Edition)
- Python網(wǎng)絡(luò)爬蟲從入門到實踐(第2版)
- OpenStack Cloud Computing Cookbook(Fourth Edition)
- 匯編語言程序設(shè)計(第2版)
- Python機(jī)器學(xué)習(xí)實戰(zhàn)
- 你不知道的JavaScript(中卷)
- 概率成形編碼調(diào)制技術(shù)理論及應(yīng)用
- INSTANT Passbook App Development for iOS How-to
- Mastering JavaScript Design Patterns(Second Edition)
- C語言程序設(shè)計上機(jī)指導(dǎo)與習(xí)題解答(第2版)
- Terraform:多云、混合云環(huán)境下實現(xiàn)基礎(chǔ)設(shè)施即代碼(第2版)
- Visual Studio Code 權(quán)威指南
- Maker基地嘉年華:玩轉(zhuǎn)樂動魔盒學(xué)Scratch
- 現(xiàn)代C:概念剖析和編程實踐