Jump to content

Log probability

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Kmels (talk | contribs) at 00:14, 4 April 2012 (link what's the standard use of real numbers in computers.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science, the use of log probabilities is a way to represent probabilities in a way which has several practical computational advantages over the standard use of approximated real numbers in the interval.

The log probability representation is to store a probability as . The product of probabilities can be written as ; the sum of probabilities is more complex to express and is written as . Note, however, that we can avoid to incur the cost of this computation by approximating the sum of two probabilities by the highest probability, at the expense of accuracy.

Representing probabilities in this way has two main advantages:

  1. Speed. Since multiplication is more expensive than addition, taking the product of a high number of probabilities is faster if they are represented in log form. (The conversion to log form is expensive, but is only incurred once.)
  2. Accuracy. The use of log probabilities improves numerical stability.

The use of log probabilities is widespread in several fields of computer science such as information theory and natural language processing.