LaTeX實戰經驗 如何寫演算法

2022-07-30 13:33:12 字數 2002 閱讀 6096

latex中實現演算法的呈現主要有兩種方式:

\usepackage[linesnumbered,boxed,ruled,commentsnumbered]%%演算法包,注意設定所需可選項

例子:

\incmargin % 使得行號不向外突出

\begin

\setalgonoline % 不要演算法中的豎線

\input$\;\\}

\output$\;\\

$w := \$\;\\}

\blankline

initialize the model parameter $\theta$ and $w$ with uniform $\left(-\sqrt/,\sqrt/\right)$\; % 分號 \; 區分一行結束

standarized $\theta$\;

initialize the popularity of categories $\rho$ randomly\;

\repeat}\;

\for $

\for \;

\caption}

\end

\decmargin

\usepackage

\begin

\renewcommand}

\renewcommand}

\caption

\label

\begin[1]

\require latent dimension $k$, $g$, target predicate $p$

\ensure $u^$, $v^$, $b^$

\state given target predicate $p$ and entire knowledge graph $g$, construct its bipartite subgraph, $g_$

\state $m$ = number of subject entities in $g_$

\state $n$ = number of object entities in $g_$

\state generate a set of training samples $d_ = \_, o^_)\}$ using uniform sampling technique

\state initialize $u^$ as size $m \times k$ matrix with $0$ mean and standard deviation $0.1$

\state initialize $v^$ as size $n \times k$ matrix with $0$ mean and stardard deviation $0.1$

\state initialize $b^$ as size $n \times 1$ column vector with $0$ mean and stardard deviation $0.1$

\forall_, o^_) \in d_$}

\state update $u_^$ based on equation~\ref

\state update $v_}^$ based on equation~\ref

\state update $v_}^$ based on equation~\ref

\state update $b_}^$ based on equation~\ref

\state update $b_}^$ based on equation~\ref

\endfor

\state \textbf $u^$, $v^$, $b^$

\end 

\end

重新定義require和ensure命令對應的關鍵字(此處將預設的require/ensure自定義為input/output)

\renewcommand} 

\renewcommand}

LaTeX 實戰經驗 參考文獻注意點

若某文獻標題中含有特定含義大寫字母 svm em 等 應特別用第二重 將其括起來才可使其正常表示。如,title bayesian personalized ranking from implicit feedback 有時候您可能修改了bib檔案但是重新編譯後,並沒有看到預期的效果,這時您可能需要...

如何去除「google惡意軟體警告」實戰經驗總結

google在今年六月份就推出了 該 可能會損害您的計算機 的警告功能,而標準是與stopbadware.org 合作的,當時推出的時候並沒有在意,也認為是個很好的功能,簡單的看了一下黑板報的操作指南,根據以往的經驗google的幫助檔案寫的都是非常詳細而且有效,本想,萬一遇到這種情況照著哪篇文章做...

工作經驗不足如何寫簡歷

我們常常會因為工作經驗不足而吃了企業的閉門羹,可生存的壓力卻又從不消停。在如今這個殘酷的競爭年代,有人提出了對簡歷注水的想法。對此,眾多hr表示十分不滿,並堅稱如果造假者被自己遇上將永不見天日。在無憂論壇的話題上,資深阿斯克尤提出 美化不等於虛化!面對經驗不足,資歷不夠的條件下,應選擇 曲線救國 用...