Skip to content

Commit

Permalink
preparing readme
Browse files Browse the repository at this point in the history
  • Loading branch information
GustikS committed Jul 8, 2020
1 parent 40a789e commit f6a7a2c
Show file tree
Hide file tree
Showing 32 changed files with 1,669 additions and 81 deletions.
Binary file added .github/img/example_template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
150 changes: 150 additions & 0 deletions .github/img/src/CNNs.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

\begin{tikzpicture}
[transform shape,rotate=0, node distance=2.0cm and 2.0cm,
ar/.style={->,>=latex},
mynode/.style={
draw, scale = 1.0, minimum size=1cm, rounded corners,left color=white,
minimum height=1cm,
align=center
}
]

\tikzstyle{neuron} = [circle, draw, scale = 1.0, minimum size=1cm]
\tikzstyle{grbond} = [mynode, right color=red!30!white]
\tikzstyle{gratom} = [mynode]
\tikzstyle{grgroup} = [mynode, right color=brown!30!white]
\tikzstyle{grexpl} = [mynode, right color=red!30!white]
\tikzstyle{edgenode} = [thin, draw=black, align=center,fill=white,font=\small]

%------1
\begin{scope}[xshift=0cm,yshift=0cm]

\begin{scope}[xshift=-1cm, yshift=-2cm]

\draw[step=2.0,black,thin] (0,0) grid (10,1.1);

\node at (1,0.5) {\Large $v_1$};
\node at (3,0.5) {\Large $v_2$};
\node at (5,0.5) {\Large $v_3$};
\node at (7,0.5) {\Large $v_4$};
\node at (9,0.5) {\Large $v_5$};


\node[] (gh2) [xshift=5cm, yshift=-0.7cm] {\LARGE image $I$ as a vector of pixel values};

\end{scope}

\begin{scope}[xshift=0cm]

\node[neuron,label={[xshift=-1.7cm, yshift=-0.5cm]{\large Features}},label={[xshift=-1.7cm, yshift=-1.2cm]{\large (pixels)}}] (gh1) {$f^1$};
\node[neuron] (gh2) [right of=gh1] {$f^2$};
\node[neuron] (gh3) [right of=gh2] {$f^3$};
\node[neuron] (gh4) [right of=gh3] {$f^4$};
\node[neuron] (gh5) [right of=gh4] {$f^5$};

\end{scope}

%filters
\begin{scope}[xshift=1cm, yshift=2cm]

\node[neuron,label={[xshift=-2.2cm, yshift=-0.6cm]{\large Filter-map}},label={[xshift=-2.2cm, yshift=-1.2cm]{\large (convolution)}}] (gr1h2) [above of=gh2] {$h^1$};
\node[neuron] (gr1h3) [right of=gr1h2] {$h^2$};
\node[neuron] (gr1h4) [right of=gr1h3] {$h^3$};

\end{scope}

%aggregation
\begin{scope}[xshift = 1cm, yshift=4cm]
\node[neuron, label={[xshift=-2.0cm, yshift=-0.6cm]{\large Pooling}},label={[xshift=-2.0cm, yshift=-1.2cm]{\large (avg/max)}}] (explosive1) [above of=gr1h3] {$pool$};
\end{scope}


\end{scope}

%---edges1

\draw[orange,->] (gh1) -> node[orange,near start,left] {$w_l$} (gr1h2);
\draw[orange,->] (gh2) -> node[orange,near start,left] {$w_l$} (gr1h3);
\draw[orange,->] (gh3) -> node[orange,near start,left] {$w_l$} (gr1h4);

\draw[cyan,->] (gh2) -> node[cyan] {$w_m$} (gr1h2);
\draw[cyan,->] (gh3) -> node[cyan] {$w_m$} (gr1h3);
\draw[cyan,->] (gh4) -> node[cyan] {$w_m$} (gr1h4);

\draw[violet,->] (gh3) -> node[violet,near start,right] {$w_r$} (gr1h2);
\draw[violet,->] (gh4) -> node[violet,near start,right] {$w_r$} (gr1h3);
\draw[violet,->] (gh5) -> node[violet,near start,right] {$w_r$} (gr1h4);

\draw[->] (gr1h2) -> node[left] {} (explosive1);
\draw[->] (gr1h3) -> node[right] {} (explosive1);
\draw[->] (gr1h4) -> node[right] {} (explosive1);

%---------------2
% % % %maly grounding
\begin{scope}[xshift=11cm,yshift=0cm]

\begin{scope}[xshift=-1cm, yshift=-2cm]

\draw[step=2.0,black,thin,dashed] (0,0) grid (10,1.1);

\node at (1,0.8) {\large $\scalar{v_1}\textcolor{red}{::} f(1)$};
\node at (3,0.8) {\large $\scalar{v_2}\textcolor{red}{::} f(2)$};
\node at (5,0.8) {\large $\scalar{v_3}\textcolor{red}{::} f(3)$};
\node at (7,0.8) {\large $\scalar{v_4}\textcolor{red}{::} f(4)$};
\node at (9,0.8) {\large $\scalar{v_5}\textcolor{red}{::} f(5)$};

\node[fill=white,inner sep=0pt,outer sep=0pt] at (2,0.25) {\large $next(1,2)$ };
\node[fill=white,inner sep=0pt,outer sep=0pt] at (4,0.25) {\large $next(2,3)$ };
\node[fill=white,inner sep=0pt,outer sep=0pt] at (6,0.25) {\large $next(3,4)$ };
\node[fill=white,inner sep=0pt,outer sep=0pt] at (8,0.25) {\large $next(4,5)$ };

\node[] (gh2) [xshift=5cm, yshift=-0.7cm] {\LARGE image $I$ as a set of weighted facts};

\end{scope}

%atoms
\begin{scope}[xshift=0cm]

\node[gratom, right color=black!30!white] (gh1) {F$_{f(1)}$};
\node[gratom, right color=black!30!white] (gh2) [right of=gh1] {F$_{f(2)}$};
\node[gratom, right color=black!30!white] (gh3) [right of=gh2] {F$_{f(3)}$};
\node[gratom, right color=black!30!white] (gh4) [right of=gh3] {F$_{f(4)}$};
\node[gratom, right color=black!30!white, label={[xshift=1.5cm, yshift=-0.4cm]{\large Fact}},label={[xshift=1.5cm, yshift=-1cm]{\large nodes}}] (gh5) [right of=gh4] {F$_{f(5)}$};

\end{scope}

%filters
\begin{scope}[xshift=1cm, yshift=2cm]

\node[grbond] (gr1h2) [above of=gh2] {R$_{\alpha_1\theta_1}^{h}$};
\node[grbond] (gr1h3) [right of=gr1h2] {R$_{\alpha_1\theta_2}^{h}$};
\node[grbond,label={[xshift=1.5cm, yshift=-0.4cm]{\large Rule}},label={[xshift=1.5cm, yshift=-1cm]{\large nodes}}] (gr1h4) [right of=gr1h3] {R$_{\alpha_1\theta_3}^{h}$};

\end{scope}

%aggregation
\begin{scope}[xshift = 1cm, yshift=4cm]
\node[grexpl,label={[xshift=1.8cm, yshift=-0.6cm]{\large Aggregation}},label={[xshift=1.8cm, yshift=-1.1cm]{\large node}}] (explosive1) [above of=gr1h3] {G$_{\alpha_1}^{h}$};
\end{scope}

%----edges

\draw[orange,->] (gh1) -> node[orange,near start,left] {$w_l$} (gr1h2);
\draw[orange,->] (gh2) -> node[orange,near start,left] {$w_l$} (gr1h3);
\draw[orange,->] (gh3) -> node[orange,near start,left] {$w_l$} (gr1h4);

\draw[cyan,->] (gh2) -> node[cyan] {$w_m$} (gr1h2);
\draw[cyan,->] (gh3) -> node[cyan] {$w_m$} (gr1h3);
\draw[cyan,->] (gh4) -> node[cyan] {$w_m$} (gr1h4);

\draw[violet,->] (gh3) -> node[violet,near start,right] {$w_r$} (gr1h2);
\draw[violet,->] (gh4) -> node[violet,near start,right] {$w_r$} (gr1h3);
\draw[violet,->] (gh5) -> node[violet,near start,right] {$w_r$} (gr1h4);

\draw[gray,->] (gr1h2) -> node[left] {} (explosive1);
\draw[gray,->] (gr1h3) -> node[right] {} (explosive1);
\draw[gray,->] (gr1h4) -> node[right] {} (explosive1);

\end{scope}

\end{tikzpicture}
134 changes: 134 additions & 0 deletions .github/img/src/GNNs.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
\begin{tikzpicture}
[transform shape,rotate=0, node distance=2.0cm and 2.0cm,
ar/.style={->,>=latex},
mynode/.style={
draw, scale = 1.0, minimum size=1cm, rounded corners,left color=white,
minimum height=1cm,
align=center
}
]

\tikzstyle{neuron} = [rectangle, draw, scale = 1.0, minimum size=1cm]
\tikzstyle{treenode} = [mynode, right color=black!30!white]
\tikzstyle{recnode} = [mynode, right color=red!30!white]
\tikzstyle{recnode2} = [mynode, right color=magenta!20!white]
\tikzstyle{aggnode} = [mynode, right color=blue!30!white]
\tikzstyle{qnode} = [mynode, right color=blue!40!white]

\tikzstyle{grbond} = [mynode, right color=black!30!white]
\tikzstyle{gratom} = [mynode]
\tikzstyle{grgroup} = [mynode, right color=brown!30!white]
\tikzstyle{grexpl} = [mynode, right color=violet!30!white]
\tikzstyle{edgenode} = [thin, draw=black, align=center,fill=white,font=\small]

\node[treenode] (g1) {F$_{n_1}$};
\node[treenode] (g2) [below left = 0.5 and 0.5cm of g1] {F$_{n_2}$};
\node[treenode] (g3) [below right = 1.5 and 0.1cm of g1] {F$_{n_3}$};
\node[treenode] (g4) [above left = 0.5 and 0.5cm of g1]{F$_{n_4}$};


\draw[black,-] (g1) -> (g2);
\draw[black,-] (g1) -> (g3);
\draw[black,-] (g2) -> (g3);
\draw[black,-] (g1) -> (g4);

\node[recnode] (h1) [right = 6.5cm of g1] {A$_{h(n_1)}^{(1)}$};
\node[recnode] (h2) [below left = 0.5 and 0.5cm of h1] {A$_{h(n_2)}^{(1)}$};
\node[recnode] (h3) [below right = 1.5 and 0.1cm of h1] {A$_{h(n_3)}^{(1)}$};
\node[recnode] (h4) [above left = 0.5 and 0.5cm of h1] {A$_{h(n_4)}^{(1)}$};

%RULE NODES
\node[recnode,scale=0.5] (r1) [below right=-1.2 and 4cm of g4] {R$^4_1$};

\node[recnode,scale=0.5] (r2) [below right=-1.7 and 3.5cm of g1] {R$^1_4$};
\node[recnode,scale=0.5] (r3) [below right=-1.1 and 3.5cm of g1] {R$^1_2$};
\node[recnode,scale=0.5] (r4) [below right=-0.5 and 3.5cm of g1] {R$^1_3$};

\node[recnode,scale=0.5] (r5) [below right=-1 and 4.2cm of g2] {R$^2_1$};
\node[recnode,scale=0.5] (r6) [below right=-0.4 and 4.2cm of g2] {R$^2_3$};

\node[recnode,scale=0.5] (r7) [below right=-0.3 and 4.2cm of g3] {R$^3_1$};
\node[recnode,scale=0.5] (r8) [below right=0.3 and 4.2cm of g3] {R$^3_2$};

\node[recnode,scale=0.5] (rh1) [below left = -1.2cm and 0.5cm of h1] {G1};
\node[recnode,scale=0.5] (rh2) [below left = -0.8cm and 0.5cm of h2] {G2};
\node[recnode,scale=0.5] (rh3) [below left = -0.2cm and 0.5cm of h3] {G3};
\node[recnode,scale=0.5] (rh4) [below left = -1.2cm and 0.5cm of h4] {G4};

%agg edges
\draw[gray,->] (r1) -> (rh4);
\draw[gray,->] (rh4) -> (h4);

\draw[gray,->] (r7) -> (rh3);
\draw[gray,->] (r8) -> (rh3);
\draw[gray,->] (rh3) -> (h3);

\draw[gray,->] (r2) -> (rh1);
\draw[gray,->] (r3) -> (rh1);
\draw[gray,->] (r4) -> (rh1);
\draw[gray,->] (rh1) -> (h1);

\draw[gray,->] (r5) -> (rh2);
\draw[gray,->] (r6) -> (rh2);
\draw[gray,->] (rh2) -> (h2);

\draw[black,loosely dotted] (h1) -> (h2);
\draw[black,loosely dotted] (h1) -> (h3);
\draw[black,loosely dotted] (h2) -> (h3);
\draw[black,loosely dotted] (h1) -> (h4);

\draw[violet,->] (g1) to[out=0,in=-150] node[ above, near end] {$W_2$} (h1);
\draw[violet,->] (g2) to[out=0,in=-150] node[ above] {$W_2$} (h2);
\draw[violet,->] (g3) -> node[ below] {$W_2$} (h3);
\draw[violet,->] (g4) -> node[ above, near start] {$W_2$} (h4);

\draw[orange,->] (g1) -> node[below] {$W_1$} (r1);

\draw[orange,->] (g4) -> node[below, near end] {$W_1$} (r2);
\draw[orange,->] (g2) -> node[ below] {$W_1$} (r3);
\draw[orange,->] (g3) to[out=70,in=190] node[below] {$W_1$} (r4);

\draw[orange,->] (g1) -> node[ below] {} (r5);
\draw[orange,->] (g3) -> node[ below] {$W_1$} (r6);

\draw[orange,->] (g1) to[out=-30,in=-170] node[above, near end] {$W_1$} (r7);
\draw[orange,->] (g2) to[out=-49,in=170] node[above] {$W_1$} (r8);

%2nd layer
\node[recnode2] (hh1) [right = 4.5cm of h1] {A$_{h(n_1)}^{(n)}$};
\node[recnode2] (hh2) [below left = 0.5 and 0.5cm of hh1] {A$_{h(n_2)}^{(n)}$};
\node[recnode2] (hh3) [below right = 1.5 and 0.1cm of hh1] {A$_{h(n_3)}^{(n)}$};
\node[recnode2] (hh4) [above left = 0.5 and 0.5cm of hh1] {A$_{h(n_4)}^{(n)}$};

\draw[black,loosely dotted] (hh1) -> (hh2);
\draw[black,loosely dotted] (hh1) -> (hh3);
\draw[black,loosely dotted] (hh2) -> (hh3);
\draw[black,loosely dotted] (hh1) -> (hh4);

\draw[cyan,dashed,->] (h1) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh1);
\draw[cyan,dashed,->] (h2) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh2);
\draw[cyan,dashed,->] (h3) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh3);
\draw[cyan,dashed,->] (h4) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh4);

\draw[teal,dashed,->] (h1) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh4);
\draw[teal,dashed,->] (h4) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh1);
\draw[teal,dashed,->] (h2) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh1);
\draw[teal,dashed,->] (h3) to[out=40,in=-170] node[color=black, draw=white, fill=white] {\Large$\dots$} (hh1);

\draw[teal,dashed,->] (h1) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh2);
\draw[teal,dashed,->] (h3) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh2);

\draw[teal,dashed,->] (h1) to[out=-30,in=-170] node[color=black, draw=white, fill=white] {}(hh3);
\draw[teal,dashed,->] (h2) -> node[color=black, draw=white, fill=white] {\Large$\dots$} (hh3);


\node[aggnode] (agg) [right = 2cm of hh1] {G$_{\alpha_n}^q$};
\draw[gray,->] (hh1) -> (agg);
\draw[gray,->] (hh2) -> (agg);
\draw[gray,->] (hh3) -> (agg);
\draw[gray,->] (hh4) -> (agg);

\node[qnode] (q) [right = 1.5cm of agg] {A$_q$};
\draw[blue,->] (agg) -> node[blue, below] {$W^{(n)}$} (q);

\end{tikzpicture}
53 changes: 53 additions & 0 deletions .github/img/src/MLPs.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
\begin{tikzpicture}
[transform shape,rotate=0, node distance=2.0cm and 2.0cm,
ar/.style={->,>=latex},
mynode/.style={
draw, scale = 1.0, minimum size=1cm, rounded corners,left color=white,
minimum height=1cm,
align=center
}
]

\tikzstyle{neuron} = [rectangle, draw, scale = 1.0, minimum size=1cm]
\tikzstyle{treenode} = [mynode, right color=black!30!white]
\tikzstyle{recnode} = [mynode, right color=magenta!30!white]
\tikzstyle{qnode} = [mynode, right color=blue!30!white]
\tikzstyle{grbond} = [mynode, right color=black!30!white]
\tikzstyle{gratom} = [mynode]
\tikzstyle{grgroup} = [mynode, right color=brown!30!white]
\tikzstyle{grexpl} = [mynode, right color=violet!30!white]
\tikzstyle{edgenode} = [thin, draw=black, align=center,fill=white,font=\small]


\node[treenode] (f1) {F$_{f,v}$};
\node[recnode,right color=red!30!white] (r1) [right of=f1] {R$_{\alpha_1\theta}^{h1}$};
\node[recnode,right color=red!30!white] (g1) [right of=r1] {G$_{\alpha_1}^{h1}$};
\node[recnode,right color=red!30!white] (a1) [right of=g1] {A$_{h1}$};

\node[recnode,right color=blue!30!white] (r2) [right of=a1] {R$_{\alpha_2\theta}^{h2}$};
\node[recnode,right color=blue!30!white] (g2) [right of=r2] {G$_{\alpha_2}^{h2}$};
\node[qnode,right color=blue!30!white] (a2) [right of=g2] {A$_{h_2}$};

%edges

\draw[gray,->] (f1) -> node[gray, below] {} (r1);
\draw[gray,->] (r1) -> node[gray, below] {} (g1);
\draw[orange,->] (g1) -> node[ below] {$\mathbf{W_1}$} (a1);

\draw[gray,->] (a1) -> node[gray, below] {} (r2);
\draw[gray,->] (r2) -> node[gray, below] {} (g2);
\draw[violet,->] (g2) -> node[ below] {$\mathbf{W_2}$} (a2);


\node[mynode, draw=white, label={[xshift=0.0cm, yshift=-1.1cm]{pruning}}] (prune) [right of=a2] {\Large $\rightarrow$};


% pruned
\node[treenode] (ff1) [right of=prune] {F$_{f,v}$};
\node[recnode,right color=red!30!white] (aa1) [right of=ff1] {A$_{h1}$};
\node[qnode] (aa2) [right of=aa1] {A$_{h_2}$};

\draw[orange,->] (ff1) -> node[below] {$\mathbf{W_1}$} (aa1);
\draw[violet,->] (aa1) -> node[below] {$\mathbf{W_2}$} (aa2);

\end{tikzpicture}
Loading

0 comments on commit f6a7a2c

Please sign in to comment.