Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated workflow schematic #275

Merged
merged 5 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
### A Causal Inference-Driven Software Testing Framework


[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
![example workflow](https://github.com/CITCOM-project/CausalTestingFramework/actions/workflows/ci-tests.yaml/badge.svg)
[![codecov](https://codecov.io/gh/CITCOM-project/CausalTestingFramework/branch/main/graph/badge.svg?token=04ijFVrb4a)](https://codecov.io/gh/CITCOM-project/CausalTestingFramework)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
![example workflow](https://github.com/CITCOM-project/CausalTestingFramework/actions/workflows/ci-tests.yaml/badge.svg)
[![codecov](https://codecov.io/gh/CITCOM-project/CausalTestingFramework/branch/main/graph/badge.svg?token=04ijFVrb4a)](https://codecov.io/gh/CITCOM-project/CausalTestingFramework)
[![Documentation Status](https://readthedocs.org/projects/causal-testing-framework/badge/?version=latest)](https://causal-testing-framework.readthedocs.io/en/latest/?badge=latest)
![Dynamic TOML Badge](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FCITCOM-project%2FCausalTestingFramework%2Fmain%2Fpyproject.toml&query=%24.project%5B'requires-python'%5D&label=python)
![PyPI - Version](https://img.shields.io/pypi/v/causal-testing-framework)
Expand All @@ -19,7 +19,7 @@ design statistical procedures capable of making causal inferences. Each causal t
an intervention made to the system-under test. That is, a prescribed change to the input configuration of the
system-under-test that is expected to cause a change to some output(s).

![Causal Testing Workflow](images/workflow.png)
![Causal Testing Workflow](images/schematic.png)

## Installation

Expand Down
3 changes: 3 additions & 0 deletions images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schematic.*
!schematic.tex
!schematic.png
Binary file added images/schematic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 149 additions & 0 deletions images/schematic.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes,calc,fit,overlay-beamer-styles}

\usepackage{dsfont,pifont}
\newcommand*{\expe}{\mathds{E}}
\usepackage{amsmath}
\usepackage{booktabs}

\usepackage[default]{FiraSans}
\usepackage[mathrm=sym]{unicode-math}
\setmathfont{Fira Math}

\begin{document}
\tikzset{
node/.style={circle, draw, minimum size=3ex, inner sep=0.2},
edge/.style={->,> = latex'},
}

\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%

\begin{tikzpicture}
\scriptsize

\begin{scope}[name prefix=scenario-, local bounding box=specification]
% Causal DAG
\begin{scope}[name prefix=dag-]
\node[node] (x1) at (0,0) {$X_2$};
\node[node] (x2) at (0,1) {$X_1$};
\node[node] (i) at (0.5,0.5) {$I$};
\node[node] (y1) at (1.2,0) {$Y_1$};
\node[node] (y2) at (1.2,0.5) {$Y_2$};
\node[node] (y3) at (1.2,1) {$Y_3$};

\draw[edge] (x1) to (i);
\draw[edge] (x2) to (i);
\draw[edge] (i) to (y1);
\draw[edge] (i) to (y2);
\draw[edge] (i) to (y3);
\draw[edge] (x1) to (y1);
\draw[edge] (x2) to (y3);
\node[draw=none, rectangle] (nodes) [fit=(x1) (x2) (y1) (y2) (y3) (i)] {};
\node[draw=none, rectangle, anchor=south] (title) at (nodes.north) {Causal DAG};
\end{scope}
\node[draw, rectangle] (dag) [fit=(dag-nodes) (dag-title)] {};

\begin{scope}[name prefix=scenario-, shift={($(dag.east |- dag-title.north)+(0.3, 0)$)}, anchor=north west]
\node[draw=none, rectangle] (title) at (0, 0) {Modelling Scenario};
\node[anchor=north] (constraints) at (title.south) {$\{ x_1 < 5, x_2 = \text{``UK''} \}$};
\end{scope}
\node[draw, rectangle] (scenario) [fit=(scenario-title) (scenario-constraints)] {};

\node[draw=none, rectangle] (scenario) [fit=(dag) (scenario)] {};
\node[draw=none, rectangle, anchor=south] (title) at (scenario.north) {Causal Specification};
\end{scope}
\node[draw, rectangle] [fit=(scenario-scenario) (scenario-title)] {};

\begin{scope}[name prefix=test-, local bounding box=test-case, shift={($(specification.south)+(0, -1)$)}]
\node[draw=none, rectangle, anchor=north] (title) at (0, 0) {Causal Test Case};
\node[anchor=north] (tuple) at (title.south) {$(X=i, \Delta=\text{increase}, Y=y_1)$};
\coordinate (left) at (scenario-scenario.east |- {(0, 0)});
\coordinate (right) at (scenario-scenario.west |- {(0, 0)});
\node[draw, rectangle] [fit=(title) (tuple) (left) (right)] {};
\end{scope}

\begin{scope}[name prefix=estimand-, local bounding box=estimand, anchor=south, shift={($(test-case.east |- test-tuple.south) + (1, 0)$)}]
\node[anchor=south west] (eqn) at (0,0) {
$\Delta Y=\expe{[I=0 | X_1]} - \expe{[I=1 | X_1]} $
};
\node[draw=none, rectangle, anchor=south] (title) at (eqn.north) {Statistical Estimand};
\node[draw, rectangle] [fit=(estimand-title) (estimand-eqn)] {};
\end{scope}

\begin{scope}[name prefix=estimate-, local bounding box=estimate, shift={($(estimand.east)+(1, 0)$)}]
\node[draw=none, rectangle, anchor=south west] (title) at (0, 0) {Causal Estimate};
\node[anchor=north] (table) at (title.south) {
$\Delta Y=5$
};
\coordinate (top) at ({(0, 0)} |- test-title.north);
\coordinate (bot) at ({(0, 0)} |- estimand-eqn.south);
\node[draw, rectangle] [fit=(title) (table) (top) (bot)] {};
\end{scope}

\begin{scope}[name prefix=data-, local bounding box=test-data, shift={($(estimate.north)+(0, 1)$)},]
\node[draw=none, rectangle] (title) at (estimate |- scenario-title) {Test Data};
\node[anchor=north] (table) at (title.south) {
\begin{tabular}{rrrrrr}
\toprule
$X_1$ & $X_2$ & $I$ & $Y_1$ & $Y_2$ & $Y_3$ \\
\midrule
1.2 & ``UK'' & 0.3 & 7.8 & 4 & 100 \\
3.2 & ``UK'' & 0.1 & 7.6 & 8 & 95 \\
\multicolumn{6}{c}{$\vdots$} \\
\bottomrule
\end{tabular}
};
\node[draw, rectangle] [fit=(title) (table)] {};
\end{scope}

\begin{scope}[name prefix=oracle-, local bounding box=test-oracle, shift={($(estimate.east) + (1.54, -0.4)$)}]
\begin{scope}[shift={(0,0)}, local bounding box=brain, scale=1.2]
\begin{scope}[shift={(-7.6932,3.5256)}, local bounding box=brain]
\path[draw,line width=0.025cm] (8.162, -2.8955) circle (0.066cm);
\path[draw,line width=0.025cm] (8.0485, -3.2243) circle (0.066cm);
\path[draw,line width=0.025cm] (8.0346, -3.5296) circle (0.066cm);
\path[draw,line width=0.025cm] (8.2166, -3.757) circle (0.066cm);
\path[draw,line width=0.025cm] (7.6556, -3.7827) circle (0.066cm);
\path[draw,line width=0.025cm] (7.6315, -3.5091) circle (0.066cm);
\path[draw,line width=0.025cm] (7.4451, -3.2224) circle (0.066cm);
\path[draw,line width=0.025cm] (7.6247, -2.9461) circle (0.066cm);

\path[draw,line width=0.025cm,miter limit=4.0] (7.6932, -2.6331) -- (7.3637, -2.8234) -- (7.3637, -3.0567) -- (7.1749, -3.1656) -- (7.1749, -3.5256) -- (7.3341, -3.6175) -- (7.3341, -3.8517) -- (7.6883, -4.0562) -- (7.868, -3.9669) -- (8.0478, -4.0562) -- (8.4019, -3.8517) -- (8.4019, -3.6175) -- (8.5611, -3.5256) -- (8.5611, -3.1656) -- (8.3724, -3.0567) -- (8.3724, -2.8234) -- (8.0429, -2.6331) -- (7.868, -2.7341) -- cycle;
\path[draw,line width=0.025cm,miter limit=4.0] (7.868, -3.9669) -- (7.868, -2.7341);
\path[draw,line width=0.025cm] (7.5588, -2.9461) -- (7.3637, -2.9461);
\path[draw,line width=0.025cm] (7.4451, -3.1565) -- (7.4451, -2.9461);
\path[draw,line width=0.025cm] (7.6316, -3.4431) -- (7.6316, -3.2116) -- (7.868, -3.2116);
\path[draw,line width=0.025cm] (7.5897, -3.7827) -- (7.4177, -3.7827) -- (7.4177, -3.523) -- (7.1749, -3.523);
\path[draw,line width=0.025cm] (8.162, -2.9614) -- (8.162, -3.0534) -- (7.868, -3.0534);
\path[draw,line width=0.025cm] (8.0485, -3.1584) -- (8.0485, -3.0534);
\path[draw,line width=0.025cm] (8.1005, -3.5296) -- (8.313, -3.5296) -- (8.313, -3.3442) -- (8.5611, -3.3442);
\path[draw,line width=0.025cm] (8.1507, -3.757) -- (8.0477, -3.757) -- (8.0477, -4.0561);
\end{scope}
\end{scope}
\node[draw=none, rectangle, anchor=south] (title) at (brain.north) {Test Oracle};

\node[draw, rectangle] [fit=(title) (brain)] {};
\end{scope}

\begin{scope}[name prefix=outcome-, local bounding box=test-outcome, shift={($(brain.east |- estimate.east) + (1, 0)$)}]
\node[draw=none, rectangle, anchor=south west] (title) at (0,0) {Test Outcomes};
\node[draw=none, anchor=north] (ok) at (title.south) {\cmark ~ \xmark};

\coordinate (top) at ({(0, 0)} |- test-title.north);
\coordinate (bot) at ({(0, 0)} |- estimand-eqn.south);
\node[draw, rectangle] (test-outcome) [fit=(outcome-title) (outcome-ok) (top) (bot)] {};
\end{scope}

\draw[edge, dashed] ($(specification.east) + (0.1, 0)$) -- (estimand.north |- specification.east) -- (estimand.north);
\draw[edge, dashed] (test-case) -- (estimand);

\draw[edge, dashed] (test-data.south) -- (estimate.north);
\draw[edge, dashed] (estimand) -- (estimate);

\draw[edge, dashed] (estimate) -- (test-oracle.west |- estimate);
\draw[edge, dashed] (test-oracle.east |- test-outcome) -- (test-outcome);
\end{tikzpicture}
\end{document}
Binary file removed images/workflow.png
Binary file not shown.
Loading