Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more code examples and outputs. #12

Open
igormorgado opened this issue May 14, 2021 · 3 comments
Open

Add more code examples and outputs. #12

igormorgado opened this issue May 14, 2021 · 3 comments

Comments

@igormorgado
Copy link

igormorgado commented May 14, 2021

I could not figure out how to use the following parameters:

  • \layer -> exclude parameter.
  • \link -> from layer, from node, to layer, to node

Can you please add some examples explaining these parameters?

Please add some examples with "dotted" layers as in this TeX exchange answer https://tex.stackexchange.com/a/153974/164318

@igormorgado igormorgado changed the title Add some examples with dots inside the layers Add more code examples and outputs. May 14, 2021
@igormorgado
Copy link
Author

igormorgado commented May 14, 2021

Found out about exclude and \link parameters. But still not able to do the example with "dotted" elements in a layer (as the link).

Here below there are two examples to share if you wish

Exclude example.

\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}]
\end{neuralnetwork}

Custom links, with nice bezier curves.

\begin{neuralnetwork}[height=6]
	\newcommand{\nodetextclear}[2]{}
	\setdefaultnodetext{\nodetextclear}
	\inputlayer[count=4, bias=false, title=Input]
	\hiddenlayer[count=5, bias=false, title=Hidden]
	\linklayers
	\outputlayer[count=3, title=Output]
	\linklayers
	\link[style={red,dashed, very thick, out=40, in=120}, from layer=0, from node=1, to layer=2, to node=1]
	\link[style={blue,dotted, very thick, out=55, in=40, looseness=1.4}, from layer=0, from node=1, to layer=2, to node=2]
\end{neuralnetwork}

By the way, should be nice, somehow autoadd, not to and not from in the following linklayers when using exclude. Otherwise it leads to vectors pointing to nowhere.

@igormorgado
Copy link
Author

igormorgado commented May 14, 2021

I was able to "customize" the dotted layer with a custom \link, here is an example:

\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={not to={3,4}]
	\outputlayer[count=3, title=Output]
	\linklayers[title={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}

Maybe there is a better way to this.

@igormorgado
Copy link
Author

Found a better way for "dots"

\node[below=.25cm of L0-2] {$\vdots$};

where L0-2 is the layer id and node id.

CAVEAT: Excluded layers are not created, hence it needs a "below=" from tikz positioning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant