Difference Between KL Divergence and Cross-Entropy

 

Difference Between KL Divergence and Cross-Entropy 

PointKL DivergenceCross-Entropy
1. MeaningMeasures the difference (information loss) between true distribution PP and model QQ.Measures the total coding cost of representing PP using QQ.
2. FormulaDKL(PQ)=P(x)logP(x)Q(x)D_{KL}(P\|Q)=\sum P(x)\log\frac{P(x)}{Q(x)}H(P,Q)=P(x)logQ(x)H(P,Q)=-\sum P(x)\log Q(x)
3. RelationDKL(PQ)=H(P,Q)H(P)D_{KL}(P\|Q)=H(P,Q)-H(P)H(P,Q)=H(P)+DKL(PQ)H(P,Q)=H(P)+D_{KL}(P\|Q)
4.InterpretationExtra error caused by using the wrong model.Total uncertainty/error when predicting with the model.
5. Use in MLUsed to compare distributions (e.g., variational inference, VAEs).Used directly as a loss function in classification problems.

Comments

Popular posts from this blog

Advanced Mathematics for Computer Science HNCST409 KTU BTech Honors 2024 Scheme

Convex and Non Convex Sets

Gradient-Based Methods for Optimization-Gradient Descent Algorithm