-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEA] Generalized Adjustment Criterion (#1292)
* This PR adds support for identifying generalized (non-backdoor) adjustment sets. Specifically, it adds support for finding a minimal adjustment set if one exists (it is guaranteed to find a set if one does exist). Ongoing work in the pywhy-graphs library to enumerate all m-separating sets in causal graphs will later unlock the ability to enumerate all generalized adjustment sets. Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * adding default case Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * adding minimal test Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * poe format Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * adding test, throwing on unsupported Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * tweaks Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * dependency bump Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * delete misc files Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * fix dictionary mapping Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * make test check python version Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * adding another test Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * adding docs Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * restore notebooks I dont want to change Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * remove extraneous comment Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * remove comment and print statement from example notebook Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * add comma Signed-off-by: Nicholas Parente <parentenickj@gmail.com> * address typos Signed-off-by: Nicholas Parente <parentenickj@gmail.com> --------- Signed-off-by: Nicholas Parente <parentenickj@gmail.com>
- Loading branch information
Showing
15 changed files
with
740 additions
and
108 deletions.
There are no files selected for viewing
296 changes: 296 additions & 0 deletions
296
docs/source/example_notebooks/dowhy_generalized_covariate_adjustment_example.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class AdjustmentSet: | ||
"""Class for storing an adjustment set.""" | ||
|
||
BACKDOOR = "backdoor" | ||
# General adjustment sets generalize backdoor sets, but we will differentiate | ||
# between the two given the ubiquity of the backdoor criterion. | ||
GENERAL = "general" | ||
|
||
def __init__( | ||
self, | ||
adjustment_type, | ||
adjustment_variables, | ||
num_paths_blocked_by_observed_nodes=None, | ||
): | ||
self.adjustment_type = adjustment_type | ||
self.adjustment_variables = adjustment_variables | ||
self.num_paths_blocked_by_observed_nodes = num_paths_blocked_by_observed_nodes | ||
|
||
def get_adjustment_type(self): | ||
"""Return the technique associated with this adjustment set (backdoor, etc.)""" | ||
return self.adjustment_type | ||
|
||
def get_adjustment_variables(self): | ||
"""Return a list containing the adjustment variables""" | ||
return self.adjustment_variables | ||
|
||
def get_num_paths_blocked_by_observed_nodes(self): | ||
"""Return the number of paths blocked by observed nodes (optional)""" | ||
return self.num_paths_blocked_by_observed_nodes |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.