latex
latex
基本排版¶
特殊符号¶
空格¶
算法¶
宏包
格式
\begin{algorithm}
%\textsl{}\setstretch{1.8}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\caption{Iterative Solution for Training Stage}
\label{alg1}
\begin{algorithmic}[1]
\REQUIRE target user group $\mathbf{U}=\left\{u_{i}\right\}$, group set $\mathbf{G}=\left\{g_{k}\right\}$ and attendance records $\left\{s_{i, k}^{0}\right\}$
\renewcommand{\algorithmicrequire}{\textbf{Store:}}
\REQUIRE group attributes $\mathbf{a}_{k}$ for each $g_{k} \in \mathbf{G}$
\ENSURE users' profile $\left\langle\mathbf{p}_{i}, h_{i, 0}\right\rangle$ and social strength $w_{i j}$
\STATE Iteration = True;
\WHILE{Iteration}
\STATE Iteration $=$ False;
\FOR {$u \in \mathbf{U}, g_{k} \in \mathbf{G}$}
\STATE update $\left\langle\mathbf{p}_{i}, h_{i, 0}\right\rangle$ and $\left\{w_{i j}\right\}$ until convergence;
\STATE update $f_{i, k}, h_{i, k}$ based on Equation 2;
\STATE update $s_{i, k}$ as $\mathcal{I}\left(f_{i, k}-h_{i, k}\right)$;
\IF{$s_{i, k}$ changed}
\STATE Iteration $=$ True;
\ENDIF
\ENDFOR
\ENDWHILE
\end{algorithmic}
\end{algorithm}