- Home
- /
- Posts
- /
- Deep Learning
Sigmoid Function (Logistics Function)
Table of Contents
Sigmoid Function
$ S(x) = \dfrac{1}{1 + e^{ax}} = \dfrac{\tanh(ax/2) + 1}{2} $
ここで、$ a $はgainである。
Artificial neural networkのコンテキストでは、sigmoid functionはlogistics functionの同義語である。
Softmax functionはsigmoid functionのone-hot arg maxの滑らかな近似である。
Standard Sigmoid Function
$ S(x) = \dfrac{1}{1 + e^x} = \dfrac{\tanh(x/2) + 1}{2} $
ここで、gain $ a $は1である。
Standard sigmoid functionの逆関数はlogit関数である。
Python Script
import matplotlib.pyplot as plt
import numpy as np
# Sigmoid function
def sigmoid(x):
return 1 / (1 + np.exp(-x))
# Generate x values
x = np.linspace(-10, 10, 100)
# Calculate corresponding y values
y = sigmoid(x)
# Create the plot
plt.plot(x, y)
plt.xlabel("x")
plt.ylabel("sigmoid(x)")
plt.title("Sigmoid Function")
plt.grid(True)
# Save the plot to storage
plt.savefig('./sigmoid_function.jpg')
# Display the plot
plt.show()
