Skip to content
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

Hierarchical Causal Models #236

Draft
wants to merge 51 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d911be0
functions for creating and querying HCMs with pygraphviz
adamrupe Sep 5, 2024
b019b2b
functionality to collapse phygraphviz HCMs to nxmixedgraphs
adamrupe Sep 5, 2024
7902301
added __all__
adamrupe Sep 5, 2024
9e6ab5d
added test_hierarchical
adamrupe Sep 5, 2024
242a944
pygraphviz dep and lint exception for hierarchical in pyproject
adamrupe Sep 6, 2024
74b86f5
auto lint hierarchical
adamrupe Sep 6, 2024
466095a
auto lint test_hierarchical
adamrupe Sep 6, 2024
d6bc3dc
added docstrings to hierarchical.py
adamrupe Sep 6, 2024
f9df280
added docstrings to test_hierarchical.py
adamrupe Sep 6, 2024
a594c17
more ignores in pyproject.toml
adamrupe Sep 6, 2024
83c5ff6
imperative docstrings
adamrupe Sep 6, 2024
ce1d59b
cleaned whitespace
adamrupe Sep 6, 2024
636a1cd
lint HCM_from_lists
adamrupe Sep 6, 2024
9318cbf
more linting
adamrupe Sep 6, 2024
3ac6c5c
added typing to hierarchical.py
adamrupe Sep 6, 2024
aa24386
added typing to test_hierarchical.py
adamrupe Sep 6, 2024
d2685f6
HCM notebook with Fig 2 up to collapsed models
adamrupe Sep 11, 2024
dc555a9
lint fixes
adamrupe Sep 11, 2024
759b6f8
docstring lint
adamrupe Sep 11, 2024
b4813fc
Merge branch 'main' into HCM-fig2
cthoyt Sep 12, 2024
7d149b0
test fixtures for Fig 2 augmented models
adamrupe Sep 12, 2024
32ef914
added augment_collapsed_model function that implements Algorithm 2
adamrupe Sep 12, 2024
6a9dc95
tox formatting
adamrupe Sep 12, 2024
288e731
tests for augmentation and formatting
adamrupe Sep 12, 2024
acc572c
added augmented models to notebook
adamrupe Sep 12, 2024
ac17676
add marginalize function implementing Algorithm 3
adamrupe Sep 12, 2024
7ea4295
Instrument test for algorithm 3
adamrupe Sep 12, 2024
f915628
Merge branch 'main' into HCM-fig2
cthoyt Sep 13, 2024
f7ab91d
Merge branch 'main' into HCM-fig2
cthoyt Sep 13, 2024
d3276ed
Clean up literals
cthoyt Sep 13, 2024
87cfa09
update collapse_HCM to preserve unit-level edges
adamrupe Sep 13, 2024
790faf4
Merge remote-tracking branch 'refs/remotes/origin/HCM-fig2' into HCM-…
adamrupe Sep 13, 2024
1762c90
update augment and marginalize functions to return new objects instea…
adamrupe Sep 13, 2024
2bda92c
added copy_HCM
adamrupe Sep 17, 2024
7f6a3d8
Fig 2 fixture tests for copy_HCM
adamrupe Sep 17, 2024
3e7c100
added convert_to_HCGM
adamrupe Sep 17, 2024
6769623
tests for convert to HCGM
adamrupe Sep 18, 2024
0f544ce
minor lint
adamrupe Sep 18, 2024
4dc67ee
update HCGM styles for consistency with observed vars
adamrupe Sep 18, 2024
9db6c17
update convert_to_HCGM to handle unobserved Q vars
adamrupe Sep 18, 2024
eaf4d05
add functions to parse semiMarkov edges from HCMs with latent variables
adamrupe Sep 18, 2024
5e1dd59
updated collapse_HCM with intermediate convert_to_HCGM; follows paper…
adamrupe Sep 18, 2024
c9d96e2
lint and fix bug on direct_unit_descendents
adamrupe Sep 19, 2024
680ce83
bug fix augment_collapsed_model
adamrupe Sep 25, 2024
22464ba
added sorting to create_Qvar
adamrupe Sep 25, 2024
6aa550e
update test with sorted Qvar
adamrupe Sep 25, 2024
65e7b07
Merge branch 'main' into HCM-fig2
cthoyt Oct 1, 2024
c15c73b
Update hierarchical.py
cthoyt Oct 1, 2024
5790dd2
Add type checking for tests
cthoyt Oct 1, 2024
64f36fc
Update test_hierarchical.py
cthoyt Oct 1, 2024
3af8c66
Update tox.ini
cthoyt Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
668 changes: 668 additions & 0 deletions notebooks/Hierarchical Causal Models.ipynb

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions notebooks/images/confounder_HCM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions notebooks/images/confounder_and_interference_HCM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions notebooks/images/instrument_HCM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies = [
"scikit-learn",
"statsmodels",
"scipy",
"pygraphviz",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -213,6 +214,9 @@ ignore = [
"notebooks/**/*.ipynb" = ["T201", "S101", "N811", "N802", "N803"]
"src/y0/algorithm/separation/sigma_separation.py" = ["RUF002", "RUF003"]
"src/y0/algorithm/separation/__init__.py" = ["RUF002", "RUF003"]
"tests/**/*.py" = ["S101"]
"tests/test_hierarchical.py" = ["N803", "N802", "N806"]
"src/y0/hierarchical.py" = ["N803", "N802", "N806"]

[tool.ruff.lint.pydocstyle]
convention = "pep257"
Expand Down
Loading
Loading