我正在寻找一个包含此类图表的包/代码片段。有什么想法吗?
答案1
在评论和其他一些资源的帮助下,我设法画出了我想要的东西,但我敢打赌它并不完美。我把它放在这里,供可能有同样问题的人参考,希望它能有所帮助。
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{calc}
\usetikzlibrary{fit,positioning}
\begin{document}
\tikzstyle{block} = [rectangle, draw,
text width=5em, text centered, rounded corners, minimum height=2em]
\tikzstyle{entity} = [rectangle, draw, text centered]
\tikzstyle{line} = [draw, rounded corners, -latex']
\centering
\begin{tikzpicture}[node distance = 4em, auto]
\node [block] (phi_l) {\footnotesize $\Phi_l \leftarrow \{\}$};
\node [block, below of=phi_l, text width = 7em, node distance = 5em] (i) {\footnotesize $i \leftarrow 0$};
\node [block, below of=i, text width = 7em] (i_inc) {\footnotesize $i < N$};
\node [block, below of=i_inc, text width=12em] (fit_li) {\footnotesize $l_i \leftarrow \text{L1-SVM}(X_{-\Phi_l}, y)$};
\node [block, below of=fit_li, text width=7em] (up_phi) {\footnotesize $\Phi_l \leftarrow \Phi_l \cup \Phi_{l_i}$};
\path [line] (fit_li) -- (up_phi);
\node [block, below of=up_phi] (inc_i) {\footnotesize $i \leftarrow i + 1$};
\path [line] (up_phi) -- (inc_i);
\node [block, below of=inc_i, node distance = 5em] (f) {\footnotesize $f \in \Phi_{l_i}$};
\node [block, below of=f, text width = 13em, node distance = 5em] (phi_f) {\footnotesize$\Phi_f \leftarrow \text{TOP}\left\{ \left( f', \text{MI}\left(f,f'\right)\right) \ri\
ght\} $};
\node [block, below of=phi_f, text width=10em] (g_f) {\footnotesize $g_f \leftarrow \text{GP}(X_{\Phi_f}, f)$};
\path [line] (phi_f) -- (g_f);
\node [block, dashed, fit={($(f.north)+(0,1em)$) (phi_f) (g_f)}] (for2) {};
\node at (for2.north west) [below right] {for};
\node [block, dashed, fit={($(i.north)+(0,1em)$) (phi_f) (g_f) (for2) (inc_i)}] (for1) {};
\node at (for1.north west) [below right] {for};
\path [draw, dashed] ($(for1.north west)!.13!(for1.south west)$) -- ($(for1.north east)!.13!(for1.south east)$);
\coordinate (coordinate1) at ($(for1.north west)!.13!(for1.south west)$);
\node at (coordinate1.east) [below right] {while};
\path [draw, dashed] ($(for1.north west)!.23!(for1.south west)$) -- ($(for1.north east)!.23!(for1.south east)$);
\coordinate (coordinate2) at ($(for1.north west)!.23!(for1.south west)$);
\node at (coordinate2.east) [below right] {do};
\path [draw, dashed] ($(for2.north west)!.32!(for2.south west)$) -- ($(for2.north east)!.32!(for2.south east)$);
\coordinate (coordinate3) at ($(for2.north west)!.32!(for2.south west)$);
\node at (coordinate3.east) [below right] {do};
\node at ($(for1.north west)!{(1 * 1/2)}!(for1.north east)$) [entity, fill=white] (phi_l_entity) {\footnotesize $\Phi_l$};
\node at ($(for1.north west)!{(1 * 1/4)}!(for1.north east)$) [entity, fill=white] (X_entity) {\footnotesize $X$};
\node at ($(for1.north west)!{(3 * 1/4)}!(for1.north east)$) [entity, fill=white] (y_entity) {\footnotesize $y$};
\path [line] (phi_l) -- (phi_l_entity);
\node at ($(for2.north west)!{(1 * 1/3)}!(for2.north east)$) [entity, fill=white] (X_entity2) {\footnotesize $X$};
\node at ($(for2.north west)!{(2 * 1/3)}!(for2.north east)$) [entity, fill=white] (phi_li_entity) {\footnotesize $\Phi_{l_i}$};
\end{tikzpicture}
\end{document}