Skip to content

Commit

Permalink
Create walkthrough video and add a link to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
millerjohnp committed Mar 20, 2020
1 parent 58ce2b7 commit 89fc8a4
Show file tree
Hide file tree
Showing 7 changed files with 553 additions and 13 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ learning with challenging dynamic environments. The package facilitates
developing, testing, benchmarking, and teaching causal inference and sequential
decision making tools.

For more detailed information, check out the [documentation](https://whynot-docs.readthedocs-hosted.com/en/latest/).
For an introduction to WhyNot and a brief tutorial, see our [walkthrough
video](https://youtu.be/QKrqJ9r7Okg).
For more detailed information, check out the
[documentation](https://whynot-docs.readthedocs-hosted.com/en/latest/).


## Table of Contents
1. [Basic installation instructions](#basic-installation-instructions)
Expand Down Expand Up @@ -59,7 +63,7 @@ First, we examine all of the experiments available for World3.
import whynot as wn
experiments = wn.world3.get_experiments()
print([experiment.name for experiment in experiments])
#['world3_rct', 'world3_pollution_confounding', 'world3_pollution_unobserved_confounding', 'world3_pollution_mediation']
#['PollutionRCT', 'PollutionConfounding', 'PollutionUnobservedConfounding', 'PollutionMediation']
```
These experiments generate datasets both in the setting of a pure randomized
control trial (`world3_rct`), as well as with (unobserved) confounding and
Expand Down
532 changes: 532 additions & 0 deletions examples/walkthrough/walkthrough.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions whynot/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,3 +954,7 @@ def run(
true_effects=treatment_effects,
causal_graph=graph,
)

def __repr__(self):
"""Display the experiment by it's name."""
return self.name
4 changes: 2 additions & 2 deletions whynot/simulators/hiv/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def sample_initial_states(rng):
# pylint: disable-msg=invalid-name
#: Experiment on effect of increased drug efficacy on infected macrophages (cells/ml)
HIVRCT = DynamicsExperiment(
name="hiv_rct",
name="HIVRCT",
description="Study effect of increased drug efficacy on infected macrophages (cells/ml).",
simulator=hiv,
simulator_config=hiv.Config(epsilon_1=0.1, start_time=0, end_time=150),
Expand Down Expand Up @@ -70,7 +70,7 @@ def hiv_confounded_propensity(untreated_run, treatment_bias):
# pylint: disable-msg=invalid-name
#: Experiment on effect of increased drug efficacy on infected macrophages with confounding
HIVConfounding = DynamicsExperiment(
name="hiv_confounding",
name="HIVConfounding",
description=(
"Study effect of increased drug efficacy on infected macrophages (cells/ml). "
"Units with high immune response and free virus are more likely to be treated."
Expand Down
14 changes: 7 additions & 7 deletions whynot/simulators/world3/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def random_scale(scale, base=10):
# pylint: disable-msg=invalid-name
#: An RCT experiment to study the effect of decreases in pollution generation on population.
PollutionRCT = DynamicsExperiment(
name="world3_rct",
name="PollutionRCT",
description="Study effect of intervening in 1975 to decrease pollution generation.",
simulator=world3,
simulator_config=world3.Config(persistent_pollution_generation_factor=1.0),
Expand All @@ -74,8 +74,8 @@ def random_scale(scale, base=10):
@parameter(
name="treatment_bias",
default=0.8,
values=np.linspace(0.5, 0.05, 1),
description="Bias of probability of treatment between top and bottom pollution runs.",
values=np.linspace(0.5, 1.0, 5),
description="Treatment probability bias between low and high pollution runs.",
)
def pollution_confounded_propensity(intervention, untreated_runs, treatment_bias):
"""Probability of treating each unit.
Expand All @@ -100,9 +100,9 @@ def treatment_prob(idx):
# pylint: disable-msg=invalid-name
#: An observational experiment with confounding. Polluted states are more likely to be treated.
PollutionConfounding = DynamicsExperiment(
name="world3_pollution_confounding",
name="PollutionConfounding",
description=(
"Study effect of intervening to decrease pollution. Confounding "
"Study effect of intervening to decrease pollution on total population. Confounding "
"arises becauses states with high pollution are more likely "
"to receive treatment."
),
Expand All @@ -121,7 +121,7 @@ def treatment_prob(idx):
# pylint: disable-msg=invalid-name
#: An observational experiment with unobserved confounding.
PollutionUnobservedConfounding = DynamicsExperiment(
name="world3_pollution_unobserved_confounding",
name="PollutionUnobservedConfounding",
description=(
"Study effect of intervening to decrease pollution. Confounding "
"arises becauses states with high pollution are more likely "
Expand Down Expand Up @@ -168,7 +168,7 @@ def mediation_covariates(intervention, run, mediation_year, num_mediators):
# pylint: disable-msg=invalid-name
#: An observational experiment with mediation from states after intervention.
PollutionMediation = DynamicsExperiment(
name="world3_pollution_mediation",
name="PollutionMediation",
description=(
"Study effect of intervening to decrease pollution. Confounding "
"arises becauses states with high pollution are more likely "
Expand Down
2 changes: 1 addition & 1 deletion whynot/simulators/zika/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def mixed_treatment_intervention():
# pylint: disable-msg=invalid-name
#: Experiment on effect of mixed treatment policy on infections in 20 days
ZikaRCT = DynamicsExperiment(
name="hiv_rct",
name="ZikaRCT",
description="Study effect of mixed treatment policy on infections in 20 days.",
simulator=zika,
simulator_config=zika.Config(start_time=0, end_time=20),
Expand Down
2 changes: 1 addition & 1 deletion whynot/simulators/zika/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Config(BaseConfig):
#: Simulation end time (in days)
end_time: float = 100
#: How frequently to measure simulator state
delta_t: float = 0.05
delta_t: float = 1.0
#: solver relative tolerance
rtol: float = 1e-6
#: solver absolute tolerance
Expand Down

0 comments on commit 89fc8a4

Please sign in to comment.