feed-forward-perceptron.tex 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{tikz}
  5. \usetikzlibrary{arrows}
  6. \tikzstyle{input}=[draw,fill=red!50,circle,minimum size=10pt,inner sep=0pt]
  7. \tikzstyle{hidden}=[draw,fill=green!50,circle,minimum size=10pt,inner sep=0pt]
  8. \tikzstyle{output}=[draw,fill=blue!50,circle,minimum size=10pt,inner sep=0pt]
  9. \tikzstyle{bias}=[draw,dashed,fill=gray!50,circle,minimum size=10pt,inner sep=0pt]
  10. \begin{document}
  11. \begin{preview}
  12. \begin{tikzpicture}
  13. \node (b1)[bias] at (-1,0) {};
  14. \node (b2)[bias] at (-0.5,1) {};
  15. \node (i1)[input] at (0,0) {};
  16. \node (i2)[input] at (1,0) {};
  17. \node (i3)[input] at (2,0) {};
  18. \node (i4)[input] at (3,0) {};
  19. \node (i5)[input] at (4,0) {};
  20. \node (h1)[hidden] at (0.5,1) {};
  21. \node (h2)[hidden] at (1.5,1) {};
  22. \node (h3)[hidden] at (2.5,1) {};
  23. \node (o1)[output] at (1.5,2) {};
  24. \draw[->, thick] (b2) -- (o1);
  25. \draw[->, thick] (h1) -- (o1);
  26. \draw[->, thick] (h2) -- (o1);
  27. \draw[->, thick] (h3) -- (o1);
  28. \foreach \j in {1, ..., 3}{
  29. \foreach \i in {1, ..., 5}{
  30. \draw[<-, thick] (h\j) -- (i\i);
  31. }
  32. \draw[<-, thick] (h\j) -- (b1);
  33. }
  34. \end{tikzpicture}
  35. \end{preview}
  36. \end{document}