4

I have this code which I have adapted for my use case.

I am creating a bunch of nodes and connecting them together. The problem is, the node name appears in the figure (namely h1,... and v1...).

I would like to get rid of that name and have pure circles in my figure.

Is that possible?

I have attached here the code even though I think it is a rather general question.

Thank you!

\begin{figure}[h]
\centering
\def\layersep{2cm} % Gap between visible & hidden units
\def\numvis{5} % Number if visible units
\def\numhid{4} % Number of hidden units
\begin{tikzpicture}[
    node distance=\layersep,
    line/.style={shorten >=2pt,shorten <=2pt,>=stealth}
    ]
    \tikzstyle{neuron}=[circle,fill=black!25,minimum size=21pt,inner sep=0pt];
    \tikzstyle{visible neuron}=[neuron];
    \tikzstyle{hidden neuron}=[neuron];
    \tikzstyle{annot}=[text width=4em];

    % Iterate over visible units
    \foreach \name / \y in {1,...,\numvis}
        \node[visible neuron] (V\name) at (\y,0) {$v_\y$};

    % Iterate over hidden units
    \foreach \name / \y in {1,...,\numhid}
        % Calculate the appropriate offset for the hidden unit based on the
        % number of visible units.
        \pgfmathparse{\y + (\numvis - \numhid) * 0.5}
        \node[hidden neuron] (H\name) at (\pgfmathresult, \layersep) {$h_\y$};

    % Draw a a line between each unit
    \foreach \source in {1,...,\numvis}
        \foreach \dest in {1,...,\numhid}
            \draw[line] (V\source) -- (H\dest);

    % use if/then/else to decide where to draw the labels
    \ifthenelse{\numvis > \numhid}
    {
        \node[annot,left of=V1, node distance=1.5cm] (hl) {Visible layer};
        \node[annot,above of=hl] {Hidden layer};
    }
    {
        \node[annot,left of=H1, node distance=1.5cm] (hl) {Hidden layer};
        \node[annot,below of=hl] {Visible layer};
    }
\end{tikzpicture}
\label{fig:rbm}
\caption{Restricted Boltzmann with \numvis{} visible units and \numhid{} hidden units.}
\end{figure}
0

1 Answer 1

4

If you remove $v_\y$,$h_\y$ from the node label declarations which are the parts with braces {<node label>}, then the nodes are just filled without any label.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .