Skip to content

Commit 7c8a3f9

Browse files
Add Comments
1 parent 0b91c5e commit 7c8a3f9

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

causal_testing/json_front/json_class.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ def __init__(self):
4747
self.modelling_scenario = None
4848
self.causal_specification = None
4949

50-
@property
51-
def estimation_model(self):
52-
return
53-
54-
def set_paths(self, directory_path: Path):
50+
def set_path(self, directory_path: Path):
5551
"""
5652
Takes a path of the directory containing all scenario specific files and creates individual paths for each file
5753
:param directory_path: pathlib.Path pointing towards directory containing all scenario specific user code and files

examples/poisson/causal_test_setup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ class MyJsonUtility(JsonUtility):
154154
"""Extension of JsonUtility class to add modelling assumptions to the estimator instance"""
155155

156156
def add_modelling_assumptions(self, estimator: LinearRegressionEstimator):
157-
if "intensity" in [v for v in estimator.treatment[0]] and hasattr(estimator, "add_squared_term_to_df"):
157+
# Add squared intensity term as a modelling assumption if intensity is the treatment of the test
158+
if "intensity" in estimator.treatment[0]:
158159
estimator.add_squared_term_to_df("intensity")
159160
if isinstance(estimator, WidthHeightEstimator):
160161
estimator.add_product_term_to_df("width", "intensity")
@@ -164,10 +165,12 @@ def add_modelling_assumptions(self, estimator: LinearRegressionEstimator):
164165
if __name__ == "__main__":
165166
args = get_args()
166167

167-
json_utility = MyJsonUtility()
168-
json_utility.set_paths(args.directory_path)
168+
json_utility = MyJsonUtility() # Create an instance of the extended JsonUtility class
169+
json_utility.set_path(args.directory_path) # Set the path to the data.csv, dag.dot and causal_tests.json file
170+
171+
# Load the Causal Variables into the JsonUtility class ready to be used in the tests
169172
json_utility.set_variables(inputs, outputs, metas, distributions, populates)
170-
json_utility.setup()
173+
json_utility.setup() # Sets up all the necessary parts of the json_class needed to execute tests
171174

172175
mutates = {
173176
"Increase": lambda x: json_utility.modelling_scenario.treatment_variables[x].z3 >

0 commit comments

Comments
 (0)