你能帮我完成这个吗?
梅威瑟:
\documentclass[tikz,border=7pt]{standalone}
\usetikzlibrary{positioning,arrows.meta}
\usetikzlibrary{shadows.blur,shapes.multipart}
\tikzset{grimsel/.style={rectangle split,rectangle split parts=1,draw,
fill=gray!20,blur shadow,rounded corners,align=center}}
\begin{document}
\begin{tikzpicture}[node distance=0mm,minimum height=1cm,outer sep=3mm,scale=0.8,>=Latex,font=\sffamily\footnotesize,
indication/.style={minimum height=0cm,outer sep=0mm},
oneblock/.style={transform shape,minimum width=1cm,draw,thick},
fullset/.style={transform shape,minimum width=10cm,draw,thick}]
\begin{scope}[xshift=15cm,scale=0.5,local bounding box=rightside box]
\foreach \x in {0,1}
{
\foreach \y in {0,1,...,4}
{
\draw (\x*11,0) +(0,-\y*2) node[fullset,anchor=west] {};
\draw (\x*11,0) +(\x*5+\y,-\y*2) node[oneblock,draw,anchor=west,fill=blue!50] {};
}
}
\coordinate (R) at (rightside box.west);
# Polygon
[Model,regular polygon,regular polygon sides=6,fill,text=white,anchor=center]
\end{scope}
\end{tikzpicture}
\end{document}
答案1
有些东西我刚刚复制过来我之前的回答,一个相对新颖的东西,以及一些我因为太标准(即无聊)而没有做的事情。复制的东西在图片的左下角,如果你自己收集这些东西,别人可能会更愿意帮助你,如果你只是尝试一下,你也会更喜欢它。相对新颖的东西是board
s 矩阵。(它可以使用计数完全自动化,\pgfmatrixcurrentcolumn
但更难理解/定制。)
\documentclass[tikz,border=7pt]{standalone}
\usetikzlibrary{matrix,positioning,shapes.geometric,shapes.multipart,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[board/.style={minimum width=5em,minimum height=1em,
draw,fill=gray!20,path picture={
\foreach \XX in {0,...,5}
{\ifnum\XX>0
\draw ([xshift=\XX*1em]path picture bounding box.north west)
-- ([xshift=\XX*1em]path picture bounding box.south west);
\fi
\ifnum\XX=#1
\draw[fill=blue!50] ([xshift=\XX*1em]path picture bounding box.north west)
rectangle ([xshift=\XX*1em-1em]path picture bounding box.south west);
\fi}
},pin={[name=pin-#1]right:Performance$_{#1}$},scale=1.2},
box/.style={draw,minimum size=1.2em,fill=blue!50,label={[node
font=\tiny,align=center]#1}},
2box/.style={rectangle split, rectangle split parts=2, draw,minimum
width=#1}, 2ell/.style={ellipse split,draw},
every pin edge/.style={-stealth},font=\sffamily]
\matrix[matrix of nodes,nodes in empty cells,nodes={anchor=center},
row sep=1ex,column sep=1em,inner xsep=0.3em] (m) {
1\textsuperscript{st} & |[board=1]| \\
2\textsuperscript{nd} & |[board=2]| \\
3\textsuperscript{rd} & |[board=3]| \\
4\textsuperscript{th} & |[board=4]| \\
5\textsuperscript{th} & |[board=5]| \\
};
\draw[semithick,decorate,decoration={brace,mirror,raise=1pt}] (m-1-2.north east)
-- ++ (-4.8em,0)
node[midway,above=1ex,align=center] (TF) {Training\\ Fold};
\node[left=1em of TF,align=center] (VF) {Validation\\ Fold};
\node[anchor=south,rotate=90] at (m.west){$k$ iterations};
\draw (VF) -- ([xshift=0.6em]m-1-2.north west);
\draw[semithick,decorate,decoration={brace,mirror,raise=1pt}] (m-5-2.south west) -- ++ (4.8em,0)
coordinate[midway,below=1ex](5f);
\draw[semithick,decorate,decoration={brace,raise=1pt}] (m.north east)
-- (m.south east) node[midway,right=1ex,2box=4em,draw=none,anchor=text west,
rectangle split part align={left}]{Performance
\nodepart{two}$=\sum\limits_{i=1}^5\textsf{Performance}_i$};
\node[below=2em of m-5-2.south west,2box,fill=gray!20] (2box) {Training Fold
Data\nodepart{two}Training Fold Labels};
\node[below=2em of 2box,2ell,inner ysep=-0.2ex] (2ell){\begin{tabular}{@{}c@{}}
Hyperparameters\\ values
\end{tabular}\nodepart{lower}
\begin{tabular}{@{}c@{}}\textbf{Learning} \\\textbf{Algorithm}\end{tabular}};
\node[below=2em of 2ell,regular polygon,regular polygon
sides=6,fill,text=white] (6gon) {Model};
\draw[>=stealth] (5f) edge[->] (2box) (2box) edge[->] (2ell) (2ell) edge[->]
(6gon);
%
\draw[semithick,decorate,decoration={brace,mirror,raise=1pt}]
(pin-5.south west) -- (pin-5.south east) coordinate[midway,below=1.2ex] (pf)
node[midway,below=2em,box=left:{Validation\\ Fold Data}](b1){};
\node[right=4em of b1,box=above:Prediction,yshift=-0.5ex] (b2){};
\node[below=4em of b2,box=below:{Validation\\ Fold Labels}] (b3){};
\path (b2) -- (b3) coordinate[midway,right=1em] (aux)
node[right=1em of aux] (PF) {Performance};
\draw[-stealth] (b2.east) -| (aux) |- (b3.east) (aux) -- (PF);
\node[below=0.1em of b1,regular polygon,regular polygon
sides=6,fill,text=white] (6gon2) {Model};
\path coordinate[left=1em of b2] (aux2);
\draw[-stealth] (6gon2.east) -| (aux2) |- (b1.east) (aux2) -- (b2);
\draw[-stealth] (pf) -- (b1);
\end{tikzpicture}
\end{document}