Categories

Technology

Entropy, Cross-Entropy and KL Divergence

Entropy measures the average uncertainty of a distribution in bits, cross-entropy measures the cost of coding the real data with a wrong model, and KL divergence is the gap between the two. That is why minimising cross-entropy during training is the same as minimising the KL divergence from the labels.

Technology

Categorical Cross-Entropy

Categorical cross-entropy is the standard loss function for classifying into several mutually exclusive classes. It compares the distribution the network predicts, usually after a softmax, with the true label written in one-hot format, and it penalises heavily any low probability assigned to the correct class.

Technology

Binary Cross-Entropy

Binary cross-entropy is the standard loss function for two-class classification. It compares the probability returned by the sigmoid with the true label, 0 or 1, and punishes confident mistakes hard. Its formula comes from maximum likelihood, and its derivative combines with the sigmoid into a very simple gradient.

Technology

The Exponential and Natural Logarithm in Deep Learning

The exponential function eˣ and its inverse, the natural logarithm ln(x), appear again and again in deep learning. The exponential builds the sigmoid and softmax that turn numbers into probabilities, while the natural logarithm defines cross-entropy, the loss used to train almost every classifier in practice today.