@@ -65,19 +65,23 @@ the given output and input and the desired effect. This information is the minim
65
65
66
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
67
67
specific input configurations we're interested in, 2. use data from previous model runs. For a small number of specific
68
- tests where accuracy is critical, the first approach will yield the best results. To do this, you need to instantiate
69
- the `` ExperimentalDataCollector `` class.
68
+ tests where accuracy is critical, the first approach will yield the best results. To do this, you can use the
69
+ ` ExperimentalEstimator ` class. This will run the system directly and calculate the causal effect estimate from this .
70
70
71
- Where there are many test cases using pre-existing data is likely to be faster. If the program's behaviour can be
71
+ Where there are many test cases, using pre-existing data is likely to be faster. If the program's behaviour can be
72
72
estimated statistically, the results should still be reliable as long as there is enough data for the estimator to work
73
73
as intended. This will vary depending on the program and the estimator. To use this method, simply instantiate
74
- the ``ObservationalDataCollector `` class with the modelling scenario and a path to the CSV file containing the runtime
75
- data, e.g.
74
+ one of the other estimator classes with a Pandas dataframe containing the runtime data, e.g.
76
75
77
76
.. code-block :: python
78
-
79
- obs_df = pd.read_csv(' results/data.csv' )
80
- data_collector = ObservationalDataCollector(modelling_scenario, obs_df)
77
+ estimator = LinearRegressionEstimator(
78
+ treatment_variable,
79
+ treatment_value,
80
+ control_value,
81
+ minimal_adjustment_set,
82
+ outcome_variable,
83
+ df = pd.read_csv(observational_data_path),
84
+ )
81
85
82
86
83
87
Whether using fresh or pre-existing data, a key aspect of causal inference is estimation. To actually execute a test, we
@@ -99,7 +103,7 @@ various information. Here, we simply assert that the observed result is (on aver
99
103
100
104
.. code-block :: python
101
105
102
- causal_test_result = causal_test_case.execute_test(estimation_model, data_collector )
106
+ causal_test_result = causal_test_case.execute_test(estimation_model)
103
107
test_passes = causal_test_case.expected_causal_effect.apply(causal_test_result)
104
108
assert test_passes, " Expected to see a positive change in y."
105
109
0 commit comments