0

I am trying to draw a denoising autoencoder using TikZ. I do not need all the connections between different layers. Something simple as a block representation per layer is enough. I would ideally like to have two big blocks, that have encoder and decoder layers. So far I have only gotten so far..

    \begin{tikzpicture}
    [title/.style={font=\fontsize{18}{18}\color{black!45}},
    En/.style={rectangle, draw, fill=blue!23, rounded corners, minimum height=9em},
    De/.style={rectangle, draw, fill=blue!23, rounded corners, minimum height=9em}]
    % Place nodes
    \node [En, outer sep=8pt, align=center] (s1) at (5,8.3) {In};
    \node [En, outer sep=8pt, align=center] (s2) at (7.65,8.3) {E1};
    \node [En, outer sep=8pt] (s3) at (10.3,8.3) {E2};
    \node [draw=black!50, fit={(s1) (s2) (s3)}] (back) {};

    \node [De, outer sep=8pt, align=center] (s4) at (12.95,8.3) {D1};
    \node [De, outer sep=8pt, align=center] (s5) at (15.6,8.3) {D5};
    \node [De, outer sep=8pt] (s6) at (18.3,8.3) {Ot};
    \node [draw=black!50, fit={(s4) (s5) (s6)}] (back) {};
\end{tikzpicture}

Which gives me enter image description here

What I want enter image description here

Apologies, I did this in MS paint.

lvdp
  • 113
  • 3
    What have you tried? Please post a MWE (fully compilable) and show us where you got stuck. Perhaps you will find somebody who will draw the whole thing for you as exercise (not uncommon here on TeX.se (unfortunately, if you ask me)), but you should at least try. The picture you want is actually quite easy in tikz. To give you a hint: use the positioning library for the positioning of the (circular) nodes, use the fit library to draw the surroundings, use label to draw the top annotations and use styles to customize the looks. For starters, use an x as cross in the left nodes. – pschulz Mar 22 '17 at 15:32
  • @pschulz Thanks. I have updated my question to reflect where I am stuck and exactly what I am looking for. Sorry, it is my first time using TikZ. – lvdp Mar 22 '17 at 16:14

1 Answers1

5

Just for fun:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.misc, fit}

\begin{document}
\begin{tikzpicture}[
    circ/.style={circle, minimum size=1cm, 
        draw=black!70, fill=red!80!black},
    cross/.style={circle, minimum size=1cm,
        draw=black!70, fill=white,
        path picture={\node[cross out, draw, ultra thick, red, minimum size=5mm]{};}},
    H/.style={rounded corners, fill=black!20, row sep=2mm},
    column/.pic={
        \matrix (#1) [H, label={[name=l#1]#1}]
        {\node[circ]{};\\
        \node[cross]{};\\
        \node[circ]{};\\
        \node[cross]{};\\
        \node[cross]{};\\
        \node[circ]{};\\};
        }
    ]

    \path (0,0) pic{column=Input};
    \path (1.5,0) pic{column=H1};
    \path (3,0) pic{column=H2};

    \node[fit=(Input) (lInput) (H2), draw, label=Encoder]{};

    \begin{scope}[xshift=5cm]
    \path (0,0) pic{column=H3};
    \path (1.5,0) pic{column=H4};
    \path (3,0) pic{column=Output};

    \node[fit=(H3) (lOutput) (Output), draw, label=Decoder]{};
    \end{scope}

\end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588