@@ -24,9 +24,12 @@ To instantiate a scenario, simply provide a set of variables and an optional set
24
24
from causal_testing.specification.variable import Input, Output, Meta
25
25
from causal_testing.specification.scenario import Scenario
26
26
27
+ def some_populate_function ():
28
+ pass
29
+
27
30
x = Input(" x" , int ) # Define an input with name "x" of type int
28
31
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
30
33
31
34
modelling_scenario = Scenario({x, y, z}, {x > z, z < 3 }) # Define a scenario with the three variables and two constraints
32
35
@@ -46,18 +49,19 @@ the given output and input and the desired effect. This information is the minim
46
49
from causal_testing.testing.base_test_case import BaseTestCase
47
50
from causal_testing.testing.causal_test_case import CausalTestCase
48
51
from causal_testing.testing.causal_test_outcome import Positive
52
+ from causal_testing.testing.effect import Effect
49
53
50
54
base_test_case = BaseTestCase(
51
55
treatment_variable = x, # Set the treatment (input) variable to x
52
56
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
54
58
55
59
causal_test_case = CausalTestCase(
56
60
base_test_case = base_test_case,
57
61
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" )
61
65
62
66
Before we can run our test case, we first need data. There are two ways to acquire this: 1. run the model with the
63
67
specific input configurations we're interested in, 2. use data from previous model runs. For a small number of specific
0 commit comments