Skip to content

Commit

Permalink
fix dowhy_ not existance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-she committed Nov 21, 2024
1 parent 54275bc commit ada34cc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions econml/dowhy.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,13 @@ def __getattr__(self, attr):
# don't proxy special methods
if attr.startswith('__'):
raise AttributeError(attr)
elif attr in ['_cate_estimator', 'dowhy_',
'identified_estimand_', 'estimate_']:
return super().__getattr__(attr)
elif attr == "dowhy_":
if "dowhy_" not in dir(self):
raise RuntimeError("Please call DoWhyWrapper.fit first before any other operations")
else:
return self.dowhy_
elif attr in ['_cate_estimator', 'identified_estimand_', 'estimate_']:
return getattr(self, attr)
elif attr.startswith('dowhy__'):
return getattr(self.dowhy_, attr[len('dowhy__'):])
elif hasattr(self.estimate_._estimator_object, attr):
Expand Down

0 comments on commit ada34cc

Please sign in to comment.