我想实现下述伪代码算法,注意不同于三线表哦

1 三线表要记得加入这个“宏包”

粗细可调: https://blog.csdn.net/lishoubox/article/details/7331653

\usepackage{booktabs}

表格

\begin{table}[htbp]
 \caption{\label{tab:test}示例表格}  %标题
 \begin{tabular}{lcl} %三列,居左,中,左
   \toprule %第一条线
   a11 & a12 & a13 \\
   \midrule %第二条线
   a21 & a22 & a23 \\
   a31 & a32 & a33 \\
   \bottomrule %第三条线
 \end{tabular}
\end{table}

\begin{table}[htbp]
 \caption{\label{tab:test}示例表格}  %标题
 \begin{tabular}{lcl} %三列,居左,中,左
   \toprule %第一条线
   a11 & a12 & a13 \\
   \midrule %第二条线
   a21 & a22 & a23 \\
   a31 & a32 & a33 \\
   \bottomrule %第三条线
 \end{tabular}
\end{table}

2 伪代码:

宏包+算法: https://www.cnblogs.com/52ml/p/3823802.html

多种伪代码格式以及宏包: https://blog.csdn.net/lwb102063/article/details/53046265

https://blog.csdn.net/lwb102063/article/details/53046265

for循环
与if条件句

\For{$i=1;i\leq N;i\leftarrow i+1$}
      \If {$i=N$}
                    \State $middle \gets (left + right) / 2$
                    \State $result \gets result +$ \Call{MergerSort}{$Array, left, middle$}
                    \State $result \gets result +$ \Call{MergerSort}{$Array, middle, right$}
                    \State $result \gets result +$ \Call{Merger}{$Array,left,middle,right$}
      \EndIf 

      \State $d^{3}, d^{4}, d^{5} = D_{d_{3}}(f_{s}^{2}), D_{d_{4}}(f_{s}^{2}), D_{d_{5}}(f_{s}^{2})$ ;
      \State $f_{s}^{2}, f_{s}^{3}, f_{s}^{4}, f_{s}^{5} = D_{f_{i}}(f_{s}^{2}, f_{s}^{3}+d^{3}, f_{s}^{4}+d^{4}, f_{s}^{5}+d^{5});$
      \State $m^{2}, m^{3}, m^{4}, m^{5} = Conv_{2}(f_{s}^{2}), Conv_{3}(f_{s}^{3}), Conv_{4}(f_{s}^{4}), Conv_{5}(f_{s}^{5});$
    \EndFor

宏包:前期准备

\usepackage{algorithm}  
\usepackage{algpseudocode}  
\usepackage{amsmath}  
\renewcommand{\algorithmicrequire}{\textbf{Input:}}  % Use Input in the format of Algorithm  
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm 

 

  \begin{algorithm}[htb]  
  \caption{ Framework of ensemble learning for our system.}  
  \label{alg:Framwork}  
  \begin{algorithmic}[1]  
    \Require  
      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  
      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}  
    \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}  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐