Sigmoid to $\tanh$: why scale the $x$?

169 Views Asked by At

Given the sigmoid function:

$$s(x) = \frac{1}{1 + e^{-x}}$$

And the $\tanh$ function:

$$\tanh(x) = 2s(2x) - 1$$

It makes sense to me that we would:

1) scale the y-axis to "stretch" the graph's range to $(0,2)$ from $(0,1)$

2) subtract 1 to "move" the graph down to the range $(-1,1)$

Please explain why we scale the $x$ ie $s(2x)$? An intuitive explanation would be valuable to understand what is happening here. Is this just by definition?

1

There are 1 best solutions below

0
On BEST ANSWER

By definition we have

$$\tanh x := \dfrac{\sinh x}{\cosh x} = \dfrac{e^x-e^{-x}}{e^x+e^{-x}}=\dfrac{e^x+e^{x}-e^{x}-e^{-x}}{e^x+e^{-x}}=2\dfrac{e^x}{e^x+e^{-x}}-1$$

$$=2\dfrac{e^xe^{-x}}{e^xe^{-x}+e^{-x}e^{-x}}-1=2\dfrac{1}{1+e^{-2x}}-1=2s(2x)-1$$