绘制异或问题图(神经网络)

绘制异或问题图(神经网络)

以下是我需要绘制的两幅图像:

答案1

这是你需要的吗?由于我没有任何数据,所以我主要通过将其与你的图像进行比较来获取数据。

tikz 图片

\documentclass{article}
\usepackage{tikz}

\tikzset{   cirwhite/.style={draw=gray,circle,fill=white,minimum size=1pt,inner sep=2pt,line width=0.2mm},
            cirred/.style={draw=gray,circle,fill=red,minimum size=1pt,inner sep=2pt,line width=0.2mm},
}

\begin{document}    
    \begin{tikzpicture}[x=2mm,y=2mm]

       \draw[|->, -latex, draw] (-1,0) -- (15,0); %draw axis
       \draw[|->, -latex, draw] (0,-1) -- (0,15);

       \node[anchor=west] at (15,0) {$x_1$};  % draw axis labels
       \node[anchor=south] at (0,15) {$x_2$};

       \draw (-3,7) -- (7,-3);    % draw diagonal lines
       \draw (-3,14) -- (14,-3); 
       \draw[gray] (0,8) -- (8,8);   % lines
       \draw[gray] (8,0) -- (8,8);

       \node[cirwhite] at (0,0) {}; % circles
       \node[cirred] at (0,8) {}; 
       \node[cirred] at (8,0) {};    
       \node[cirwhite] at (8,8) {};                                      

    \end{tikzpicture} \hspace{2cm} \begin{tikzpicture}[x=2mm,y=2mm] % HERE STARTS THE SECOND GRAPH
       %draw horizontal line   
       \draw[|->, -latex, draw] (-1,0) -- (15,0);
       \draw[|->, -latex, draw] (0,-1) -- (0,15);

       %draw years
        \foreach \x [evaluate=\x as \data using int(0+\x)] in {0,1,...,14}{ 
            \draw (\x,0) node[below=5pt,anchor=north,font=\scriptsize] {}; 
            \draw (\x,0) node[above=1pt,anchor=north,font=\scriptsize] {};      
       }    

       \node[anchor=west] at (15,0) {$\phi_1$};
       \node[anchor=south] at (0,15) {$\phi_2$};

       \draw (-3,9) -- (9,-3);
       \draw[gray] (0,8) -- (8,8);    
       \draw[gray] (8,0) -- (8,8);

       \node[cirwhite,label={[blue, anchor=south east]above:4}] at (1.5,8) {}; 
       \node[cirwhite,label={[blue, anchor=south west]right:1}] at (8,1.5) {};  

       \node[cirred,label={[blue, anchor=south west]above left:2}] at (2.3,2.3) {}; 
       \node[cirred,label={[blue, anchor=south west]below right:3}] at (2.3,2.3) {};                                    

    \end{tikzpicture}
\end{document}

相关内容