# [GitHub] incubator-madlib pull request #162: MLP: Multilayer Perceptron Phase 2

Github user njayaram2 commented on a diff in the pull request:

--- Diff: doc/design/modules/neural-network.tex ---
@@ -197,3 +207,44 @@ \subsubsection{The $\mathit{Gradient}$ Function}
\State \Return $\delta$
\end{algorithmic}
\end{algorithm}
+
+\begin{algorithm}[mlp-train-iteration$(X, Y, \eta)$]
\label{alg:mlp-train-iteration}
+\alginput{
+start vectors $X_{i...m} \in \mathbb{R}^{n_0}$,\\
+end vectors $Y_{i...m} \in \mathbb{R}^{n_N}$,\\
+learning rate $\eta$,\\}
+\algoutput{Coefficients $u = \{ u_{k-1}^{sj} \; | \; k = 1,...,N, \: s = 0,...,n_{k-1}, \: j = 1,...,n_k\}$}
+\begin{algorithmic}[1]
+    \State \texttt{Randomnly initialize u}
+    \For{$i = 1,...,m$}
+        \State $\nabla f(u) \set \texttt{mlp-gradient}(u,X_i,Y_i)$
+        \State $u \set u - (\eta \nabla f(u) u + \lambda u)$
+    \EndFor
+    \State \Return $u$
+\end{algorithmic}
+\end{algorithm}
+
+\begin{algorithm}[mlp-train-parallel$(X, Y, \eta, s, t)$]
\label{alg:mlp-train-parallel}
+\alginput{
+start vectors $X_{i...m} \in \mathbb{R}^{n_0}$,\\
+end vectors $Y_{i...m} \in \mathbb{R}^{n_N}$,\\
+learning rate $\eta$,\\
+segments $s$,\\
+iterations $t$,\\}
+\algoutput{Coefficients $u = \{ u_{k-1}^{sj} \; | \; k = 1,...,N, \: s = 0,...,n_{k-1}, \: j = 1,...,n_k\}$}
+\begin{algorithmic}[1]
+    \State \texttt{Randomnly initialize u}
+    \For{$j = 1,...,s$}
+        \State $X_j \set \texttt{subset-of-X}$
+        \State $Y_j \set \texttt{subset-of-Y}$
+    \EndFor
+    \For{$i = 1,...,t$}
+        \For{$j = 1,...,s$}
+            \State $u_j \set copy(u)$
+            \State $u_j \set \texttt{mlp-train-iteration}(X_j, Y_j, \eta)$
+        \EndFor
+        \State $u \set \texttt{weighted-avg}(u_{1...s})$
+    \EndFor
+    \State \Return $u$
--- End diff --

Just the return u shows up in a new page in the pdf, see if you can avoid
that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---