Skip to content

Instantly share code, notes, and snippets.

View khellan's full-sized avatar

Knut Hellan khellan

View GitHub Profile
@craffel
craffel / draw_neural_net.py
Created January 10, 2015 04:59
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])