cascade-correlation-network.tex 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{amsmath}
  5. \usepackage{tikz}
  6. \usetikzlibrary{shapes, calc, shapes, arrows, snakes}
  7. \newcommand{\width}{0.2}
  8. \begin{document}
  9. \begin{preview}
  10. \tikzset{sigmoid/.style={path picture= {
  11. \begin{scope}[x=1pt,y=10pt]
  12. \draw plot[domain=-7:7] (\x,{1/(1 + exp(-\x))-0.5});
  13. \end{scope}
  14. }
  15. }
  16. }
  17. \tikzset{relu/.style={path picture= {
  18. \begin{scope}[x=7pt,y=6pt]
  19. \draw plot[domain=-1:0] (\x,0);
  20. \draw plot[domain=0:1] (\x,\x);
  21. \end{scope}
  22. }
  23. }
  24. }
  25. \tikzstyle{input}=[draw,fill=red!50,circle,minimum size=20pt,inner sep=0pt]
  26. \tikzstyle{hidden}=[draw,fill=green!50,circle,minimum size=20pt,inner sep=0pt]
  27. \tikzstyle{output}=[draw,fill=white,circle,minimum size=20pt,inner sep=0pt]
  28. \tikzstyle{bias}=[draw,dashed,fill=gray!50,circle,minimum size=20pt,inner sep=0pt]
  29. \tikzstyle{layer}=[fill=gray!70]
  30. \tikzstyle{stateTransition}=[->, very thick]
  31. \begin{tikzpicture}[scale=2]
  32. \node (i0)[bias] at (0, 0) {1};
  33. \node (i1)[input] at (0, 0.5) {};
  34. \node (i2)[input] at (0, 1.0) {};
  35. \node (i3)[input] at (0, 1.5) {};
  36. \node (h1)[hidden] at (1, 2.0) {};
  37. \node (h2)[hidden] at (2, 2.5) {};
  38. \node (h3)[hidden] at (3, 3.0) {};
  39. \node (o1)[output] at (4, 3.5) {};
  40. \node (o2)[output] at (5, 3.5) {};
  41. \draw[stateTransition] (i0) -- (6, 0);
  42. \draw[stateTransition] (i1) -- (6, 0.5);
  43. \draw[stateTransition] (i2) -- (6, 1.0);
  44. \draw[stateTransition] (i3) -- (6, 1.5);
  45. \draw[stateTransition] (h1) -- (6, 2.0);
  46. \draw[stateTransition] (h2) -- (6, 2.5);
  47. \draw[stateTransition] (h3) -- (6, 3.0);
  48. \draw[stateTransition] (1, 0) -- (h1);
  49. \draw[stateTransition] (2, 0) -- (h2);
  50. \draw[stateTransition] (3, 0) -- (h3);
  51. \draw[stateTransition] (4, 0) -- (o1);
  52. \draw[stateTransition] (5, 0) -- (o2);
  53. \foreach \x in {1,...,3} {
  54. \pgfmathsetmacro{\limy}{(2+\x) / 2}
  55. \foreach \y in {0, 0.5, ..., \limy} {
  56. \node[rectangle,draw=black,fill=black,minimum size=12] (box) at (\x,\y) {};
  57. }
  58. }
  59. \foreach \x in {4,...,5} {
  60. \foreach \y in {0, ..., 6} {
  61. \pgfmathsetmacro{\yn}{0.5*\y}
  62. \node[rectangle,draw=black,fill=white,minimum size=12] (box) at (\x,\yn) {};
  63. }
  64. }
  65. % \node (h11)[hidden, sigmoid] at (1, 1.5) {};
  66. % \node (h12)[hidden, sigmoid] at (1, 0.5) {};
  67. % \node[circle, inner sep=0] (h13) at (1,-0.5) {\vdots};
  68. % \node (h14)[hidden, sigmoid] at (1,-1.5) {};
  69. % \node (h21)[hidden, relu] at (2, 1.5) {};
  70. % \node (h22)[hidden, relu] at (2, 0.5) {};
  71. % \node[circle, inner sep=0] (h23) at (2,-0.5) {\vdots};
  72. % \node (h24)[hidden, relu] at (2,-1.5) {};
  73. % \node (o1)[output, sigmoid] at (3,0) {};
  74. % \draw[stateTransition] (r) -- (h11) node [midway,above=-0.06cm] {};
  75. % \draw[stateTransition] (r) -- (h12) node [midway,above=-0.06cm] {};
  76. % \draw[stateTransition] (r) -- (h13) node [midway,above=-0.06cm] {};
  77. % \draw[stateTransition] (r) -- (h14) node [midway,above=-0.06cm] {};
  78. % \draw[stateTransition] (g) -- (h11) node [midway,above=-0.06cm] {};
  79. % \draw[stateTransition] (g) -- (h12) node [midway,above=-0.06cm] {};
  80. % \draw[stateTransition] (g) -- (h13) node [midway,above=-0.06cm] {};
  81. % \draw[stateTransition] (g) -- (h14) node [midway,above=-0.06cm] {};
  82. % \draw[stateTransition] (b) -- (h11) node [midway,above=-0.06cm] {};
  83. % \draw[stateTransition] (b) -- (h12) node [midway,above=-0.06cm] {};
  84. % \draw[stateTransition] (b) -- (h13) node [midway,above=-0.06cm] {};
  85. % \draw[stateTransition] (b) -- (h11) node [midway,above=-0.06cm] {};
  86. % \draw[stateTransition] (h11) -- (h21) node [midway,above=-0.06cm] {};
  87. % \draw[stateTransition] (h11) -- (h22) node [midway,above=-0.06cm] {};
  88. % \draw[stateTransition] (h11) -- (h23) node [midway,above=-0.06cm] {};
  89. % \draw[stateTransition] (h11) -- (h24) node [midway,above=-0.06cm] {};
  90. % \draw[stateTransition] (h12) -- (h21) node [midway,above=-0.06cm] {};
  91. % \draw[stateTransition] (h12) -- (h22) node [midway,above=-0.06cm] {};
  92. % \draw[stateTransition] (h12) -- (h23) node [midway,above=-0.06cm] {};
  93. % \draw[stateTransition] (h12) -- (h24) node [midway,above=-0.06cm] {};
  94. % \draw[stateTransition] (h13) -- (h21) node [midway,above=-0.06cm] {};
  95. % \draw[stateTransition] (h13) -- (h22) node [midway,above=-0.06cm] {};
  96. % \draw[stateTransition] (h13) -- (h23) node [midway,above=-0.06cm] {};
  97. % \draw[stateTransition] (h13) -- (h24) node [midway,above=-0.06cm] {};
  98. % \draw[stateTransition] (h14) -- (h21) node [midway,above=-0.06cm] {};
  99. % \draw[stateTransition] (h14) -- (h22) node [midway,above=-0.06cm] {};
  100. % \draw[stateTransition] (h14) -- (h23) node [midway,above=-0.06cm] {};
  101. % \draw[stateTransition] (h14) -- (h21) node [midway,above=-0.06cm] {};
  102. % \draw[stateTransition] (h21) -- (o1) node [midway,above=-0.06cm] {};
  103. % \draw[stateTransition] (h22) -- (o1) node [midway,above=-0.10cm] {};
  104. % \draw[stateTransition] (h23) -- (o1) node [midway,above=-0.06cm] {};
  105. % \draw[stateTransition] (h24) -- (o1) node [midway,above=-0.06cm] {};
  106. % \draw [
  107. % thick,
  108. % decoration={
  109. % brace,
  110. % mirror,
  111. % raise=0.5cm
  112. % },
  113. % decorate
  114. % ] (1+-\width, -1.8) -- (2+\width, -1.8)
  115. % node [pos=0.5,anchor=north,yshift=-0.55cm] {50\% dropout};
  116. \end{tikzpicture}
  117. \end{preview}
  118. \end{document}