Skip to content

Commit fdef5f3

Browse files
Docstrings and comments
1 parent 2cdb50f commit fdef5f3

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

causal_testing/testing/causal_test_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def execute_test_suite(self, test_suite: CausalTestSuite) -> list[CausalTestResu
5757

5858
"""Execute a suite of causal tests and return the results in a list
5959
:param test_suite: CasualTestSuite object
60-
:return: test_suite results which contains a list of CausalTestResult objects
61-
60+
:return: A dictionary where each key is the name of the estimators specified and the values are lists of
61+
causal_test_result objects
6262
"""
6363
if self.scenario_execution_data_df.empty:
6464
raise Exception("No data has been loaded. Please call load_data prior to executing a causal test case.")

causal_testing/testing/causal_test_suite.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@
33

44
class CausalTestSuite(UserDict):
55
"""
6-
A CausalTestSuite is a class holding a dictionary, where the keys are base_test_cases representing the treatment
7-
and outcome Variables, and the values are test objects. Test Objects hold a causal_test_case_list which is a
8-
list of causal_test_cases which provide control and treatment values, and an iterator of Estimator Class References
6+
A CausalTestSuite is an extension of the UserDict class, therefore it behaves as a python dictionary with the added
7+
functionality of this class.
8+
The dictionary structure should be the keys are base_test_cases representing the treatment and outcome Variables,
9+
and the values are test objects. Test Objects hold a causal_test_case_list which is a list of causal_test_cases
10+
which provide control and treatment values, and an iterator of Estimator Class References
911
10-
This structure can be fed into the CausalTestEngines execute_test_suite function which will iterate over all the
12+
This dictionary can be fed into the CausalTestEngines execute_test_suite function which will iterate over all the
1113
base_test_case's and execute each causal_test_case with each iterator.
1214
"""
1315

1416
def add_test_object(self, base_test_case, causal_test_case_list, estimators, estimate_type: str = "ate"):
17+
"""
18+
A setter object to allow for the easy construction of the dictionary test suite structure
19+
20+
:param base_test_case: A BaseTestCase object consisting of a treatment variable, outcome variable and effect
21+
:param causal_test_case_list: A list of causal test cases to be executed
22+
:param estimators: A list of estimators, the execute_test_suite function in the TestEngine will produce a list
23+
of test results for each estimator
24+
:param estimate_type: A string which denotes the type of estimate to return
25+
"""
1526
test_object = {"tests": causal_test_case_list, "estimators": estimators, "estimate_type": estimate_type}
1627
self.data[base_test_case] = test_object

0 commit comments

Comments
 (0)