More work on figure 2.

master
Aaron Huber 2020-09-11 21:48:28 -04:00
parent 78d482067c
commit c6ff46b193
3 changed files with 33 additions and 9 deletions

View File

@ -332,6 +332,28 @@ See algorithm ~\ref{alg:one-pass} for details.
For example, consider the when $\etree$ is $+\left(\times\left(+\left(\times\left(1, x_1\right), \times\left(1, x_2\right)\right), +\left(\times\left(1, x_1\right), \times\left(-1, x_2\right)\right)\right), \times\left(\times\left(1, x_2\right), \times\left(1, x_2\right)\right)\right)$, which encodes the expression $(x_1 + x_2)(x_1 - x_2) + x_2^2$. After one pass, \cref{alg:one-pass} would have computed the following weight distribution. For the two children of the root $+$ node $\etree$, $\etree_\lchild.\wght = \frac{4}{5}$ and $\etree_\rchild.\wght = \frac{1}{5}$. Similarly, $\stree \gets \etree_\lchild$, $\stree_\lchild.\wght = \stree_\rchild.\wght = \frac{1}{2}$. Note that in this example, the sampling probabilities for the children of each inner $+$ node of $\stree$ are equal to one another because both parents have the same number of children, and, in each case, the children of each parent $+$ node share the same $|\coef_i|$.
\begin{figure}[h!]
\begin{tikzpicture}[every tree node/.style={default_node, thick, draw=black, black, circle, text width=0.3cm, font=\bfseries, minimum size=0.65cm}, every child/.style={black}, edge from parent/.style={draw, thick}]
\Tree [.$\boldsymbol{+}$
\edge [red] node[midway, auto= right, font=\bfseries] {$\etree_\lchild.\wght \bsym{ = \frac{4}{5}}$}; [.$\boldsymbol{\times}$
[.$+$
\edge[red] node[midway, left=5pt, font=\bfseries]{$\stree_\lchild.\wght \bsym{ = \frac{1}{2}}$}; [.$\bsym{x_1}$ ]
\edge[red] node[midway, right=2pt, font=\bfseries]{$\stree_\rchild.\wght \bsym{ = \frac{1}{2}}$}; [.$\bsym{x_2}$ ]
]
[.$+$
\edge[red] node[pos=0.4, left, font=\bfseries]{$\stree_\lchild.\wght \bsym{ = \frac{1}{2}}$}; [.$\bsym{x_1}$ ]
\edge[red] node[midway, right, font=\bfseries]{$\stree_\rchild.\wght \bsym{ = \frac{1}{2}}$}; [.$\times$
[.$\bsym{-1}$ ] [.$\bsym{x_2}$ ]
]
]
]
\edge [red] node[midway, auto=left, font=\bfseries] {$\etree_\rchild.\wght \bsym{ = \frac{1}{5}}$}; [.$\boldsymbol{\times}$
[.$\bsym{x_2}$ ] [.$\bsym{x_2}$ ] ]
]
\end{tikzpicture}
\begin{tikzpicture}[thick, level distance=1.2cm, level 1/.style={sibling distance= 5cm}, level 2/.style={sibling distance=3cm}, level 3/.style={sibling distance=1.5cm}, level 4/.style={sibling distance= 1cm}, every child/.style={black}]
\node[tree_node](root) {$\boldsymbol{+}$}
child[red]{node[tree_node](tl) {$\boldsymbol{\times}$}

View File

@ -111,12 +111,12 @@
\tikzset{
default_node/.style={align=center, inner sep=0pt},
pattern_node/.style={fill=gray!50, draw=black, semithick, inner sep=0pt, minimum size = 2pt, circle},
tree_node/.style={default_node, draw=black, black, circle, text width=0.3cm, font=\bfseries, minimum size=0.65cm},
every path/.style={very thick, draw}
tree_node/.style={default_node, draw=black, black, circle, text width=0.3cm, font=\bfseries, minimum size=0.65cm},
edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}
}
%Subgraph patterns
\newcommand{\ed}{
\begin{tikzpicture}%[baseline=0.00005cm]
\begin{tikzpicture}[every path/.style={very thick, draw}]%[baseline=0.00005cm]
%\begin{scope}[yshift=-0.1cm]
\node at (0, 0)[pattern_node](bottom){};
\node [above=0.07cm of bottom, pattern_node] (top){};
@ -125,7 +125,7 @@
\end{tikzpicture}
}
\newcommand{\twodis}{
\begin{tikzpicture}
\begin{tikzpicture}[every path/.style={very thick, draw}]
\node at (0, 0) [pattern_node] (bottom1) {};
\node[above=0.07cm of bottom1, pattern_node] (top1) {} edge (bottom1);
\node at (0.14, 0) [pattern_node] (bottom2) {};
@ -133,7 +133,7 @@
\end{tikzpicture}
}
\newcommand{\twopath}{
\begin{tikzpicture}
\begin{tikzpicture}[every path/.style={very thick, draw}]
\node at (0, 0.08) [pattern_node] (top){};
\node [below left=0.075cm and 0.05cm of top, pattern_node](left){};
\node[below right=0.075cm and 0.05cm of top, pattern_node](right){};
@ -142,7 +142,7 @@
\end{tikzpicture}
}
\newcommand{\threedis}{
\begin{tikzpicture}
\begin{tikzpicture}[every path/.style={very thick, draw}]
\node at (0, 0) [pattern_node] (bottom1) {};
\node[above=0.07cm of bottom1, pattern_node] (top1) {} edge (bottom1);
\node at (0.14, 0) [pattern_node] (bottom2) {};
@ -152,7 +152,7 @@
\end{tikzpicture}
}
\newcommand{\tri}{
\begin{tikzpicture}
\begin{tikzpicture}[every path/.style={very thick, draw}]
\node at (0, 0.08) [pattern_node] (top){};
\node [below left=0.08cm and 0.01cm of top, pattern_node](left){} edge (top);
\node[below right=0.08cm and 0.01cm of top, pattern_node](right){} edge (top) edge (left);
@ -160,7 +160,7 @@
}
\newcommand{\twopathdis}{\ed~\twopath}
\newcommand{\threepath}{
\begin{tikzpicture}
\begin{tikzpicture}[every path/.style={very thick, draw}]
\node at (0, 0) [pattern_node] (node1a) {};
\node [above=0.07cm of node1a, pattern_node] (node1b) {} edge (node1a);
\node [right=0.099cm of node1a, pattern_node] (node2b) {}; %edge [semithick] (node1b);
@ -169,13 +169,14 @@
\end{tikzpicture}
}
\newcommand{\oneint}{
\begin{tikzpicture}[level/.style={sibling distance=0.14cm, level distance=0.15cm}]
\begin{tikzpicture}[level/.style={sibling distance=0.14cm, level distance=0.15cm}, every path/.style={very thick, draw}]
\node at (0, 0) [pattern_node] {} [grow=down]
child{node [pattern_node]{}}
child {node [pattern_node] {}}
child{node [pattern_node] {}};
\end{tikzpicture}
}
\newcommand{\bsym}[1]{\boldsymbol{#1}}%b for bold; sym for symbol
%%%%%%%%%%%%%%%%%%%
%Pretty much everything below is from the old Sketching paper

View File

@ -4,6 +4,7 @@
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{comment}
\usepackage{amsmath}