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.88k stars 916 forks source link

Code for Multiply-Robust Causal Change Attribution #1183

Closed victor5as closed 1 month ago

victor5as commented 1 month ago

Added code for the Multiply-Robust Causal Change Attribution method in this paper:

Quintas-Martinez, V., Bahadori, M. T., Santiago, E., Mu, J., Janzing, D., and Heckerman, D. Multiply-Robust Causal Change Attribution, Proceedings of the 41st International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024.

New files:

  1. Source code in dowhy/gcm/distribution_change_robust.py
  2. Example notebook in docs/source/example_notebooks/gcm_cps2015_dist_change_robust.ipynb
  3. Tests in tests/gcm/test_distribution_change_robust.py

Updated files:

  1. Documentation in docs/source/user_guide/causal_tasks/root_causing_and_explaining/distribution_change.rst
bloebp commented 1 month ago

It seems the notebook cannot be run due to seaborn import. Can you prepare it without seaborn? I know the plots look much better with it, but it would introduce another dependency then.

victor5as commented 1 month ago

It seems the notebook cannot be run due to seaborn import. Can you prepare it without seaborn? I know the plots look much better with it, but it would introduce another dependency then.

Yes, not a problem!

bloebp commented 1 month ago

Seems there is another issue with the notebook:

https://github.com/py-why/dowhy/actions/runs/9130322477/job/25118726705?pr=1183#step:10:195

The lightgbm package is not a requirement for DoWhy. Can you use a model from skelarn directly instead? Something like https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.HistGradientBoostingRegressor.html? I guess they might be similar and for the notebook, it should be sufficient.

victor5as commented 1 month ago

Makes sense. I've updated the notebook to use HistGradientBoosting.

bloebp commented 1 month ago

Once the checks are done (except DCO), I will merge it.

Great work!!

victor5as commented 1 month ago

Thank you again for all your help!

bloebp commented 1 month ago

One more thing, can you add the notebook to the main examples overview in https://github.com/py-why/dowhy/blob/main/docs/source/example_notebooks/nb_index.rst? Maybe before or after the supply chain example?

victor5as commented 1 month ago

Hi Patrick, I just added it. I hope I did it with the correct formatting! Thanks again.

bloebp commented 1 month ago

@all-contributors please add @victor5as for code

allcontributors[bot] commented 1 month ago

@bloebp

I've put up a pull request to add @victor5as! :tada: