Skip to content

Instantly share code, notes, and snippets.

@thigm85
Created May 26, 2013 15:10
Show Gist options
  • Save thigm85/5653059 to your computer and use it in GitHub Desktop.
Save thigm85/5653059 to your computer and use it in GitHub Desktop.
Graphviz script to draw a simple neural network diagram. Copy this to a `file.txt` file and then run `dot -Tpng -O file.txt` from command-line to get a .png figure with the diagram.
digraph G {
rankdir=LR
splines=line
node [fixedsize=true, label=""];
subgraph cluster_0 {
color=white;
node [style=solid,color=blue4, shape=circle];
x1 x2 x3;
label = "layer 1 (Input layer)";
}
subgraph cluster_1 {
color=white;
node [style=solid,color=red2, shape=circle];
a12 a22 a32;
label = "layer 2 (hidden layer)";
}
subgraph cluster_2 {
color=white;
node [style=solid,color=seagreen2, shape=circle];
O;
label="layer 3 (output layer)";
}
x1 -> a12;
x1 -> a22;
x1 -> a32;
x2 -> a12;
x2 -> a22;
x2 -> a32;
x3 -> a12;
x3 -> a22;
x3 -> a32;
a12 -> O
a22 -> O
a32 -> O
}
@thigm85
Copy link
Author

thigm85 commented May 26, 2013

Graphviz script to draw a simple neural network diagram. Copy this to a file.txt file and then run dot -Tpng -O file.txt from command-line to get a .png figure with the diagram.

@fuhrmanator
Copy link

You can also put it into plantuml.com's renderer, putting @startdot/@enddot around the code. PlantUML's rendering

@nguwahkyaw
Copy link

How to add dropout neuron?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment