EconML icon indicating copy to clipboard operation
EconML copied to clipboard

AttributeError using dowhy refute_estimate

Open darjooling86 opened this issue 3 years ago • 4 comments

Hi,

I would like to validate my estimations with the refutation functions offered by dowhy. I trained a T-Learner model in econml (which worked fine) and created a DoWhyWrapper object. But calling from there the 'refute_estimate' function, I get an error (see screenshot).

Could you please let my know, why this error occurs?

Thank you very much Bildschirmfoto 2022-02-18 um 12 30 15 !

darjooling86 avatar Feb 18 '22 11:02 darjooling86

Thanks for reporting this issue. What versions of econml and dowhy do you have installed?

kbattocchi avatar Feb 18 '22 14:02 kbattocchi

DoWhy: 0.6 econml: 0.13.0

Thank you!

darjooling86 avatar Feb 18 '22 14:02 darjooling86

Sorry for the unhelpful error message; the issue ultimately is that you need to call fit through the dowhy wrapper first before calling refute_estimate, because that will not only fit the econml estimator but also configure the causal graph and other state for dowhy (you do not need to call fit on the original object since you'll be fitting via the wrapper).

As a minor side note, we also provide a dowhy attribute on all of our estimators so that you could do something like

k=T_Learner(models=models).dowhy
k.fit(Y=train[y], T=train[t], X=train[x], inference='bootstrap')
k.refute_estimate(method_name='random_common_cause')

instead of creating the DoWhyWrapper manually. But in any case, you need to call fit on the wrapper before trying to refute.

We'll try to ensure that we provide a better error message in a future release - thanks for raising this issue.

kbattocchi avatar Feb 18 '22 14:02 kbattocchi

Thank you so much for your assistance! Works fine now :)

Have a nice weekend!

darjooling86 avatar Feb 18 '22 15:02 darjooling86