New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functional api/causal estimators #746
Conversation
test advanced |
Launching advanced tests 🚀 |
7 similar comments
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Advanced tests succeeded! ✅ |
1 similar comment
Advanced tests succeeded! ✅ |
Advanced tests failed! ❌ |
Launching advanced tests 🚀 |
5 similar comments
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Launching advanced tests 🚀 |
Advanced tests succeeded! ✅ |
5 similar comments
Advanced tests succeeded! ✅ |
Advanced tests succeeded! ✅ |
Advanced tests succeeded! ✅ |
Advanced tests succeeded! ✅ |
Advanced tests succeeded! ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @andresmor-ms for this comprehensive refactor. I've added inline comments.
Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com>
This avoids a future deprecation warning. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com>
Related to issue #689 Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
e9a193c
to
eb7a763
Compare
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
Signed-off-by: Andres Morales <andresmor@microsoft.com>
28578ac
to
972b071
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate all these changes @andresmor-ms
I've added a few minor suggestions, but otherwise looks good to me. Happy to merge once you address them.
Nice that this PR also fixes the reason for the main branch failing. thanks for doing that.
docs/source/example_notebooks/sensitivity_analysis_nonparametric_estimators.ipynb
Show resolved
Hide resolved
Signed-off-by: Andres Morales <andresmor@microsoft.com>
cbda5ca
to
0b52e75
Compare
Signed-off-by: Andres Morales <andresmor@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Merging.
* Initial refactor Signed-off-by: Andres Morales <andresmor@microsoft.com> * fix placebo treatment refuter randint call (py-why#702) Signed-off-by: Andres Morales <andresmor@microsoft.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Adding ProductRegressor to gcm auto assignment This model simply takes the product of the inputs. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Make conditional independence test based on regression less flaky Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add workflow to mark and close stale issues Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Mark econml, pydot, and pygraphviz as extras (py-why#701) * mark econml, pydot, and pygraphviz as extras Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * restore dep order Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Change mechanics of Docker image build and usage - Introduce a GH Action to build Docker image for docs generation every time the Dockerfile is changed - Trigger docs generation when a new Docker image was built - Minor fix in Dockerfile to avoid outdated apt database Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix GH Actions workflow docs trigger This needs to point to the correct title. Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add an option for auto assignment in distribution change attribution Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Binary bool features now remain binary in one hot encoding for ANMs in gcm Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Import dowhy.causal_estimators.econml locally (py-why#713) This imports it within the function where it's used. It removes the hard dependency on EconML and only requires it when using sensitivity_non_parametric_partial_r2. Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Adding causal-learn as (required) dependency The gcm module will heavily rely on the independence tests in the causal-learn package, i.e., it cannot be optional. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add econml, pydot extras to Documentation Build (py-why#714) * add econml, pydot extras to docs build Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * add econml, pydot extras to other build tasks Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * update nightly install Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Replace HSCI and KCI with causal-learn package functions The causal-learn package provides more sophisticated implementations of the kernel independence tests. Instead of reimplementing it, we utilize the existing functions from causal-learn instead. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add pytest markers for "focused" and "notebook" (py-why#716) add pytest markers for notebook, focused to remove runtime warnings Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Make a gcm unit test for drawing from an interventional distribution less flaky (py-why#715) Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix docs-on-demand Issues (py-why#718) * fix issues with docs-on-demand GH Actions script Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * update image name Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * restore jupyter notebook from main Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * remove accidentally added file Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix avoid retrain estimator on causal_model API Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add independence tests as parameter to distribution change This removes the option to change the mechanism change test directly. As it turned out, changing the independence test is the more common case. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Make unit test on intervention less strict To avoid flaky tests. Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix issue with identifying boolean values of dataframes in is_categorical Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Restore some key tests into the regular CI pipeline (py-why#725) * restore some key notebook tests Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * remove advanced marks from unit tests Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * remove advanced mark from test_validation.py Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * apply formatting Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * update test durations, restore some test notebooks Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * bump the test splits Signed-off-by: Chris Trevino <darthtrevino@gmail.com> * restore main notebook tests, take a more piecemeal approach Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Re-introduce include_simulated_confounder as method Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add constants name Signed-off-by: Andres Morales <andresmor@microsoft.com> * Use a different github action for notifying discord (py-why#731) use a different github action for notifying discord Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Set seed on data generation for deterministic test Signed-off-by: Andres Morales <andresmor@microsoft.com> * Uncomment notebook examples for coverage Signed-off-by: Andres Morales <andresmor@microsoft.com> * Check random_state type on placebo_treatment_refuter Fix py-why#719 Signed-off-by: Andres Morales <andresmor@microsoft.com> * introduce fit() method for causal estimators Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix refuters after estimator refactor Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix refutation issues Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix estimator issues Signed-off-by: Andres Morales <andresmor@microsoft.com> * Restore Notebook Tests in Regular CI (py-why#728) Signed-off-by: Andres Morales <andresmor@microsoft.com> * Upgrade xgboost (py-why#739) upgrade xgboost Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Remove bibtex from GCM introduction This is covered in docs/source/cite.rst. Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add 'Typical usage' section in GCM introduction Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix issue with categorical inputs to gcm ProductRegressor Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Use concat instead of append for pandas in distribution change This avoids a future deprecation warning. Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Remove unnecessary double underscores in gcm module Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Rename gcm bootstrap training to fit_and_compute Related to issue py-why#689 Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> * Clean output of notebook Signed-off-by: Andres Morales <andresmor@microsoft.com> * format + small fix on tests Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add docs Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add docs to fit() Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add types to constructors Signed-off-by: Andres Morales <andresmor@microsoft.com> * Apply format Signed-off-by: Andres Morales <andresmor@microsoft.com> * Use protocol for econml and causalml, PR comments Signed-off-by: Andres Morales <andresmor@microsoft.com> * update docs for estimator classes Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add optional data param for estimate_effect Signed-off-by: Andres Morales <andresmor@microsoft.com> * Update docs Signed-off-by: Andres Morales <andresmor@microsoft.com> * Fix merge Signed-off-by: Andres Morales <andresmor@microsoft.com> * Format code Signed-off-by: Andres Morales <andresmor@microsoft.com> * Address PR comments Signed-off-by: Andres Morales <andresmor@microsoft.com> * Add docs + fix placebo_refuter Signed-off-by: Andres Morales <andresmor@microsoft.com> * Update docs Signed-off-by: Andres Morales <andresmor@microsoft.com> Signed-off-by: Andres Morales <andresmor@microsoft.com> Signed-off-by: Patrick Bloebaum <bloebp@amazon.com> Signed-off-by: Peter Goetz <pego@amazon.com> Signed-off-by: Chris Trevino <darthtrevino@gmail.com> Co-authored-by: Patrick Bloebaum <bloebp@amazon.com> Co-authored-by: Peter Goetz <pego@amazon.com> Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com> Co-authored-by: Peter Götz <pego@amazon.de> Co-authored-by: Patrick Blöbaum <51325689+bloebp@users.noreply.github.com>
fit()
method to estimators.*args
and**kwargs
and have more explicit parameters.fit()
and modify arguments toestimate_effect()