Coding
sigmoid function
linguana
2021. 6. 3. 15:54
수학적으로, 시그모이드 함수는 다음과 같이 정의된다:
이를 코드로 구현하면 다음과 같다:
# Import matplotlib, numpy and math
import matplotlib.pyplot as plt
import numpy as np
import math
x = np.linspace(-10, 10, 100)
z = 1/(1 + np.exp(-x))
plt.plot(x, z)
plt.xlabel("x")
plt.ylabel("Sigmoid(X)")
plt.show()
plt에서 보여지는 그림은 다음과 같다:
시그모이드 함수는 다음과 같은 중요한 성질을 가진다:
1) 미분 가능하다.
2) y (혹은 output)의 범위는 [0,1]이다.
Reference
Implement sigmoid function using Numpy - GeeksforGeeks