\hypertarget{classjymlp_1_1Mlp}{
\section{jymlp::Mlp Class Reference}
\label{classjymlp_1_1Mlp}\index{jymlp::Mlp@{jymlp::Mlp}}
}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classjymlp_1_1Mlp_a256f1bd5367f1fb6549be702e675110e}{
\hyperlink{classjymlp_1_1Mlp_a256f1bd5367f1fb6549be702e675110e}{Mlp} ()}
\label{classjymlp_1_1Mlp_a256f1bd5367f1fb6549be702e675110e}

\begin{DoxyCompactList}\small\item\em Construct uninitialized; only for reading content from a stream very soon. \item\end{DoxyCompactList}\item 
\hyperlink{classjymlp_1_1Mlp_ae0a2586b27ada2ebb78b4844cf480bf6}{Mlp} (const vector$<$ size\_\-t $>$ \&inneur)
\begin{DoxyCompactList}\small\item\em Construct w. \item\end{DoxyCompactList}\item 
\hyperlink{classjymlp_1_1Mlp_a15ffc14c72409da9fa589f89bf0b70a4}{Mlp} (const vector$<$ size\_\-t $>$ \&inneur, const vector$<$ ActF $>$ \&iactf, const vector$<$ double $>$ \&iweights)
\begin{DoxyCompactList}\small\item\em Construct with given weights and actfs. \item\end{DoxyCompactList}\item 
\hyperlink{classjymlp_1_1Mlp_a617f88dddb4ea115c82ac993f6810705}{Mlp} (const \hyperlink{classjymlp_1_1Mlp}{Mlp} \&other)
\begin{DoxyCompactList}\small\item\em Construct a deep-\/copy of another similar dude. \item\end{DoxyCompactList}\item 
\hyperlink{classjymlp_1_1Mlp_a4b5e380c8674b4a1b22a031f3bb964f6}{Mlp} (const vector$<$ size\_\-t $>$ \&inneur, const vector$<$ ActF $>$ \&iactf, \hyperlink{classjymlp_1_1SynapticRandomizer}{SynapticRandomizer} \&sr)
\begin{DoxyCompactList}\small\item\em Construct with given weights and actfs. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a4cc6f8abb9016b5667ab034e5d5c1329}{
size\_\-t \hyperlink{classjymlp_1_1Mlp_a4cc6f8abb9016b5667ab034e5d5c1329}{getWorkspaceSize} ()}
\label{classjymlp_1_1Mlp_a4cc6f8abb9016b5667ab034e5d5c1329}

\begin{DoxyCompactList}\small\item\em Return the number of doubles needed in the external workspace storage that is always required for the layerwise computations. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_a2f4a3c2cd49c575378bb3dcb879bedbd}{getNLayers} () const 
\begin{DoxyCompactList}\small\item\em Return number of layers as input-\/hidden-\/. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_a151cbca2660d8a7c229511a503f3ee3f}{getNWeights} () const 
\begin{DoxyCompactList}\small\item\em Return the total number of weights. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_a1e15b50bd58ea94b9ae1a837c89fcd62}{getNNeurons} (int layer) const 
\begin{DoxyCompactList}\small\item\em Return the total number of nodes/neurons on a layer. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_abfc75f066e06443cb1f41aeebc8c6e95}{getNHiddenNeurons} () const 
\begin{DoxyCompactList}\small\item\em Return the total number of neurons on hidden layers. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_ae34fb2e50ff28293098275f78ac0f77a}{
size\_\-t \hyperlink{classjymlp_1_1Mlp_ae34fb2e50ff28293098275f78ac0f77a}{getNumNonzeroWeights} () const }
\label{classjymlp_1_1Mlp_ae34fb2e50ff28293098275f78ac0f77a}

\begin{DoxyCompactList}\small\item\em Return the number of non-\/zero weights; the count is for strict zeros without numerical tolerance, so small weights should be pruned before this measure is useful. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a7ed2a19e4e014b8b1f12626bdb9f173e}{
size\_\-t \hyperlink{classjymlp_1_1Mlp_a7ed2a19e4e014b8b1f12626bdb9f173e}{getNumConnectedInputs} () const }
\label{classjymlp_1_1Mlp_a7ed2a19e4e014b8b1f12626bdb9f173e}

\begin{DoxyCompactList}\small\item\em Return the number of connected input nodes, i.e., those which feed into at least one neuron on the next layer. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_a1d5d146244f7ae90525467ce94506e30}{getNumInputs} () const 
\begin{DoxyCompactList}\small\item\em Return the number of input nodes. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classjymlp_1_1Mlp_a47e7e2bb37efb6c7737c3630ffc145bb}{getNumOutputs} () const 
\begin{DoxyCompactList}\small\item\em Return the number of output nodes. \item\end{DoxyCompactList}\item 
void \hyperlink{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}{forward} (const vector$<$ double $>$ \&input, double $\ast$workspace) const 
\begin{DoxyCompactList}\small\item\em Feed an input vector to produce the outputs of each layer; the outputs are stored in the external workspace memory array for future examination or backpropagation computations. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_aeed22f40a991ce8a2be4cf32d2b4f336}{
void \hyperlink{classjymlp_1_1Mlp_aeed22f40a991ce8a2be4cf32d2b4f336}{errorVec} (const vector$<$ double $>$ \&target, double $\ast$workspace) const }
\label{classjymlp_1_1Mlp_aeed22f40a991ce8a2be4cf32d2b4f336}

\begin{DoxyCompactList}\small\item\em Evaluate the error vector (N(x)-\/t) for a target vector; call this after \hyperlink{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}{forward()} if the error was to be computed instead of only the network outputs; updates the result in the workspace. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a224ac504107a2d633059e7ce74024dc8}{
vector$<$ double $>$ \hyperlink{classjymlp_1_1Mlp_a224ac504107a2d633059e7ce74024dc8}{copyOutputVec} (double $\ast$workspace) const }
\label{classjymlp_1_1Mlp_a224ac504107a2d633059e7ce74024dc8}

\begin{DoxyCompactList}\small\item\em Create and return a copy of the current workspace output (network output or error vector, depending on workspace state). \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a6fec962d4839a20c4cb3b7ab515433fc}{
size\_\-t \hyperlink{classjymlp_1_1Mlp_a6fec962d4839a20c4cb3b7ab515433fc}{outputVecAsClassIndex} (const double $\ast$workspace) const }
\label{classjymlp_1_1Mlp_a6fec962d4839a20c4cb3b7ab515433fc}

\begin{DoxyCompactList}\small\item\em Return a base-\/1 index to the class (1,2,...C) represented by the output (must be called directly after the forward pass). \item\end{DoxyCompactList}\item 
void \hyperlink{classjymlp_1_1Mlp_a5c8b1427b4bffdd6eb1740686a0fa35b}{backwardEucSq} (double coeff, double $\ast$destE, double $\ast$destG, double $\ast$workspace, ErrT errortype) const 
\begin{DoxyCompactList}\small\item\em Add the weighted error to the destination value and optionally its gradient by backpropagating through the workspace; must be called after \hyperlink{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}{forward()} and \hyperlink{classjymlp_1_1Mlp_aeed22f40a991ce8a2be4cf32d2b4f336}{errorVec()} because the error vector must be computed in the workspace in order to evaluate the error contribution or backpropagate. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a9a40885dbac24523ae846a197940a543}{
void \hyperlink{classjymlp_1_1Mlp_a9a40885dbac24523ae846a197940a543}{weightDecaySq} (double coeff, double $\ast$destE, double $\ast$destG, bool excludeOutputBias) const }
\label{classjymlp_1_1Mlp_a9a40885dbac24523ae846a197940a543}

\begin{DoxyCompactList}\small\item\em Add a weight decay term of the form coeff/2 $\ast$ sum w\_\-i$^\wedge$2 -\/ sum of either all weights, or weights except the biases of the output layer. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a4cbef483ecba79b156a65240cd85866f}{
void \hyperlink{classjymlp_1_1Mlp_a4cbef483ecba79b156a65240cd85866f}{weightDecayAbs} (double coeff, double $\ast$destE, double $\ast$destG, bool excludeOutputBias) const }
\label{classjymlp_1_1Mlp_a4cbef483ecba79b156a65240cd85866f}

\begin{DoxyCompactList}\small\item\em Add a weight decay term of the form coeff $\ast$ sum abs(w\_\-i) -\/ sum of either all weights, or weights except the biases of the output layer. \item\end{DoxyCompactList}\item 
void \hyperlink{classjymlp_1_1Mlp_aa32b514ffcb2e2914b68518d47c30c5e}{update} (double coeff, const double $\ast$wupd)
\begin{DoxyCompactList}\small\item\em Update the weights by adding values multiplied by a coefficient to the current weight values. \item\end{DoxyCompactList}\item 
void \hyperlink{classjymlp_1_1Mlp_a53979a42462ac2ad20ee958f08317792}{addErrorAndGradient} (const vector$<$ double $>$ \&input, const vector$<$ double $>$ \&target, double coefficient, double $\ast$sqerror, double $\ast$error, vector$<$ double $>$ $\ast$mseGrad, vector$<$ double $>$ $\ast$meeGrad) const 
\begin{DoxyCompactList}\small\item\em Evaluate and add to the referred outputs the squared or non-\/squared error and partial (sub)derivatives wrt weights, multiplied by a coefficient, for a given input and a given target vector. \item\end{DoxyCompactList}\item 
void \hyperlink{classjymlp_1_1Mlp_abf39ce5adb71c95f060a640c0dc5625e}{toStream} (ostream \&o)
\begin{DoxyCompactList}\small\item\em Stream to an ASCII version, easily readable in simple scripts, e.g., in Matlab or Octave. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a6747f04912aeeefa9f9af32645648fe7}{
void \hyperlink{classjymlp_1_1Mlp_a6747f04912aeeefa9f9af32645648fe7}{fromStream} (istream \&ins)}
\label{classjymlp_1_1Mlp_a6747f04912aeeefa9f9af32645648fe7}

\begin{DoxyCompactList}\small\item\em Set new values from an ASCII stream, as created by \hyperlink{classjymlp_1_1Mlp_abf39ce5adb71c95f060a640c0dc5625e}{toStream()}. \item\end{DoxyCompactList}\item 
string \hyperlink{classjymlp_1_1Mlp_a4cb3a39b71eec6b004b4ad871cd2c4af}{prettyPrintLayerSizes} ()
\begin{DoxyCompactList}\small\item\em Pretty-\/print layer sizes, ex. \item\end{DoxyCompactList}\item 
string \hyperlink{classjymlp_1_1Mlp_a756423146d961d86faa725fbc4c9f39e}{prettyPrintLayerActivations} ()
\begin{DoxyCompactList}\small\item\em Pretty-\/print layer activations, ex. \item\end{DoxyCompactList}\item 
string \hyperlink{classjymlp_1_1Mlp_a67efd86b63db93bc4fefd6935e5f47dc}{prettyPrintWeights} () const 
\begin{DoxyCompactList}\small\item\em Pretty-\/print weight matrices. \item\end{DoxyCompactList}\item 
string \hyperlink{classjymlp_1_1Mlp_a05ddeb7ff65bbaefea3b27a5344a15a1}{prettyPrintGradient} (const vector$<$ double $>$ \&grad) const 
\begin{DoxyCompactList}\small\item\em Pretty-\/print gradient matrices. \item\end{DoxyCompactList}\item 
string \hyperlink{classjymlp_1_1Mlp_a5f4d35c1f74e1a490bf3f59894764306}{prettyPrint} ()
\begin{DoxyCompactList}\small\item\em Pretty-\/print everything. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classjymlp_1_1Mlp_aed7b006be3499335188e341aaacd486e}{initRnd} (double a, \hyperlink{classjymlp_1_1SynapticRandomizer}{SynapticRandomizer} \&sr)
\begin{DoxyCompactList}\small\item\em Re-\/initialize weights using random values from U(-\/a,a). \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classjymlp_1_1Mlp_a9ea7e70962eb301d419ad0aa8c26d1db}{
vector$<$ double $>$ \hyperlink{classjymlp_1_1Mlp_a9ea7e70962eb301d419ad0aa8c26d1db}{weights}}
\label{classjymlp_1_1Mlp_a9ea7e70962eb301d419ad0aa8c26d1db}

\begin{DoxyCompactList}\small\item\em Linear storage of weights. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a9b1a279253782d11080d1c1a92d3796a}{
vector$<$ size\_\-t $>$ \hyperlink{classjymlp_1_1Mlp_a9b1a279253782d11080d1c1a92d3796a}{nneur}}
\label{classjymlp_1_1Mlp_a9b1a279253782d11080d1c1a92d3796a}

\begin{DoxyCompactList}\small\item\em Linear storage of neuron count in-\/hid-\/out. \item\end{DoxyCompactList}\item 
\hypertarget{classjymlp_1_1Mlp_a087fde3d23854574ff08511d2c95792c}{
vector$<$ ActF $>$ \hyperlink{classjymlp_1_1Mlp_a087fde3d23854574ff08511d2c95792c}{actf}}
\label{classjymlp_1_1Mlp_a087fde3d23854574ff08511d2c95792c}

\begin{DoxyCompactList}\small\item\em Linear storage of activation types. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{classjymlp_1_1Mlp_ae0a2586b27ada2ebb78b4844cf480bf6}{
\index{jymlp::Mlp@{jymlp::Mlp}!Mlp@{Mlp}}
\index{Mlp@{Mlp}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{Mlp}]{\setlength{\rightskip}{0pt plus 5cm}Mlp::Mlp (const vector$<$ size\_\-t $>$ \& {\em inneur})}}
\label{classjymlp_1_1Mlp_ae0a2586b27ada2ebb78b4844cf480bf6}


Construct w. all-\/zero weights and tanh-\/tanh-\/lin activ (default). \hypertarget{classjymlp_1_1Mlp_a15ffc14c72409da9fa589f89bf0b70a4}{
\index{jymlp::Mlp@{jymlp::Mlp}!Mlp@{Mlp}}
\index{Mlp@{Mlp}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{Mlp}]{\setlength{\rightskip}{0pt plus 5cm}Mlp::Mlp (const vector$<$ size\_\-t $>$ \& {\em inneur}, \/  const vector$<$ ActF $>$ \& {\em iactf}, \/  const vector$<$ double $>$ \& {\em iweights})}}
\label{classjymlp_1_1Mlp_a15ffc14c72409da9fa589f89bf0b70a4}


Construct with given weights and actfs. Deep copies are made. \hypertarget{classjymlp_1_1Mlp_a617f88dddb4ea115c82ac993f6810705}{
\index{jymlp::Mlp@{jymlp::Mlp}!Mlp@{Mlp}}
\index{Mlp@{Mlp}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{Mlp}]{\setlength{\rightskip}{0pt plus 5cm}Mlp::Mlp (const {\bf Mlp} \& {\em other})}}
\label{classjymlp_1_1Mlp_a617f88dddb4ea115c82ac993f6810705}


Construct a deep-\/copy of another similar dude. \hypertarget{classjymlp_1_1Mlp_a4b5e380c8674b4a1b22a031f3bb964f6}{
\index{jymlp::Mlp@{jymlp::Mlp}!Mlp@{Mlp}}
\index{Mlp@{Mlp}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{Mlp}]{\setlength{\rightskip}{0pt plus 5cm}Mlp::Mlp (const vector$<$ size\_\-t $>$ \& {\em inneur}, \/  const vector$<$ ActF $>$ \& {\em iactf}, \/  {\bf SynapticRandomizer} \& {\em sr})}}
\label{classjymlp_1_1Mlp_a4b5e380c8674b4a1b22a031f3bb964f6}


Construct with given weights and actfs. Initialize with weights with a given \hyperlink{classjymlp_1_1SynapticRandomizer}{SynapticRandomizer}. If you use threads, initialize the randomizers properly for each thread! 

\subsection{Member Function Documentation}
\hypertarget{classjymlp_1_1Mlp_a53979a42462ac2ad20ee958f08317792}{
\index{jymlp::Mlp@{jymlp::Mlp}!addErrorAndGradient@{addErrorAndGradient}}
\index{addErrorAndGradient@{addErrorAndGradient}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{addErrorAndGradient}]{\setlength{\rightskip}{0pt plus 5cm}void jymlp::Mlp::addErrorAndGradient (const vector$<$ double $>$ \& {\em input}, \/  const vector$<$ double $>$ \& {\em target}, \/  double {\em coefficient}, \/  double $\ast$ {\em sqerror}, \/  double $\ast$ {\em error}, \/  vector$<$ double $>$ $\ast$ {\em mseGrad}, \/  vector$<$ double $>$ $\ast$ {\em meeGrad}) const}}
\label{classjymlp_1_1Mlp_a53979a42462ac2ad20ee958f08317792}


Evaluate and add to the referred outputs the squared or non-\/squared error and partial (sub)derivatives wrt weights, multiplied by a coefficient, for a given input and a given target vector. This is likely to be the innermost computation in algorithmic iteration, and thus the function that dominates the computational cost. Therefore, exceptionally, the output parameters are raw pointers to numerical vectors, and there may be a nullptr for any value that is not necessary for the current purpose.

Some profiling should be done to make sure this really is the place to optimize and if useful optimizations can be done.

FIXME: Split this to (1) forward eval, (2) error computation, (3) backward loop. \hypertarget{classjymlp_1_1Mlp_a5c8b1427b4bffdd6eb1740686a0fa35b}{
\index{jymlp::Mlp@{jymlp::Mlp}!backwardEucSq@{backwardEucSq}}
\index{backwardEucSq@{backwardEucSq}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{backwardEucSq}]{\setlength{\rightskip}{0pt plus 5cm}void Mlp::backwardEucSq (double {\em coeff}, \/  double $\ast$ {\em destE}, \/  double $\ast$ {\em destG}, \/  double $\ast$ {\em workspace}, \/  ErrT {\em errortype}) const}}
\label{classjymlp_1_1Mlp_a5c8b1427b4bffdd6eb1740686a0fa35b}


Add the weighted error to the destination value and optionally its gradient by backpropagating through the workspace; must be called after \hyperlink{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}{forward()} and \hyperlink{classjymlp_1_1Mlp_aeed22f40a991ce8a2be4cf32d2b4f336}{errorVec()} because the error vector must be computed in the workspace in order to evaluate the error contribution or backpropagate. Passing nullptr as destG bypasses the backpropagation step, in which case no changes are made to the workspace.

FIXME: That means that the function could be overloaded with a const$\ast$ version for workspace!! \hypertarget{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}{
\index{jymlp::Mlp@{jymlp::Mlp}!forward@{forward}}
\index{forward@{forward}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{forward}]{\setlength{\rightskip}{0pt plus 5cm}void Mlp::forward (const vector$<$ double $>$ \& {\em input}, \/  double $\ast$ {\em workspace}) const}}
\label{classjymlp_1_1Mlp_a7857a245f2f29a4ae64143a690390ac0}


Feed an input vector to produce the outputs of each layer; the outputs are stored in the external workspace memory array for future examination or backpropagation computations. Size of the workspace must be at least numberOfLayers $\ast$ max(nneur). \hypertarget{classjymlp_1_1Mlp_abfc75f066e06443cb1f41aeebc8c6e95}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNHiddenNeurons@{getNHiddenNeurons}}
\index{getNHiddenNeurons@{getNHiddenNeurons}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNHiddenNeurons}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Mlp::getNHiddenNeurons () const}}
\label{classjymlp_1_1Mlp_abfc75f066e06443cb1f41aeebc8c6e95}


Return the total number of neurons on hidden layers. \hypertarget{classjymlp_1_1Mlp_a2f4a3c2cd49c575378bb3dcb879bedbd}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNLayers@{getNLayers}}
\index{getNLayers@{getNLayers}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNLayers}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t jymlp::Mlp::getNLayers () const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classjymlp_1_1Mlp_a2f4a3c2cd49c575378bb3dcb879bedbd}


Return number of layers as input-\/hidden-\/. ..-\/hidden-\/output \hypertarget{classjymlp_1_1Mlp_a1e15b50bd58ea94b9ae1a837c89fcd62}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNNeurons@{getNNeurons}}
\index{getNNeurons@{getNNeurons}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNNeurons}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t jymlp::Mlp::getNNeurons (int {\em layer}) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classjymlp_1_1Mlp_a1e15b50bd58ea94b9ae1a837c89fcd62}


Return the total number of nodes/neurons on a layer. \hypertarget{classjymlp_1_1Mlp_a1d5d146244f7ae90525467ce94506e30}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNumInputs@{getNumInputs}}
\index{getNumInputs@{getNumInputs}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNumInputs}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t jymlp::Mlp::getNumInputs () const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classjymlp_1_1Mlp_a1d5d146244f7ae90525467ce94506e30}


Return the number of input nodes. \hypertarget{classjymlp_1_1Mlp_a47e7e2bb37efb6c7737c3630ffc145bb}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNumOutputs@{getNumOutputs}}
\index{getNumOutputs@{getNumOutputs}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNumOutputs}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t jymlp::Mlp::getNumOutputs () const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classjymlp_1_1Mlp_a47e7e2bb37efb6c7737c3630ffc145bb}


Return the number of output nodes. \hypertarget{classjymlp_1_1Mlp_a151cbca2660d8a7c229511a503f3ee3f}{
\index{jymlp::Mlp@{jymlp::Mlp}!getNWeights@{getNWeights}}
\index{getNWeights@{getNWeights}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{getNWeights}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t jymlp::Mlp::getNWeights () const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classjymlp_1_1Mlp_a151cbca2660d8a7c229511a503f3ee3f}


Return the total number of weights. \hypertarget{classjymlp_1_1Mlp_aed7b006be3499335188e341aaacd486e}{
\index{jymlp::Mlp@{jymlp::Mlp}!initRnd@{initRnd}}
\index{initRnd@{initRnd}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{initRnd}]{\setlength{\rightskip}{0pt plus 5cm}void Mlp::initRnd (double {\em a}, \/  {\bf SynapticRandomizer} \& {\em sr})\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{classjymlp_1_1Mlp_aed7b006be3499335188e341aaacd486e}


Re-\/initialize weights using random values from U(-\/a,a). \hypertarget{classjymlp_1_1Mlp_a5f4d35c1f74e1a490bf3f59894764306}{
\index{jymlp::Mlp@{jymlp::Mlp}!prettyPrint@{prettyPrint}}
\index{prettyPrint@{prettyPrint}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{prettyPrint}]{\setlength{\rightskip}{0pt plus 5cm}string Mlp::prettyPrint ()}}
\label{classjymlp_1_1Mlp_a5f4d35c1f74e1a490bf3f59894764306}


Pretty-\/print everything. \hypertarget{classjymlp_1_1Mlp_a05ddeb7ff65bbaefea3b27a5344a15a1}{
\index{jymlp::Mlp@{jymlp::Mlp}!prettyPrintGradient@{prettyPrintGradient}}
\index{prettyPrintGradient@{prettyPrintGradient}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{prettyPrintGradient}]{\setlength{\rightskip}{0pt plus 5cm}string Mlp::prettyPrintGradient (const vector$<$ double $>$ \& {\em grad}) const}}
\label{classjymlp_1_1Mlp_a05ddeb7ff65bbaefea3b27a5344a15a1}


Pretty-\/print gradient matrices. \hypertarget{classjymlp_1_1Mlp_a756423146d961d86faa725fbc4c9f39e}{
\index{jymlp::Mlp@{jymlp::Mlp}!prettyPrintLayerActivations@{prettyPrintLayerActivations}}
\index{prettyPrintLayerActivations@{prettyPrintLayerActivations}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{prettyPrintLayerActivations}]{\setlength{\rightskip}{0pt plus 5cm}string Mlp::prettyPrintLayerActivations ()}}
\label{classjymlp_1_1Mlp_a756423146d961d86faa725fbc4c9f39e}


Pretty-\/print layer activations, ex. \char`\"{}in-\/tanh-\/tanh-\/lin\char`\"{} \hypertarget{classjymlp_1_1Mlp_a4cb3a39b71eec6b004b4ad871cd2c4af}{
\index{jymlp::Mlp@{jymlp::Mlp}!prettyPrintLayerSizes@{prettyPrintLayerSizes}}
\index{prettyPrintLayerSizes@{prettyPrintLayerSizes}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{prettyPrintLayerSizes}]{\setlength{\rightskip}{0pt plus 5cm}string Mlp::prettyPrintLayerSizes ()}}
\label{classjymlp_1_1Mlp_a4cb3a39b71eec6b004b4ad871cd2c4af}


Pretty-\/print layer sizes, ex. \char`\"{}3-\/4-\/3\char`\"{} \hypertarget{classjymlp_1_1Mlp_a67efd86b63db93bc4fefd6935e5f47dc}{
\index{jymlp::Mlp@{jymlp::Mlp}!prettyPrintWeights@{prettyPrintWeights}}
\index{prettyPrintWeights@{prettyPrintWeights}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{prettyPrintWeights}]{\setlength{\rightskip}{0pt plus 5cm}string Mlp::prettyPrintWeights () const}}
\label{classjymlp_1_1Mlp_a67efd86b63db93bc4fefd6935e5f47dc}


Pretty-\/print weight matrices. \hypertarget{classjymlp_1_1Mlp_abf39ce5adb71c95f060a640c0dc5625e}{
\index{jymlp::Mlp@{jymlp::Mlp}!toStream@{toStream}}
\index{toStream@{toStream}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{toStream}]{\setlength{\rightskip}{0pt plus 5cm}void Mlp::toStream (ostream \& {\em o})}}
\label{classjymlp_1_1Mlp_abf39ce5adb71c95f060a640c0dc5625e}


Stream to an ASCII version, easily readable in simple scripts, e.g., in Matlab or Octave. Format: Output always begins with format version. Currently only \char`\"{}version 1\char`\"{} is implemented.

Version 1 stream (values packed \& separated with a single space):

int version, int\mbox{[}nlay\mbox{]} number of layers, int\mbox{[}nlay\mbox{]} number of neurons on each layer, ActF\mbox{[}nlay\mbox{]} activation functions (input activation must be always Unset == 0), double\mbox{[}nneurTot\mbox{]} synaptic weights as a row-\/major linear array. \hypertarget{classjymlp_1_1Mlp_aa32b514ffcb2e2914b68518d47c30c5e}{
\index{jymlp::Mlp@{jymlp::Mlp}!update@{update}}
\index{update@{update}!jymlp::Mlp@{jymlp::Mlp}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void Mlp::update (double {\em coeff}, \/  const double $\ast$ {\em wupd})}}
\label{classjymlp_1_1Mlp_aa32b514ffcb2e2914b68518d47c30c5e}


Update the weights by adding values multiplied by a coefficient to the current weight values. For example update(-\/.001, grad) for the simplest kind of steepest-\/descent backprop. The same function can be used for random \char`\"{}jogging\char`\"{}, for example update(.1, gaussian). 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
src/\hyperlink{Mlp_8hpp}{Mlp.hpp}\item 
src/\hyperlink{Mlp_8cpp}{Mlp.cpp}\end{DoxyCompactItemize}
