Skip to content

Commit

Permalink
[Book] sigmoid
Browse files Browse the repository at this point in the history
Type : fix.

Abstract:
* sigmoid
  • Loading branch information
JackFunfia committed Jun 1, 2023
1 parent c968d3f commit bee7e00
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ch03/sigmoid_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import matplotlib.pyplot as plt
import numpy as np


def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))


z = np.arange(-7, 7, 0.1)
phi_z = sigmoid(z)
plt.plot(z, phi_z)
plt.axvline(0.0, color="k")
plt.ylim(-0.1, 1.1)
plt.xlabel("z")
plt.ylabel("$\phi (z)$")
plt.yticks([0.0, 0.5, 1.0])
ax = plt.gca()
ax.yaxis.grid(True)
plt.tight_layout()

plt.show()

0 comments on commit bee7e00

Please sign in to comment.