py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
6.89k stars 916 forks source link

Add accessor and comments about CausalModel's CausalEstimator cache. #1113

Closed drawlinson closed 6 months ago

drawlinson commented 7 months ago

Add an accessor and comments explaining the expected lifecycle and use of CausalEstimator objects stored in the CausalModel._estimator_cache dict. Accessor function gains test coverage and slightly simplifies logic via use in CausalModel.estimate_effect().

See issue https://github.com/py-why/dowhy/issues/1071

bloebp commented 6 months ago

Also thanks for opening PR for this! Similar as for the one-hot-encoding, can you add a unit test for this?

drawlinson commented 6 months ago

Unit test added; checks that the relevant CausalEstimator objects exist and that they're the expected objects when retrieved from either accessor (via CausalEstimate.estimator or CausalModel.get_estimator()).

drawlinson commented 6 months ago

Unsure why the CI tests failed, that part of the code is untouched and they all pass locally. Is this a build issue?

bloebp commented 6 months ago

Unsure why the CI tests failed, that part of the code is untouched and they all pass locally. Is this a build issue?

Yea its an unrelated issue of a flaky unit test. Don't worry, I will re-run it.

drawlinson commented 6 months ago

Thankyou!