Skip to content

Instantly share code, notes, and snippets.

@sfujiwara
Last active May 9, 2017 08:34
Show Gist options
  • Save sfujiwara/7492206da4859c673f4bb5724d8a3865 to your computer and use it in GitHub Desktop.
Save sfujiwara/7492206da4859c673f4bb5724d8a3865 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
# Parameters used frequently
plt.rcParams['axes.labelsize'] = 24
plt.rcParams['lines.linewidth'] = 4
plt.rcParams['lines.markersize'] = 10
plt.rcParams['lines.markeredgewidth'] = 3
plt.rcParams['legend.fontsize'] = 18
plt.rcParams['legend.shadow'] = False
plt.rcParams['xtick.labelsize'] = 14
plt.rcParams['ytick.labelsize'] = 14
x = np.linspace(-3, 3, 100)
plt.plot(x, 1/(1+np.exp(-x)), label="Sigmoid")
plt.plot(x, np.tanh(x), label="Tanh")
plt.plot(x, np.maximum(np.zeros(len(x)), x), label="ReLU")
plt.plot(x, (x>0), label="Step")
plt.legend(loc="left")
plt.grid()
plt.ylim(-1.5, 1.5)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment