Data & ComputingInformationstheorieUniversity
AQAAPOntarioNSWCBSEGCE O-LevelMoECAPS

Kreuzentropie (Bernoulli) Calculator

Kreuzentropie zwischen wahrer Bernoulli(p)- und Modell-Bernoulli(q)-Verteilung.

Use the free calculatorCheck the variablesOpen the advanced solver
This is the free calculator preview. Advanced walkthroughs stay in the app.
Result
Ready
Cross-Entropy

Formula first

Overview

Die Kreuzentropie für eine Bernoulli-Verteilung quantifiziert die Divergenz zwischen der wahren binären Wahrscheinlichkeit p und der vorhergesagten Wahrscheinlichkeit q. Sie ist die Standardmetrik in der binären Klassifikation, um Modelle danach zu bestrafen, wie stark ihre vorhergesagte Verteilung von der tatsächlichen Zielverteilung abweicht.

Symbols

Variables

H(p,q) = Cross-Entropy, p = True Probability, q = Model Probability

H(p,q)
Cross-Entropy
nats
True Probability
Variable
Model Probability
Variable

Apply it well

When To Use

When to use: Wende diese Gleichung an, wenn du binäre Klassifikationsmodelle bewertest, bei denen die Ergebnisse gegenseitig ausschließend sind. Sie ist die primäre Verlustfunktion beim Training logistischer Regressionsmodelle und binärer neuronaler Netze.

Why it matters: Diese Funktion ist für Klassifikation dem mittleren quadratischen Fehler überlegen, weil sie stärkere Gradienten liefert, wenn das Modell selbstsicher falsch liegt. Das führt zu schnellerer Konvergenz bei Optimierungsverfahren wie dem Gradientenabstieg.

Avoid these traps

Common Mistakes

  • Prozentwerte statt Wahrscheinlichkeiten verwenden (0.7 statt 70).
  • ln von 0 berechnen (q muss strikt zwischen 0 und 1 liegen).

One free problem

Practice Problem

Ein Modell des maschinellen Lernens sagt eine Wahrscheinlichkeit von 0.7 (q) voraus, dass ein Bild eine Katze enthält. Das Bild zeigt tatsächlich eine Katze (p = 1.0). Berechne die binäre Kreuzentropie für diese Vorhersage in Nats.

Hint: Da p = 1 ist, wird der Term (1-p) zu null, sodass du nur -ln(q) berechnen musst.

The full worked solution stays in the interactive walkthrough.

References

Sources

  1. Wikipedia: Cross-entropy
  2. Elements of Information Theory (2nd ed.) by Thomas M. Cover and Joy A. Thomas
  3. Deep Learning by Ian Goodfellow, Yoshua Bengio, and Aaron Courville
  4. Elements of Information Theory (Cover and Thomas)
  5. Cover, Thomas M., and Joy A. Thomas. Elements of Information Theory. 2nd ed. Wiley-Interscience, 2006.
  6. Goodfellow, Ian, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016.