Log-likelihood, Machine learning

81 Views Asked by At

I'm referring to this practice problem here,

https://davidrosenberg.github.io/mlcourse/ConceptChecks/10-Lab-Check_sol.pdf

In particular, on Page $2$, the second equation of the solution, when it used log to find the likelihood function, I don't understand why is the $-1$ term not included in the summation part.

From my understand, it should be $$\sum_{i = 1}^{n} (x_i - 1) = \sum_{i = 1}^{n} x_i - n$$

But the solution has, $$\sum_{i = 1}^{n} x_i - 1$$

Not sure whether it's a typo or my interpretation is wrong somehow. This is my first time seeing these stuffs actually, like using the log to transform the product to summation. Any help is highly appreciated. Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

It's a typo; you are correct that it should be $\sum_{i=1}^n (x_i - 1)$. (Perhaps they were lazy with parentheses.)

Setting the derivative to zero yields $$\frac{1}{p} - 1 = \frac{"\sum_{i=1}^n x_i - 1"}{n}$$ in their notation, which does not yields the right answer unless the numerator is interpreted as $\sum_{i=1}^n (x_i- 1)$.

0
On

Here's the correction:

We have

$$L(p; x_1, \ldots, x_n) = \prod_{i=1}^n (1-p)^{x_i-1}p $$

Taking logarithm

\begin{align} \log L(p; x_1, \ldots, x_n) = n \log p + \sum_{i=1}^n (x_i-1) \log(1-p) \end{align}

$$\frac{d}{dp}\log L(p; x_1, \ldots, x_n) =\frac{n}{p}- \frac{\sum_{i=1}^n (x_i-1)}{1-p}$$

$$\frac{1}{p}=\frac{\bar{x}-1}{1-p}$$

$$1-p=\bar{x}p-p$$

$$\hat{p}_{MLE}=\frac1{\bar{x}}$$