日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

LaTex:算法排版

發布時間:2025/3/21 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 LaTex:算法排版 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

排版可能需要的包:

usepackage{algorithm} //format of the algorithm

usepackage{algorithmic} //format of the algorithm

usepackage{multirow} //multirow for format of table

usepackage{amsmath}

usepackage{xcolor}

DeclareMathOperator*{argmin}{argmin} //argmin或argmax公式的排版

enewcommand{algorithmicrequire}{ extbf{Input:}} //Use Input in the format of Algorithm

enewcommand{algorithmicensure}{ extbf{Output:}} //UseOutput in the format of Algorithm

排版圖片可能需要的包:

usepackage{graphics}

usepackage{graphicx}

usepackage{epsfig}

算法的排版舉例:

\begin{algorithm}[htb] %算法的開始

caption{ Framework of ensemble learning for our system.} %算法的標題

label{alg:Framwork} %給算法一個標簽,這樣方便在文中對算法的引用

\begin{algorithmic}[1] %這個1 表示每一行都顯示數字

REQUIRE ~~\ %算法的輸入參數:Input

The set of positive samples for current batch, $P_n$;\

The set of unlabelled samples for current batch, $U_n$;\

Ensemble of classifiers on former batches, $E_{n-1}$;

ENSURE ~~\ %算法的輸出:Output

Ensemble of classifiers on the current batch, $E_n$;

STATE Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$; label{code:fram:extract} %算法的一個陳述,對應算法的一個步驟或公式之類的; label{ code:fram:extract }對此行的標記,方便在文中引用算法的某個步驟

STATE Training ensemble of classifiers $E$ on $T_n cup P_n$, with help of data in former batches; label{code:fram:trainbase}

STATE $E_n=E_{n-1}cup E$; label{code:fram:add}

STATE Classifying samples in $U_n-T_n$ by $E_n$; label{code:fram:classify}

STATE Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$; label{code:fram:select}

RETURN $E_n$; %算法的返回值

end{algorithmic}

end{algorithm}

排版效果圖:

在文中對算法和算法的某個步驟的引用:Therefore, in step
ef{code:fram:extract} of algorithm
ef{alg:Framwork}, we extract $T_n$, a set of reliable negative samples

1、 For和While循環語句的排版舉例

(1) 排版效果圖

(2)排版代碼

\begin{algorithm}[h]

caption{An example for format For & While Loop in Algorithm}

\begin{algorithmic}[1]

FOR{each $iin [1,9]$}

STATE initialize a tree $T_{i}$ with only a leaf (the root);\

STATE $T=Tigcup T_{i};$\

ENDFOR

FORALL {$c$ such that $cin RecentMBatch(E_{n-1})$} label{code:TrainBase:getc}

STATE $T=T cup PosSample(c)$; label{code:TrainBase:pos}

ENDFOR;

FOR{$i=1$; $i<n$; $i++$ }

STATE $//$ Your source here;

ENDFOR

FOR{$i=1$ to $n$}

STATE $//$ Your source here;

ENDFOR

STATE $//$ Reusing recent base classifiers. label{code:recentStart}

WHILE {$(|E_n| leq L_1 )and( D
eq phi)$}

STATE Selecting the most recent classifier $c_i$ from $D$;

STATE $D=D-c_i$;

STATE $E_n=E_n+c_i$;

ENDWHILE label{code:recentEnd}

end{algorithmic}

end{algorithm}


from:?http://www.binghe.org/2010/03/latex-equation-and-numbering/

總結

以上是生活随笔為你收集整理的LaTex:算法排版的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。