tf.keras.activations.sigmoid

tf.keras.activations.sigmoid는 Sigmoid 함수를 적용합니다.



예제

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt

plt.rcParams['figure.figsize'] = (6, 3)

x = np.linspace(-10, 10, 21)
y = tf.keras.activations.sigmoid(x).numpy()

print(x)
print(y)

plt.plot(x, y, 'o-')
plt.xlabel('X')
plt.ylabel('Y')
plt.tight_layout()
plt.show()
[-10.  -9.  -8.  -7.  -6.  -5.  -4.  -3.  -2.  -1.   0.   1.   2.   3.
 4.   5.   6.   7.   8.   9.  10.]
[4.53978687e-05 1.23394576e-04 3.35350130e-04 9.11051194e-04
2.47262316e-03 6.69285092e-03 1.79862100e-02 4.74258732e-02
1.19202922e-01 2.68941421e-01 5.00000000e-01 7.31058579e-01
8.80797078e-01 9.52574127e-01 9.82013790e-01 9.93307149e-01
9.97527377e-01 9.99088949e-01 9.99664650e-01 9.99876605e-01
9.99954602e-01]

tf.keras.activations.sigmoid는 입력값에 Sigmoid 함수를 적용합니다.

y = sigmoid(x) = 1 / (1 + exp(-x))와 같습니다.


tf.keras.activations.sigmoid


이전글/다음글