Skip to content

Commit e8af185

Browse files
Update code block examples
1 parent 20ef80b commit e8af185

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

docs/source/usage.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ To instantiate a scenario, simply provide a set of variables and an optional set
2424
from causal_testing.specification.variable import Input, Output, Meta
2525
from causal_testing.specification.scenario import Scenario
2626
27+
def some_populate_function():
28+
pass
29+
2730
x = Input("x", int) # Define an input with name "x" of type int
2831
y = Output("y", float) # Define an output with name "y" of type float
29-
z = Meta("y", int) # Define a meta with name "z" of type int
32+
z = Meta("y", int, some_populate_function) # Define a meta with name "z" of type int
3033
3134
modelling_scenario = Scenario({x, y, z}, {x > z, z < 3}) # Define a scenario with the three variables and two constraints
3235
@@ -46,18 +49,19 @@ the given output and input and the desired effect. This information is the minim
4649
from causal_testing.testing.base_test_case import BaseTestCase
4750
from causal_testing.testing.causal_test_case import CausalTestCase
4851
from causal_testing.testing.causal_test_outcome import Positive
52+
from causal_testing.testing.effect import Effect
4953
5054
base_test_case = BaseTestCase(
5155
treatment_variable = x, # Set the treatment (input) variable to x
5256
outcome_variable = y, # set the outcome (output) variable to y
53-
effect = direct) # effect type, current accepted types are direct and total
57+
effect = Effect.direct.value) # effect type, current accepted types are direct and total
5458
5559
causal_test_case = CausalTestCase(
5660
base_test_case = base_test_case,
5761
expected_causal_effect = Positive, # We expect to see a positive change as a result of this
58-
control_value = 0 # Set the unmodified (control) value for x to 0,
59-
treatment_value = 1 # Set the modified (treatment) value for x to ,1
60-
estimate_type = "ate"),
62+
control_value = 0, # Set the unmodified (control) value for x to 0,
63+
treatment_value = 1, # Set the modified (treatment) value for x to ,1
64+
estimate_type = "ate")
6165
6266
Before we can run our test case, we first need data. There are two ways to acquire this: 1. run the model with the
6367
specific input configurations we're interested in, 2. use data from previous model runs. For a small number of specific

0 commit comments

Comments
 (0)