Skip to content

Instantly share code, notes, and snippets.

@SachaEpskamp
Created December 15, 2019 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SachaEpskamp/ae19ca86403b45f764fce0bf383bb3f5 to your computer and use it in GitHub Desktop.
Save SachaEpskamp/ae19ca86403b45f764fce0bf383bb3f5 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage[
paperwidth=27cm,paperheight=13cm,
margin=1cm,
]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc}
\begin{document}
\pagestyle{empty}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=gray!20,
text width=5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{start} = [rectangle, draw, fill=white,
text width=20em, text centered, rounded corners, minimum height=4em]
\tikzstyle{block} = [rectangle, draw, fill=gray!20,
text width=20em, text centered, rounded corners, minimum height=4em]
\tikzstyle{smallblock} = [rectangle, draw, fill=gray!20,
text width=10em, text centered, rounded corners, minimum height=4em]
% \tikzstyle{line} = [draw, -latex']
\tikzstyle{line} = [draw, -{Latex[length=2mm, width=1.5mm]}]
\tikzstyle{cloud} = [draw, ellipse,fill=white, node distance=3cm,
minimum height=3em]
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (prune) {3. Compute the BIC for each model estimated in 2, and set the model with the lowest BIC to $\mathcal{M}^{\mathrm{cur}}$};
\node [block, below of = prune, node distance=2.5cm] (edgelist) {4. Form a list $\mathcal{E}^{\mathrm{full}}$ that includes all included possible edges (both present and absent edges in $\mathcal{M}^{\mathrm{cur}}$)};
% \node [decision, below of = edgelist] (isempty) {is $\mathcal{E}^{\mathrm{full}}$ empty?};
\node [below of = edgelist, node distance=3cm] (isempty) {};
% Stop1:
\node [cloud, right of = isempty, node distance=6cm] (stop1) {Return $\mathcal{M}^{\mathrm{cur}}$};
\node [smallblock, below of = isempty, node distance=2cm] (setcur) {5. Set $\mathcal{E}^{\mathrm{sub}} \leftarrow \mathcal{E}^{\mathrm{full}}$};
\node [block, right of = setcur, node distance=10cm] (fitproposals) {6. For each edge $i$ listed in $\mathcal{E}^{\mathrm{sub}}$, fit a proposal model $\mathcal{M}^{\mathrm{prop}}_i$ in which edge $i$ is included or removed in $\mathcal{M}^{\mathrm{cur}}$};
\node [decision, above of = fitproposals] (anyBIC) {Any $\mathcal{M}^{\mathrm{prop}}_i$ with lower BIC than $\mathcal{M}^{\mathrm{cur}}$?};
\node [decision, above of = stop1, node distance=3cm] (setsequal) {$\mathcal{E}^{\mathrm{full}} = \mathcal{E}^{\mathrm{sub}}$?};
\node [block, right of = setsequal, node distance=11cm] (cleanset) {7. For every edge $i$, remove $i$ from $\mathcal{E}^{\mathrm{sub}}$ if the BIC of $\mathcal{M}^{\mathrm{prop}}_i$ is higher than the BIC of $\mathcal{M}^{\mathrm{cur}}$.};
\node [block] at (anyBIC -| cleanset) (updateModel) {8. With $j$ representing the added/removed edge that reduced BIC the most, set $\mathcal{M}^{\mathrm{cur}} \leftarrow \mathcal{M}^{\mathrm{prop}}_j$ and remove $j$ from $\mathcal{E}^{\mathrm{sub}}$.};
\node [decision] at (fitproposals -| updateModel) (setempty) {Is $\mathcal{E}^{\mathrm{sub}}$ empty?};
\node [start] at (prune -| cleanset) (init) {1. Use \emph{glasso} to estimate $100$ regularized network models, ranging from sparse to dense};
\node [block] at ($(prune)!0.5!(init)$) (init2) {2. For each of these models, fit an unregularized network using \emph{glasso} without regularization but with zeroes constrained according to the network structure};
\node at (0, 1.25) {ggmModSelect algorithm};
% Edges
\path [line] (init) -- (init2);
\path [line] (init2) -- (prune);
\path [line] (prune) -- (edgelist);
\path [line] (edgelist) -- (setcur);
% \path [line] (isempty) -- node {yes} (stop1);
% \path [line] (isempty) -- node {no} (setcur);
\path [line] (setcur) -- (fitproposals);
\path [line] (fitproposals) -- (anyBIC);
\path [line] (anyBIC) -- node {no} (setsequal);
\path [line] (setsequal) -- node {yes} (stop1);
\path [line] (setsequal) -- node {no} (edgelist);
\path [line] (anyBIC) |- node {yes} (cleanset);
\path [line] (updateModel) -- (setempty);
\path [line] (cleanset) -- (updateModel);
\path [line] (setempty) -- node {no} (fitproposals);
% \path [line] (setempty) |- node {yes} (-3,-10) -- (-3, -3.45);
\path [line] (setempty) |- node [near start] {yes} (0,-9.25) -| (-3, -3.25);
% \node [block] (init) {initialize model};
% \node [cloud, right of=init] (expert) {expert};
% \node [cloud, right of=init] (system) {system};
% \node [block, below of=init] (identify) {identify candidate models};
% \node [block, below of=identify] (evaluate) {evaluate candidate models};
% \node [block, right of=evaluate, node distance=3cm] (update) {update model};
% \node [decision, below of=evaluate] (decide) {is best candidate better?};
% \node [block, below of=decide, node distance=3cm] (stop) {stop};
% % Draw edges
% \path [line] (init) -- (identify);
% \path [line] (identify) -- (evaluate);
% \path [line] (evaluate) -- (decide);
% \path [line] (decide) -| node [near start] {yes} (update);
% \path [line] (update) |- (identify);
% \path [line] (decide) -- node {no}(stop);
% \path [line,dashed] (expert) -- (init);
% \path [line,dashed] (system) -- (init);
% \path [line,dashed] (system) |- (evaluate);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment