We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d28a94 commit bcfcf75Copy full SHA for bcfcf75
fig/chap3/relu.png
25.3 KB
fig/chap3/relu.py
@@ -0,0 +1,24 @@
1
+"""
2
+relu
3
+~~~~
4
+
5
+Plots a graph of the squashing function used by a rectified linear
6
+unit."""
7
8
+import numpy as np
9
+import matplotlib.pyplot as plt
10
11
+z = np.arange(-2, 2, .1)
12
+zero = np.zeros(len(z))
13
+y = np.max([zero, z], axis=0)
14
15
+fig = plt.figure()
16
+ax = fig.add_subplot(111)
17
+ax.plot(z, y)
18
+ax.set_ylim([-2.0, 2.0])
19
+ax.set_xlim([-2.0, 2.0])
20
+ax.grid(True)
21
+ax.set_xlabel('z')
22
+ax.set_title('Rectified linear unit')
23
24
+plt.show()
0 commit comments