starting to get a decent DAG

This commit is contained in:
Robin Clark 2010-11-30 17:53:42 +00:00
parent de910c2d6d
commit 5e9e0bdc65

View File

@ -27,30 +27,40 @@ like this neural network diagram.
\tikzstyle{annot} = [text width=4em, text centered]
% Draw the input layer nodes
\foreach \name / \y in {1,...,4}
%\foreach \name / \y in {1,...,4}
% This is the same as writing \foreach \name / \y in {1/1,2/2,3/3,4/4}
\node[component, pin=left:Input \#\y] (I-\name) at (0,-\y) {};
% \node[component, pin=left:Input \#\y] (I-\name) at (0,-\y) {};
\node[component] (C-1) at (0,-1) {$C^0_1$};
\node[component] (C-2) at (0,-3) {$C^0_2$};
%\node[component] (C-3) at (0,-5) {$C^0_3$};
%\node[component] (K-4) at (0,-8) {$K^0_4$};
%\node[component] (C-5) at (0,-10) {$C^0_5$};
%\node[component] (C-6) at (0,-12) {$C^0_6$};
%\node[component] (K-7) at (0,-15) {$K^0_7$};
% Draw the hidden layer nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[failure] (H-\name) at (\layersep,-\y cm) {};
%\foreach \name / \y in {1,...,5}
% \path[yshift=0.5cm]
\node[failure] (C-1a) at (\layersep,-1) {a};
\node[failure] (C-1b) at (\layersep,-2) {b};
% Draw the output layer node
\node[symptom,pin={[pin edge={->}]right:Output}, right of=H-3] (O) {};
\node[symptom,pin={[pin edge={->}]right:Output}, right of=C-1a] (O) {};
% Connect every node in the input layer with every node in the
% hidden layer.
\foreach \source in {1,...,4}
\foreach \dest in {1,...,5}
\path (I-\source) edge (H-\dest);
%\foreach \source in {1,...,4}
% \foreach \dest in {1,...,5}
\path (C-1) edge (C-1a);
\path (C-1) edge (C-1b);
% Connect every node in the hidden layer with the output layer
\foreach \source in {1,...,5}
\path (H-\source) edge (O);
%\foreach \source in {1,...,5}
% \path (H-\source) edge (O);
% Annotate the layers
\node[annot,above of=H-1, node distance=1cm] (hl) {Hidden layer};
\node[annot,above of=C-1a, node distance=1cm] (hl) {Hidden layer};
\node[annot,left of=hl] {Input layer};
\node[annot,right of=hl] {Output layer};
\end{tikzpicture}