battlesnake / neural

LATEX: TikZ package for drawing neural networks. Also available on CTAN at http://www.ctan.org/tex-archive/graphics/pgf/contrib/neuralnetwork
http://www.hackology.co.uk/2013/latex-neural-networks/
GNU General Public License v2.0
241 stars 34 forks source link

parameter matrix between layers #10

Open forrestbao opened 4 years ago

forrestbao commented 4 years ago

Hi, how to add a parameter matrix between layers, like the \Theta in Fig. 28 of neural-netowrks-ebook.pdf?

igormorgado commented 3 years ago

Use title in \linklayers. As the example blow:

\begin{neuralnetwork}[height=5]
    \newcommand{\nodetextclear}[2]{}
    \setdefaultnodetext{\nodetextclear}
    \inputlayer[count=4, bias=false, title=Input]
    \hiddenlayer[count=5, bias=false, title=Hidden, exclude={3,4}]
    \linklayers[title={$w_{ij}$},not to={3,4}]
    \outputlayer[count=3, title=Output]
    \linklayers[title={$w_{jk}$},not from={3,4}]
    \link[style={-, line width=2mm,line cap=round, dash pattern=on 0pt off 6mm, shorten <= 6mm, shorten >= 4mm}, from layer=1, from node=2, to layer=1, to node=5]
\end{neuralnetwork}
singularitti commented 1 year ago

How do you make these examples work @igormorgado? I cannot run them whenever I have exclude, not to, or not from in my code.

It tells me:

Undefined control sequence.
\pgffor@body ->\if \nn@excluded \nn@lastnode 
                                             \global \def \nn@dontdraw {1} \...
l.30 \end{neuralnetwork}