-
Notifications
You must be signed in to change notification settings - Fork 8
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
[ENH] Add the ability to convert a DAG to an MAG #96
Conversation
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <50577809+aryan26roy@users.noreply.github.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #96 +/- ##
==========================================
- Coverage 80.02% 77.35% -2.67%
==========================================
Files 39 42 +3
Lines 2838 3413 +575
Branches 759 984 +225
==========================================
+ Hits 2271 2640 +369
- Misses 408 570 +162
- Partials 159 203 +44
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Can you rebase this? The GH files changed tab is showing a lot of files for some reason. |
Sure. |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
@adam2392 I think it's fine now. |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
@adam2392 I think I figured out how to implement the algorithm. Can you look over the comments and tell me if that is correct or not? |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.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.
Yeah it looks reasonably correct. Having a few tests, examples that we can refer to visually will be helpful
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Hey @adam2392 , how do I get/generate valid DAG, MAG pairs? The implementation is complete and I need to test it now. |
Nice! Perhaps peruse papers or come up with your own and draw them in tetrad |
@adam2392 I found a pair on the internet and just wanted to confirm, is this a correct DAG and MAG pair? H is a latent variable. |
I don't see how the bidirected edge from E to R came about. Isn't E present in the ancestral graph of R U S ? |
Oh yeah sorry. It should be E -> R right? See the definition on pg 1877 and the last paragraph on section 2.3. Maybe it would help if you explicitly wrote the algorithm into the docstring too. |
@adam2392 If two nodes are adjacent in a graph, can we say an inducing path exists between the two of them given all the conditions for an inducing path are satisfied? |
I believe the definition states this is trivially true. IIRC |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Ah! I found a bug in my inducing paths implementation. I never check to see if either X or Y are members of L or S (which would immediately make it impossible for them to have an inducing path between them, according to what I understood.) Since this is a small thing to fix, can I just do it in this PR? |
@adam2392 in the MAG shouldn't A -> E be A - E? My implementation seems to be working correctly. |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
A is an ancestor of E union S and E is an ancestor of A union S. When both are present in the ancestor sets its a undirected edge, right? |
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
@adam2392 I added two more tests, one of them is from a zhang paper and the method worked on it on the first try! I think the implementation is correct. Is the number of tests ok? |
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.
Nice! I didn't evaluate the tests yet but I left some comments on the readability of the code.
Signed-off-by: Aryan Roy <aryanroy5678@gmail.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.
Okay the code is looking better.
the tests can be improved by explicitly checking for the conditions of the MAG
Co-authored-by: Adam Li <adam2392@gmail.com> Signed-off-by: Aryan Roy <50577809+aryan26roy@users.noreply.github.com>
Co-authored-by: Adam Li <adam2392@gmail.com> Signed-off-by: Aryan Roy <50577809+aryan26roy@users.noreply.github.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Signed-off-by: Aryan Roy <aryanroy5678@gmail.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.
LGTM! Thanks @aryan26roy
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
Using frozenset was a better solution! |
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.
Actually small code-smell. Otw lgtm
Signed-off-by: Aryan Roy <aryanroy5678@gmail.com>
@adam2392 Incorporated all the suggestions you made. |
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.
LGTM assuming CIs pass!
* Add is_maximal function * add DAG to MAG function --------- Signed-off-by: Aryan Roy <aryanroy5678@gmail.com> Co-authored-by: Adam Li <adam2392@gmail.com>
Closes #95
Changes proposed in this pull request:
The algorithm is described in Zhang et al. 2008 on page number 1877.
Before submitting
section of the
CONTRIBUTING
docs.Writing docstrings section of the
CONTRIBUTING
docs.After submitting