3
$\begingroup$

In the pdf supervised learning from Andrew Ng, p. 23, it is said that if $$\eta = \log(\frac{\phi}{1-\phi})$$ then $$ \phi = \frac{1}{1+e^{-\eta}} $$ I can we prove it step by step?

I tried backward but got stuck \begin{align} \frac{1}{1+e^{-\eta}}&=\phi\\ \implies 1&=\phi(1+e^{-\eta})\\ &= \phi + \frac{\phi}{e^{\eta}}\\ &= \frac{e^{\eta}\phi + \phi}{e^{\eta}}\\ &= \phi\frac{e^{\eta} + 1}{e^{\eta}} \end{align}

Edit (with help of posted answers) \begin{align} 1&= \phi\frac{e^{\eta} + 1}{e^{\eta}}\\ \implies \frac{1}{\phi} &= \frac{e^{\eta} + 1}{e^{\eta}}\\ \implies \phi &= \frac{e^{\eta}}{e^{\eta} + 1}\\ &= \frac{e^{\eta}}{e^{\eta} + 1}\frac{\frac{1}{e^{\eta}}}{\frac{1}{e^{\eta}}}\\ &=\frac{1}{1+ e^{-\eta}} \end{align}

$\endgroup$
3
  • 2
    $\begingroup$ This is a great example of how questions on MSE should be asked, with context and effort despite the relatively simple nature of the question. If only all questions here were like this... $\endgroup$
    – YiFan Tey
    Oct 13, 2019 at 9:54
  • $\begingroup$ Thanks for the positive feedback @YiFan. $\endgroup$
    – ecjb
    Oct 13, 2019 at 10:13
  • 1
    $\begingroup$ I have to say though, that, in this example the context is easy to mention (well known course of andrew Ng available on internet) and the content is also easy (question rather easy: I'm not from a math background). In the past I also posted some not so well received questions: the problem originated from course of a local university (not available on internet) and that formulate the exact formulation of point where I was stuck was itself much more difficult and maybe broader, hence more difficult to write in standard way. I'll try to stick to that example in the future $\endgroup$
    – ecjb
    Oct 13, 2019 at 10:19

3 Answers 3

3
$\begingroup$

$$\eta=\log\frac{\phi}{1-\phi}$$

$$\exp\eta=\frac{\phi}{1-\phi}$$

$$(1-\phi)\exp\eta=\phi$$

$$\exp\eta=\phi(1+\exp\eta)$$

$$\phi=\frac{\exp\eta}{1+\exp\eta}$$ $$\phi=\frac{1}{1+\exp(-\eta)}$$

Side note: in statistics, the function $\phi\to\log\frac{\phi}{1-\phi}$ is called the logit function, and $\eta\to\dfrac{1}{1+\exp(-\eta)}$ is called the logistic function. They are used for logistic regression, for instance.

$\endgroup$
3
$\begingroup$

Alternatively, \begin{align}\eta=\log\frac\phi{1-\phi}&\implies-\eta=-\log\frac\phi{1-\phi}=\log\frac{1-\phi}\phi\\&\implies e^{-\eta}=\frac{1-\phi}\phi=\frac1\phi-1\\&\implies\frac1\phi=1+e^{-\eta}\\&\implies\phi=\frac1{1+e^{-\eta}}.\end{align}

$\endgroup$
1
$\begingroup$

You’re almost there. So $$\phi=\dfrac{e^{\eta}}{e^{\eta}+1}$$ and then just divide top and bottom by $e^{\eta}$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .