TITLE: Why we consider log likelihood instead of Likelihood in Gaussian Distribution
QUESTION [59 upvotes]: I am reading Gaussian Distribution from a machine learning book. It states that - 

We shall determine values for the unknown parameters $\mu$ and
  $\sigma^2$ in the Gaussian by maximizing the likelihood function. In practice, it is more convenient to maximize the log of the likelihood
  function. Because the logarithm is monotonically increasing function
  of its argument, maximization of the log of a function is equivalent
  to maximization of the function itself. Taking the log not only
  simplifies the subsequent mathematical analysis, but it also helps
  numerically because the product of a large number of small
  probabilities can easily underflow the numerical precision of the
  computer, and this is resolved by computing instead the sum of the log
  probabilities.

can anyone give me some intuition behind it with some example? Where the log likelihood is more convenient over likelihood. Please give me a practical example.
Thanks in advance!

REPLY [3 votes]: Maybe a practical example for computer scientists: As @jojek mentioned
$$p(X|\Theta) = \prod_{i=1}^N p(x_i|\Theta)$$
and
$$\ln p(X| \Theta) = \sum_{i=1}^N \ln p(x_i| \Theta)$$
So if you execute a little python script you can directly see it:
>>> import numpy as np

# Create some small probability values.
>>> r = np.random.random_sample((100,)) * 0.000001

# Take the log of each (I ignore the logarithms basis, because it does not matter here).
>>> l = [np.log(x) for x in r]
# Compute product of probability values.
>>> np.product(r)
0.0

# Compute sum of log of probability values.
>>> np.sum(l)
-1472.245511811776


Here you can see that it is more practical to work with logarithms. Especially in machine learning where you compute with many very small numbers (e.g. check the weights of a neural network) this can lead to much better results.