Machine Learning & AI
Basic

Binary Cross-Entropy

Loss for binary classification comparing predicted probability to the true label.

Formula

L=[ylogy^+(1y)log(1y^)]L = -\big[y\log\hat{y} + (1-y)\log(1-\hat{y})\big]

Variables

yTrue label (0/1)
\hat{y}Predicted probability

Example

y=1, y_hat=0.9: L=-log0.9=0.105

Did You Know?

Cross-entropy comes straight from information theory — it measures surprise between distributions.

Share this formula