y0 icon indicating copy to clipboard operation
y0 copied to clipboard

Add getting started notebook

Open cthoyt opened this issue 2 years ago • 1 comments

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

cthoyt avatar Jun 26 '23 21:06 cthoyt

Codecov Report

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

:exclamation: 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

codecov[bot] avatar Jun 26 '23 21:06 codecov[bot]

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.

warw511 avatar Mar 05 '25 22:03 warw511

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

tiekneeshrimp avatar Mar 05 '25 22:03 tiekneeshrimp

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

cthoyt avatar Mar 05 '25 22:03 cthoyt