Command Palette
Search for a command to run...
Cross-Entropy
Cross-Entropy (CE) is a metric in information theory used to measure the difference between two probability distributions, and is widely used in machine learning as a loss function for classification tasks. Its idea can be traced back to Claude Shannon's 1948 paper "A Mathematical Theory of Communication" published while he worked at Bell Labs; that paper established the definition of information entropy, and cross-entropy is a natural subsequent extension of it.
In information theory, cross-entropy measures the average code length required to encode the true distribution p using the predicted distribution q. In neural networks, true labels are usually processed as one-hot distributions, while the model's output (e.g., after Softmax or Sigmoid activation) is treated as the predicted distribution. Minimizing the cross-entropy loss is equivalent to minimizing the Kullback-Leibler divergence (KL divergence) between the predicted distribution and the true distribution, thereby making the model output as close as possible to the true labels.
Because cross-entropy has convex function properties and simple gradient computation (especially when combined with Softmax, where the gradient is exactly the difference between the predicted value and the true value), it avoids the vanishing gradient problem that mean squared error easily suffers from in classification problems. This characteristic makes it the most standard and core loss function in modern deep learning classification tasks.
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.