اولین بار است که به اینجا می‌آیید؟ راهنمای سایت را بخوانید!
0 رای
453 بازدید

می‌خواهم شکل زیری به بالا آمده و جلوی شکل بالایی قرار بگیرد (رو به روی فلش)
و شکل پایینی از نظر اندازه و فونت مشابه شکل بالایی شود
ممنون می‌شم اگر لطف کنید و به من در ترسیم شکل کمک کنید (چرا که شکل برایم حیاتی است)
کد شکل
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

\def\nodesep{1}
\def\layersep{1cm}
\def\hsep{1cm}
\def\ilsize{5}
\def\hlsize{5}
\def\olsize{2}
\def\rootlrp{6}
\def\neuronsize{3mm}

\tikzset{>=latex}

\begin{document}

\begin{figure}
	\centering
	
	\begin{tikzpicture}[node/.style={circle, draw, thick},
	shorten >=0pt, ->, draw=black!100, node distance=\layersep,
	every pin edge/.style={<-,shorten <=1pt},
	neuron/.style={circle, draw, fill=black!100, minimum size=\neuronsize,inner sep=0pt},
	input neuron/.style={neuron, fill=black!0},
	hidden neuron/.style={neuron, fill=black!0},
	output neuron/.style={neuron, fill=black!0}]
	  \foreach \y in {1,...,5}{
		\node[node] (i\y) at (0,\nodesep*\y) {};
		\node[node, right=\layersep of i\y] (h1\y) {};
		\node[node, right=\layersep of h1\y] (h2\y) {};
	}
	
	\node[node, right=\layersep of h22] (o1) {};
	\node[node, right=\layersep of h24] (o2) {};
	
	\foreach \source in {1,...,5}
	\foreach \dest in {1,...,5}{
		\path[-stealth, thick] (i\source) edge (h1\dest);
		\path[-stealth, thick] (h1\source) edge (h2\dest);
	}
	\foreach \source in {1,...,5}
	\foreach \dest in {1,2}
	\draw[-stealth, thick] (h2\source) -- (o\dest);
	
	\draw[-stealth, thick] (5,3*\nodesep) -- node[above,font=\Large\bfseries] {dropout} (7, 3*\nodesep);
	
	% Boundary
	%*****************************************
	%*****************************************
	%*****************************************
	\pgfmathsetmacro{\iyshift}{0.5*\ilsize-0.5*\hlsize}
	\pgfmathsetmacro{\oyshift}{0.5*\olsize-0.5*\hlsize}
	%%%%%%%%%%%%
	% DRAW NODES
	%%%%%%%%%%%%
	% Draw the input layer nodes
	\foreach \name / \y in {1,...,\ilsize}
	\node[input neuron] (In-\name) at (0.0cm+\hsep,-\y cm+\iyshift cm) {};
	% Draw the hidden layer nodes
	\foreach \name / \y in {1,...,\hlsize}
	\node[hidden neuron] (H0-\name) at (1.5cm+\hsep,-\y cm) {};
	% Draw the hidden layer nodes
	\foreach \name / \y in {1,...,\hlsize}
	\node[hidden neuron] (H1-\name) at (3.0cm+\hsep,-\y cm) {};
	% Draw the output layer nodes
	\foreach \name / \y in {1,...,\olsize}
	\node[hidden neuron] (Out-\name) at (4.5cm+\hsep,-\y cm+\oyshift cm) {};
	
	%%%%%%%%%%%%%%%%%%
	% DRAW CONNECTIONS
	%%%%%%%%%%%%%%%%%%
	\pgfmathsetmacro{\cutoff}{0.5}
	% Connect every node in the input layer with every node in the hidden layer.
	\foreach \source in {1,...,\ilsize}
	{\foreach \dest in {1,...,\hlsize}
		{\pgfmathparse{int(sign(rnd-\cutoff))}
			\ifnum\pgfmathresult=1
			\path (In-\source) edge (H0-\dest);
			\fi}}
	\pgfmathsetmacro{\cutoff}{0.3}      
	% Connect first with second hidden layer
	\foreach \source in {1,...,\hlsize}
	{\foreach \dest in {1,...,\hlsize}
		{\pgfmathparse{int(sign(rnd-\cutoff))}
			\ifnum\pgfmathresult=1
			\path (H0-\source) edge (H1-\dest);
			\fi}}
	\pgfmathsetmacro{\cutoff}{0.7}      
	% Connect every node from the last hidden layer with the output layer
	\foreach \source in {1,...,\hlsize}
	{\foreach \dest in {1,...,\olsize}
		{\pgfmathparse{int(sign(rnd-\cutoff))}
			\ifnum\pgfmathresult=1
			\path (H1-\source) edge (Out-\dest);
			\fi}}
	
	\end{tikzpicture}
\end{figure}

\end{document}

فایل(های) پیوست:
Screenshot from 2023-01-11 05-48-39.png

1 پاسخ

0 رای
 
بهترین پاسخ

برای تغییر مکان شکل پایینی آن را در یک scope قرار داده و به کمک xshift و yshift جابجا می‌کنیم. به منظور یکسان کردن شکل ظاهری هم از styleهایی که تعریف کرده‌اید استفاده می‌کنیم. کافی است thick را به استایل neuron اضافه کنید. همچنین [-stealth, thick] را به تمام pathها اضافه کنید.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

\def\nodesep{1cm} % vertical distance between nodes
\def\layersep{1cm} % horizontal distance between nodes

% boundary
\def\hsep{0}
\def\ilsize{5} % number of input layer nodes
\def\hlsize{5} % number of hidden layer nodes
\def\olsize{2} % number of output layer nodes
\def\rootlrp{6}
\def\neuronsize{3mm}

\tikzset{>=latex}

\begin{document}

\begin{figure}
    \centering

    \begin{tikzpicture}[
    node/.style={circle, draw, thick},
    shorten >=0pt, ->, draw=black!100, node distance=\layersep,
    every pin edge/.style={<-,shorten <=1pt},
    neuron/.style={circle, draw, thick, fill=black!100, minimum size=\neuronsize,inner sep=0pt},
    input neuron/.style={neuron, fill=black!0},
    hidden neuron/.style={neuron, fill=black!0},
    output neuron/.style={neuron, fill=black!0}
    ]
    \begin{scope}
      \foreach \y in {1,...,5}{
        \node[node] (i\y) at (0,\nodesep*\y) {};
        \node[node, right=\layersep of i\y] (h1\y) {};
        \node[node, right=\layersep of h1\y] (h2\y) {};
    }

    \node[node, right=\layersep of h22] (o1) {};
    \node[node, right=\layersep of h24] (o2) {};

    \foreach \source in {1,...,5}
    \foreach \dest in {1,...,5}{
        \path[-stealth, thick] (i\source) edge (h1\dest);
        \path[-stealth, thick] (h1\source) edge (h2\dest);
    }
    \foreach \source in {1,...,5}
    \foreach \dest in {1,2}
    \draw[-stealth, thick] (h2\source) -- (o\dest);

    \draw[-stealth, thick] (5,3*\nodesep) -- node[above,font=\Large\bfseries] {dropout} (8, 3*\nodesep);
    \end{scope}
    \begin{scope}[xshift=9cm,yshift=6cm]
    % Boundary
    %*****************************************
    %*****************************************
    %*****************************************
    \pgfmathsetmacro{\iyshift}{0.5*\ilsize-0.5*\hlsize}
    \pgfmathsetmacro{\oyshift}{0.5*\olsize-0.5*\hlsize}
    %%%%%%%%%%%%
    % DRAW NODES
    %%%%%%%%%%%%
    % Draw the input layer nodes
    \foreach \name / \y in {1,...,\ilsize}
    \node[input neuron] (In-\name) at (0.0cm+\hsep,-\y cm+\iyshift cm) {};
    % Draw the hidden layer nodes
    \foreach \name / \y in {1,...,\hlsize}
    \node[hidden neuron] (H0-\name) at (1.5cm+\hsep,-\y cm) {};
    % Draw the hidden layer nodes
    \foreach \name / \y in {1,...,\hlsize}
    \node[hidden neuron] (H1-\name) at (3.0cm+\hsep,-\y cm) {};
    % Draw the output layer nodes
    \foreach \name / \y in {1,...,\olsize}
    \node[hidden neuron] (Out-\name) at (4.5cm+\hsep,-\y cm+\oyshift cm) {};

    %%%%%%%%%%%%%%%%%%
    % DRAW CONNECTIONS
    %%%%%%%%%%%%%%%%%%
    \pgfmathsetmacro{\cutoff}{0.5}
    % Connect every node in the input layer with every node in the hidden layer.
    \foreach \source in {1,...,\ilsize}
    {\foreach \dest in {1,...,\hlsize}
        {\pgfmathparse{int(sign(rnd-\cutoff))}
            \ifnum\pgfmathresult=1
            \path[-stealth, thick] (In-\source) edge (H0-\dest);
            \fi}}
    \pgfmathsetmacro{\cutoff}{0.3}      
    % Connect first with second hidden layer
    \foreach \source in {1,...,\hlsize}
    {\foreach \dest in {1,...,\hlsize}
        {\pgfmathparse{int(sign(rnd-\cutoff))}
            \ifnum\pgfmathresult=1
            \path[-stealth, thick] (H0-\source) edge (H1-\dest);
            \fi}}
    \pgfmathsetmacro{\cutoff}{0.7}      
    % Connect every node from the last hidden layer with the output layer
    \foreach \source in {1,...,\hlsize}
    {\foreach \dest in {1,...,\olsize}
        {\pgfmathparse{int(sign(rnd-\cutoff))}
            \ifnum\pgfmathresult=1
            \path[-stealth, thick] (H1-\source) edge (Out-\dest);
            \fi}}
    \end{scope}

    \end{tikzpicture}
\end{figure}
\end{document}

نتیجه
neuron

ببخشید اما اندازه نرون‌های دو گراف با هم برابر نیست
توسط (7 امتیاز)
دقت کنین یه اندازه به اسم \neuronsize تعریف شده که مقدارش 3mm هست. اگر این مقدار رو تغییر بدین (فقط) اندازه دایره‌های گراف سمت راست تغییر می‌کنه چون از این اندازه (فقط) تو استایل neuron استفاده شده ولی برای گراف سمت چپ همون تنظیمات پیش‌فرض در نظر گرفته شده. حالا اگر می‌خواین گراف سمت راست هم مثل سمت چپ تنظیمات پیش‌فرض رو داشته باشه از تنظیمات neuron/.style گزینه‌های minimum size=\neuronsize,inner sep=0pt رو حذف کنین. اگر می‌خواین روی اندازه دایره‌ها کنترل داشته باشین موارد بالا رو به node/.style اضافه کنین.
اگر مواردی که گفتم به نظرتون پیچیده میاد و نمی‌تونین انجامش بدین بگین تا پاسخم رو ویرایش کنم.
توسط (3.7k امتیاز)
پرسیدن سوال
وب‌سایت پرسش و پاسخ پارسی‌لاتک جایی برای پرسش و پاسخ درباره سیستم حروف‌چینی لاتک و بسته زی‌پرشین است. در اینجا می‌توانید سوال‌های خود را بپرسید و به سوال‌های دیگران پاسخ دهید.

7.1k پرسش

6.6k پاسخ

23.5k نظر

7.3k کاربر

محبوب‌ترین برچسب‌ها

رفع خطا جدول xepersian مراجع ریاضی‌نویسی شکل bidi فونت فهرست مطالب شماره‌گذاری منابع پانویس بیب‌تک tikz تک‌لایو parsilatex بیمر اسلاید زی‌پرشین پاورقی bibtex سربرگ نماد رسم شکل فرمول‌نویسی ارجاع‌دهی biditexmaker هدر ویرایشگر قالب beamer واژه‌نامه اندازه فونت texstudio عنوان فصل ماتریس اعمال نشدن تغییرات در پی‌دی‌اف رسم جدول شماره صفحه bidipresentation حاشیه رنگ عنوان شکل اسلاید فارسی محیط قضیه گراف مکان شکل tikzpicture enumerate حروف‌چینی کد شماره فصل tabriz_thesis نمایه align زیرنویس شکل کادر itemize فهرست اشکال الگوریتم عدم اجرا listings نیم‌فاصله متن لاتین و فارسی بسته فاصله بین خطوط قالب پایان‌نامه فرمول نصب تک‌لایو فارسی‌تک hyperref شماره فرمول glossaries کپشن نمودار خروجی لاتک حروف‌چینی چندستونی فونت فارسی و انگلیسی ماکرونویسی biditools شماره پاورقی پیوست‌ سوال امتحانی فاصله‌گذاری فرمول چندضابطه‌ای extrafootnotefeatures subfigure biditufte-book header texmaker pdf خطا tex longtable تصویر شمارنده زیرنویس texlive2015 دیاگرام رسم نمودار شماره‌گذاری صفحات پایان نامه فهرست جداول میک‌تک texlive2016 تنظیم جدول آکولاد شعر kashida بولد تورفتگی texworks caption اندیس اعداد فارسی lollipop iust-thesis multicol فصل‌نویسی سوال چهارگزینه‌ای فاصله عمودی pgfplots xindy چپ‌چینی اوبونتو میکروسافت ورد قاب geometry xelatex texlive fancyhdr وسط‌چینی تک لایو 2015 tcolorbox عنوان بخش شماره گذاری به‌روزرسانی بسته aimc46 صفر توخالی فرمول طولانی بیرون‌زدگی کاما پوستر فاصله سطرها نوشتافت شکست خط tex-programming فونت اعداد قرآن tabriz-thesis
...