Search Ctrl K
Home / Tools
THE FEUTEX TOOLKIT

Bernoulli KL Divergence

Measure the information penalty of using one binary event probability in place of another.

Statistics workspace● Runs in your browser
01 Your input
02 Your result
View or copy raw result data
FormulaKl = p*log(p/q)+(1-p)*log((1-p)/(1-q)); Cross Entropy = -p*log(q)-(1-p)*log(1-q)
Sources and model references

Made for real tasks

  • Measure the information penalty of using one binary event probability in place of another.
Explore step-by-step workflows →

Worked example

Inputs

True event probability
0.2 probability
Model event probability
0.4 probability

Expected results

Kl
0.09151622185 nats
Cross Entropy
0.5919186454 nats

Load the example in the workspace to reproduce these results. Display rounding does not change the underlying calculation.

How to use this tool

  1. Enter true event probability, model event probability.
  2. Use the displayed units and confirm the model assumptions.
  3. Calculate and compare the outputs against your input scenario.

Try this example

{
  "p": 0.2,
  "q": 0.4
}

Accuracy and scope

Probabilities are restricted away from exact endpoints for finite logarithms; this is not a hypothesis test.

Is my data uploaded?

This tool runs locally in your browser. Input and output are not sent to a processing server. Copy or download your result before leaving the page.