S자형 곡선을 갖는 함수. (대표적인 예가 logistic function이나 sigmoid는 다음과 같이 여러 종류가 있음)
- Artificial Neural Network의 Artificial Neron의 Activation function으로 초창기에 많이 사용되었음.
- Logistic distribution, normal distribution, student $t$ distribution등의 probability distribution(확률 분포)들의 cumulative distribution function (cdf)이 바로 sigmoid function임.
- 때문에 sigmoid function에 대한 derivative는 normal distribution처럼 대칭이고 종모양의 분포를 보이는 함수임.
여러 종류의 function이 sigmoid function에 속하지만, 대표적 예는 logistic function임.
$$f(x)=\dfrac{1}{1+e^{-x}}=\dfrac{e^x}{e^x+1}$$
https://dsaint31.tistory.com/613
[Math] Derivative of Logistic Function
$y=\sigma(x)=\dfrac{1}{1+e^{-x}}$ 를 미분하면 다음과 같음. $$\frac{d}{dx}\sigma(x)= \sigma(x)(1-\sigma(x))$$ graph 유도 유도는 다음과 같음. $$\begin{aligned}\frac{d}{dx}\sigma(x)&= -\dfrac{1}{(1+e^{-x})^2}e^{-x}(-1) \\ &= \frac{e^{-x}}{
dsaint31.tistory.com
Python Code
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
x = np.linspace(-5,5, 100)
y = 1 / (1 + np.exp(-x))
plt.plot(x,y)
plt.title('logistic function')
plt.xlabel(r'$x$')
plt.ylabel(r'$\frac{1}{1+e^{-x}}$')
plt.axhline(0.5, c='r', ls='--')
plt.axvline(0., c='r', ls='--')
plt.show()
Sigmoid for Activation Function (Logistiction Function에 대한 내용임)
- 함수에 exponential function (지수 함수)가 포함되어 있어서 연산 비용이 큰 편임.
- positive value만 출력하는 특성 및 양 끝단에서의 변화율이 0이라 Gradient vanishing이 발생하기 쉽고, 학습 속도도 느린 편임.
- 때문에, 최근의 ANN의 hidden layer에서는 거의 사용되지 않음.
- regression에서 range를 제한해야하는 경우 최종 출력단의 activation function으로 사용되거나, binary classification의 activation으로 사용됨.
관련자료들
https://dsaint31.tistory.com/320
[ML] Logit에서 Logistic Function.
Logit (또는 Log Odds) score를 이용한 classification이 바로 Logistic Regression임. (logistic function의 generalization은 softmax function임.) 달리 말하면, Logistic Regresson은 linear regression $\omega_0+\omega_1x_1+\dots+\omega_nx_n$으
dsaint31.tistory.com
2023.08.13 - [Computer] - [DL] Hyperbolic Tangent Function (tanh)
[DL] Hyperbolic Tangent Function (tanh)
logistic function과 함께 sigmoid의 대표적인 함수가 바로 $\text{tanh}$임. 값이 $[-1,1]$의 range를 가지며, logistic에 비해 기울기가 보다 급격하기 때문에 좀 더 빠른 수렴속도를 보임. 하지만, sigmoid의 일종
dsaint31.tistory.com
'... > Math' 카테고리의 다른 글
[Math] Random Variable (0) | 2023.03.09 |
---|---|
[Math] Taylor Expansion and Taylor Theorem (테일러 전개) (0) | 2023.02.27 |
[LA] Pseudoinverse Matrix (수정중) (0) | 2022.12.02 |
[Math] ill-posed, well-posed, ill-conditioned, well-conditioned matrix (or problem) (0) | 2022.12.02 |
[LA] 예제: Eigenvalue, Eigenvector 구하기 (0) | 2022.12.01 |