[Math] Sigmoid function

2022. 12. 28. 19:42·.../Math
728x90
728x90

S자형 곡선을 갖는 함수. (대표적인 예가 logistic function이나 sigmoid는 다음과 같이 여러 종류가 있음)

logistic function을 제외한 여러 sigmoid function들.

 

  • Artificial Neural Network의 Artificial Neuron의 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으로 사용됨.

1989년 Universal Approximation Theorem을 통해 Sigmoid를 activation으로 가지는 Nueral Network의 함수 모사 능력이 증명됨.

  • sigmoid activation function을 가지면서
  • 유한한 임의의 갯수의 neuron을 가진
  • 한 hidden layer로 구성된 feedforward neural network 는 어떤 함수도 approximation(근사)할 수 있음

https://ds31x.blogspot.com/2023/08/dl-universal-approximation-theorem-uat.html?view=classic

 

DL : Universal Approximation Theorem (UAT)

Wikipedia 에 있는 설명은 다음과 같음. A feed-forward network with a single hidden layer contating a finite number of neurons can approximate arbitr...

ds31x.blogspot.com

 


관련자료들

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
'.../Math' 카테고리의 다른 글
  • [Math] Random Variable
  • [Math] Taylor Expansion and Taylor Theorem (테일러 전개)
  • [LA] Pseudoinverse Matrix (수정중)
  • [Math] ill-posed, well-posed, ill-conditioned, well-conditioned matrix (or problem)
dsaint31x
dsaint31x
    반응형
    250x250
  • dsaint31x
    Dsaint31's blog
    dsaint31x
  • 전체
    오늘
    어제
    • 분류 전체보기 (738)
      • Private Life (13)
      • Programming (186)
        • DIP (104)
        • ML (26)
      • Computer (118)
        • CE (52)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (349)
        • Signals and Systems (103)
        • Math (170)
        • Linear Algebra (33)
        • Physics (42)
        • 인성세미나 (1)
      • 정리필요. (54)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (1)
        • PET Study 2009 (1)
        • 방사선 장해방호 (4)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

    • Test
    • PET Study 2009
    • 기타 방사능관련.
  • 인기 글

  • 태그

    Vector
    Python
    SIGNAL
    opencv
    SS
    numpy
    Programming
    random
    linear algebra
    math
    검사
    Term
    Convolution
    signals_and_systems
    fourier transform
    Optimization
    Probability
    signal_and_system
    인허가제도
    function
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
dsaint31x
[Math] Sigmoid function
상단으로

티스토리툴바