@@ -154,7 +154,8 @@ class MyJsonUtility(JsonUtility):
154
154
"""Extension of JsonUtility class to add modelling assumptions to the estimator instance"""
155
155
156
156
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 ]:
158
159
estimator .add_squared_term_to_df ("intensity" )
159
160
if isinstance (estimator , WidthHeightEstimator ):
160
161
estimator .add_product_term_to_df ("width" , "intensity" )
@@ -164,10 +165,12 @@ def add_modelling_assumptions(self, estimator: LinearRegressionEstimator):
164
165
if __name__ == "__main__" :
165
166
args = get_args ()
166
167
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
169
172
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
171
174
172
175
mutates = {
173
176
"Increase" : lambda x : json_utility .modelling_scenario .treatment_variables [x ].z3 >
0 commit comments