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

Add getting started notebook #148

Merged
merged 16 commits into from
Mar 7, 2025
Merged

Add getting started notebook #148

merged 16 commits into from
Mar 7, 2025

Conversation

cthoyt
Copy link
Member

@cthoyt cthoyt commented Jun 26, 2023

As a follow-up to #140, this adds/updates some additional tutorial notebooks

@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #148 (dc40d48) into main (22cdac4) will increase coverage by 2.46%.
The diff coverage is n/a.

❗ Current head dc40d48 differs from pull request most recent head 9f2665f. Consider uploading reports for the commit 9f2665f to get more accurate results

@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
+ Coverage   78.07%   80.54%   +2.46%     
==========================================
  Files          36       39       +3     
  Lines        2176     2416     +240     
  Branches      481      550      +69     
==========================================
+ Hits         1699     1946     +247     
- Misses        381      387       +6     
+ Partials       96       83      -13     

see 10 files with indirect coverage changes

@warw511
Copy link

warw511 commented Mar 5, 2025

Dependency suggestion:
When installing y0, there are notebooks that depend on matplotlib and ipykernel. Do we want to include this in dependencies? Alternatively, we could have an option tag called notebooks that only install things that are necessary for notebooks.

@tiekneeshrimp
Copy link

Some discrepancies when running Getting-Started.ipynb:

1. Issue: intervention model in "Backdoor Example" paragraph does not match up with description

**Expectation**: There should be a green line somewhere intervening on smoking? Quote "Here you can see that the black line is the distribution of the true causal effect, the green line is the distribution of the estimated causal effect obtained by training the parameters of the model on the let with observational data"
**Output**: 

Image
No green line apparent on model

2. Issue: Rearrangement of backdoor_graph generated

**Expectation** :

Image

**Output** :

Image

3. Issue: Rearrangement of Front Door model equation when running the following

identify(
    Identification(query=cancer_do_smoking, estimand=P(Cancer, Tar, Smoking), graph=front_door)
)
**Expectation**: 

Image

**Output**: 

Image
Unsure if this is the biggest issue, but may affect equation outputs in the future

4. Issue: Rearrangement of identifiable_graph when running the following

from y0.algorithm.identify.id_star import id_star
from y0.algorithm.identify.idc_star import idc_star

identifiable_graph = NxMixedGraph.from_edges(
    directed=[(X, W), (D, Z), (W, Y), (D, Y)], undirected=[(X, Y)]
)
identifiable_graph.draw()

AND

id_star(graph=identifiable_graph, event={Y @ -X: -Y, X: +X, Z @ -D: -Z, D: -D})

Expectation

Image

**output**

Image

@cthoyt
Copy link
Member Author

cthoyt commented Mar 5, 2025

Dependency suggestion: When installing y0, there are notebooks that depend on matplotlib and ipykernel. Do we want to include this in dependencies? Alternatively, we could have an option tag called notebooks that only install things that are necessary for notebooks.

No, it's assumed that if you are interacting with a jupyter notebook then you have jupyter installed (which itself depends on IPython). This doesn't need to be part of y0's requirements nor optional dependencies

@djinnome djinnome marked this pull request as ready for review March 5, 2025 23:03
@djinnome djinnome requested a review from Copilot March 5, 2025 23:04

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds a new tutorial notebook that provides an overview of identification methods in causal inference.

  • Adds a complete notebook explaining identification methods, including concepts such as the back-door and front-door criteria and examples.

Reviewed Changes

File Description
notebooks/What is identification.ipynb New notebook detailing identification methods used in causal inference.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

notebooks/What is identification.ipynb:44

  • [nitpick] The heading 'Napkin problem' is ambiguous; consider renaming it to a more descriptive title or adding context to clarify its purpose.
### Example: Napkin problem

notebooks/What is identification.ipynb:70

  • [nitpick] The asterisk in 'IDC*' is unclear; consider clarifying its meaning or removing it if it is not necessary.
### Example 4: IDC*
@djinnome djinnome requested review from adamrupe and djinnome March 7, 2025 00:04
Copy link
Collaborator

@adamrupe adamrupe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@adamrupe adamrupe merged commit f020a93 into main Mar 7, 2025
12 checks passed
@adamrupe adamrupe deleted the getting-started-notebook branch March 7, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants