Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Created April 26, 2020 13:05
Show Gist options
  • Save Mehdi-Amine/d0889b465d4a32b8e4f474fc74b10ad7 to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/d0889b465d4a32b8e4f474fc74b10ad7 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#%matplotlib widget # Uncomment if working with widgets on a jupyter nb
def plot_sgd(params):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(params[:, 0], params[:, 1], params[:, 2])
ax.set_xlabel('Bias')
ax.set_ylabel('Weight 1')
ax.set_zlabel('Weight 2')
plt.show()
params = np.array(perceptron.parameters_as_they_change)
plot_sgd(params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment