hopfield-network.tex 1.0 KB

1234567891011121314151617181920212223242526272829
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{tikz}
  3. \tikzstyle{neuron}=[draw,circle,minimum size=20pt,inner sep=0pt, fill=white]
  4. \tikzstyle{stateTransition}=[very thick]
  5. \tikzstyle{learned}=[text=red]
  6. \begin{document}
  7. \newcommand\n{5}
  8. \begin{tikzpicture}[scale=1.3]
  9. \begin{scope}[rotate=17]
  10. %the multiplication with floats is not possible. Thus I split the loop in two.
  11. \foreach \number in {1,...,\n}{
  12. \node[neuron] (N-\number) at ({\number*(360/\n)}:1.5cm) {$x_\number$};
  13. }
  14. \foreach \number in {1,...,\n}{
  15. \foreach \y in {1,...,\n}{
  16. \draw[stateTransition] (N-\number) -- (N-\y);
  17. }
  18. }
  19. \end{scope}
  20. \begin{scope}[rotate=-1]
  21. \draw[learned,stateTransition] (N-1) -- (N-2) node [midway,above=-0.15cm,sloped] {$w_{1,2}$};
  22. \draw[learned,stateTransition] (N-1) -- (N-5) node [midway,above=-0.15cm,sloped] {$w_{1,5}$};
  23. \end{scope}
  24. \end{tikzpicture}
  25. \end{document}