Implementieren Sie die Sigmoid-Funktion mit Numpy
Mithilfe der Sigmoid- Aktivierungsfunktion können wir den Verlust während der Trainingszeit reduzieren, da das Gradientenproblem im Modell des maschinellen Lernens während des Trainings beseitigt wird.
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()
Ausgabe :
Beispiel 1 :
import
matplotlib.pyplot as plt
import
numpy as np
import
math
x
=
np.linspace(
-
100
,
100
,
200
)
z
=
1
/
(
1
+
np.exp(
-
x))
plt.plot(x, z)
plt.xlabel(
"x"
)
plt.ylabel(
"Sigmoid(X)"
)
plt.show()
Ausgabe :