\pgfplotsset{
compat=1.11,
legend image code/.code={
\draw[mark repeat=2,mark phase=2]
plot coordinates {
(0cm,0cm)
(0.075cm,0cm)        %% default is (0.3cm,0cm)
(0.15cm,0cm)         %% default is (0.6cm,0cm)
};%
}
}
\begin{figure}
  \begin{subfigure}[b]{0.48\textwidth}
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.25\textheight}
        \begin{tikzpicture}
          \begin{axis}[
        ytick = {-1, 0, 1, 2},
        yticklabels = {$-1$, $\phantom{-0.}0$, $1$, $2$},
        restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/sin_6.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col
            sep=comma, mark=none] {Figures/Data/matlab_0.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_0.0,
            y=y_n_5000_tl_0.0, col sep=comma, mark=none] {Figures/Data/scala_out_sin.csv};
            \addlegendentry{$f_1^{*, 0.1}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda}}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 0.1$}
    \end{subfigure}\\
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.25\textheight}
        \begin{tikzpicture}
          \begin{axis}[restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/sin_6.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col sep=comma, mark=none] {Figures/Data/matlab_1.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_1.0,
            y=y_n_5000_tl_1.0, col sep=comma, mark=none] {Figures/Data/scala_out_sin.csv};
            \addlegendentry{$f_1^{*, 1.0}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda}}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 1.0$}
    \end{subfigure}\\
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.25\textheight}
        \begin{tikzpicture}
          \begin{axis}[restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/sin_6.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col sep=comma, mark=none] {Figures/Data/matlab_3.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_3.0,
            y=y_n_5000_tl_3.0, col sep=comma, mark=none] {Figures/Data/scala_out_sin.csv};
            \addlegendentry{$f_1^{*, 3.0}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda}}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 3.0$}
    \end{subfigure}
  \end{subfigure}
  \begin{subfigure}[b]{0.48\textwidth}
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.245\textheight}
        \begin{tikzpicture}
          \begin{axis}[
        ytick = {-2,-1, 0, 1, 2},
        yticklabels = {$-2$,$-1$, $\phantom{-0.}0$, $1$, $2$},
        restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/data_sin_d_t.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col sep=comma, mark=none] {Figures/Data/matlab_sin_d_01.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_0.1,
            y=y_n_5000_tl_0.1, col sep=comma, mark=none] {Figures/Data/scala_out_d_1_t.csv};
            \addlegendentry{$f_1^{*, 0.1}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda}}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 0.1$}
    \end{subfigure}\\
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.25\textheight}
        \begin{tikzpicture}
          \begin{axis}[restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/data_sin_d_t.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col sep=comma, mark=none] {Figures/Data/matlab_sin_d_1.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_1.0,
            y=y_n_5000_tl_1.0, col sep=comma, mark=none] {Figures/Data/scala_out_d_1_t.csv};
            \addlegendentry{$f_1^{*, 1.0}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda},*}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 1.0$}
    \end{subfigure}\\
    \begin{subfigure}[b]{\textwidth}
      \begin{adjustbox}{width=\textwidth, height=0.25\textheight}
        \begin{tikzpicture}
          \begin{axis}[restrict x to domain=-4:4, enlarge x limits = {0.1}]
            \addplot table [x=x, y=y, col sep=comma, only marks,
            forget plot] {Figures/Data/data_sin_d_t.csv};
            \addplot [black, line width=2pt] table [x=x, y=y, col sep=comma, mark=none] {Figures/Data/matlab_sin_d_3.csv};
            \addplot [red, line width = 1.5pt, dashed] table [x=x_n_5000_tl_3.0,
            y=y_n_5000_tl_3.0, col sep=comma, mark=none] {Figures/Data/scala_out_d_1_t.csv};
            \addlegendentry{$f_1^{*, 3.0}$};
            \addlegendentry{$\mathcal{RN}_w^{\tilde{\lambda}}$};
          \end{axis}
        \end{tikzpicture}
      \end{adjustbox}
      \caption{$\lambda = 3.0$}
    \end{subfigure}
  \end{subfigure}
  \caption[Comparison of Shallow Neural Networks and Regression
  Splines] {% In these Figures the behaviour stated in ... is
           % visualized 
    % in two exaples. For $(a), (b), (c)$ six values of sinus equidistantly
    % spaced on $[-\pi, \pi]$ have been used as training data. For
    % $(d),(e),(f)$ 15 equidistand values have been used, where
    % $y_i^{train} = \sin(x_i^{train}) + \varepsilon_i$ and
    % $\varepsilon_i \sim \mathcal{N}(0, 0.3)$. For
    % $\mathcal{RN}_w^{\tilde{\lambda, *}}$ the random weights are
    % distributed as follows
    % \begin{align*}
    %   \xi_k &\sim
    % \end{align*}
    Ridge Penalized Neural Network compared to Regression Spline,
    with them being trained on $\text{data}_A$ in a), b), c) and on
    $\text{data}_B$ in d), e), f).
    The Parameters of each are given above. The implementation of the
    network in Scala is given in Listing~\ref{lst:rsnn}
  }
  \label{fig:rn_vs_rs}
\end{figure}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:
