Skip to content

Commit

Permalink
deploy: d555e0f
Browse files Browse the repository at this point in the history
  • Loading branch information
amyheather committed Oct 22, 2024
1 parent 698a5fc commit 39e2b32
Show file tree
Hide file tree
Showing 22 changed files with 972 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 5c6088deb5d5aa02a039b1a988944663
config: 30d8b3aefefdfff3b81fc0aaee8e6744
tags: 645f666f9bcd5a90fca523b33c5a78b7
1 change: 1 addition & 0 deletions _sources/programming_notes/latex.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

self
linux
zenodo
machine_learning
open_science
other
Expand Down
69 changes: 69 additions & 0 deletions _sources/programming_notes/zenodo.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Zenodo

## Pushing old releases

This method was from <https://github.com/zenodo/zenodo/issues/1463#issuecomment-2349177518>.

I made the `zenodo_archiver.py` file (as below). I set the repository to sync on Zenodo sandbox. I got the access token from the webhook page in the repository settings. I then ran the command `python3 zenodo_archiver.py pythonhealthdatascience stars-eom-rcc v1.1.0 {{token}}`. You should see `<Response [202]>, which indicates it has been successful.

(You can do this for actual Zenodo - just remove `sandbox.` from url below, and sync and use webhook for actual zenodo)

```
# Source: https://github.com/zenodo/zenodo/issues/1463#issuecomment-2349177518
__author__ = ('prohde', 'dr-joe-wirth')
import requests, sys

# functions
def _submit(user_name:str, repo_name:str, tag:str, access_token:str) -> None:
"""tricks Zenodo into archiving a pre-existing release

Args:
user_name (str): github username
repo_name (str): github repository name
tag (str): the desired tag to archive
access_token (str): the access token from webhook page in repo settings
"""
# constant
HEADERS = {"Accept": "application/vnd.github.v3+json"}

# build the repo
repo = "/".join((user_name, repo_name))

# get the repo response and the release response for the repo
repo_response = requests.get(f"https://api.github.com/repos/{repo}", headers=HEADERS)
release_response = requests.get(f"https://api.github.com/repos/{repo}/releases", headers=HEADERS)

# get the data for the desired release
desired_release = [x for x in release_response.json() if x['tag_name'] == tag].pop()

# build the payload for the desired release
payload = {"action": "published", "release": desired_release, "repository": repo_response.json()}

# submit the payload to zenodo's api
submit_response = requests.post(
f"https://sandbox.zenodo.org/api/hooks/receivers/github/events/?access_token={access_token}",
json=payload
)

# print the response
print(submit_response)


def _main() -> None:
"""main runner function
"""
# parse command line arguments
user = sys.argv[1]
repo = sys.argv[2]
tag = sys.argv[3]
token = sys.argv[4]

# submit to zenodo
_submit(user, repo, tag, token)


# entrypoint
if __name__ == "__main__":
_main()

```
16 changes: 11 additions & 5 deletions causal_concepts/1_predict_vs_causal.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@
<script src="../_static/togglebutton.js"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js"></script>
<script src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs"></script>
<script type="module">import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs";import elkLayouts from "https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs";mermaid.registerLayoutLoaders(elkLayouts);mermaid.initialize({startOnLoad:false});</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js"></script>
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs";
window.addEventListener("load", () => mermaid.run());
</script>
<script>DOCUMENTATION_OPTIONS.pagename = 'causal_concepts/1_predict_vs_causal';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
Expand Down Expand Up @@ -536,8 +542,8 @@ <h3>Illustrative example<a class="headerlink" href="#illustrative-example" title
<li><p>However, if their goal is to <strong>inform actions to help retain customers</strong>, then it is important to understand the true relationships between features and the outcomes, and the counterfactual scenarios if features were modified. In this case, the team are interested in <strong>causation</strong>. In order for the team to understand the causal relationships, they would need to use causal inference methods (causal diagrams, appropriate techniques to account for confounding).</p></li>
</ul>
<p><strong>Why did this finding occur?</strong> If the team are interested in causation, they could draw a causal diagram (simplified version below). In it, they notice that some features are influenced by unmeasured confounding. WIth the example above, <strong>users who report more bugs are people who use the product more so encounter more bugs, but need the product more so are more likely to report</strong>. Because they can’t directly measure product need, the correlation they end up capturing in the predict model between bugs reported and renewal combines a small negative direct effect of bugs faced and a large positive confounding effect from product need. <a class="reference external" href="https://shap.readthedocs.io/en/latest/example_notebooks/overviews/Be%20careful%20when%20interpreting%20predictive%20models%20in%20search%20of%20causal%20insights.html">[source]</a></p>
<div class="mermaid">
flowchart LR;
<pre class="mermaid">
flowchart LR;

need(&quot;&lt;b&gt;Unmeasured&lt;/b&gt;&lt;br&gt;Product need&quot;):::white;
month(&quot;Monthly usage&quot;):::white;
Expand All @@ -555,7 +561,7 @@ <h3>Illustrative example<a class="headerlink" href="#illustrative-example" title
classDef white fill:#FFFFFF, stroke:#FFFFFF
classDef black fill:#FFFFFF, stroke:#000000
classDef important fill:#DDF2D1, stroke: #FFFFFF;
</div></div>
</pre></div>
<div class="section" id="explainability-v-s-causality">
<h3>Explainability v.s. causality<a class="headerlink" href="#explainability-v-s-causality" title="Permalink to this heading">#</a></h3>
<p>Explainability refers to being able to <strong>understand why a model makes certain predictions</strong>. The aim of explainable AI is to make ML models more transparent. It provides insights on:</p>
Expand Down
22 changes: 14 additions & 8 deletions causal_concepts/2_intro_to_causality.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@
<script src="../_static/togglebutton.js"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
<script src="../_static/design-tabs.js"></script>
<script src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs"></script>
<script type="module">import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs";import elkLayouts from "https://cdn.jsdelivr.net/npm/@mermaid-js/[email protected]/dist/mermaid-layout-elk.esm.min.mjs";mermaid.registerLayoutLoaders(elkLayouts);mermaid.initialize({startOnLoad:false});</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js"></script>
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs";
window.addEventListener("load", () => mermaid.run());
</script>
<script>DOCUMENTATION_OPTIONS.pagename = 'causal_concepts/2_intro_to_causality';</script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
Expand Down Expand Up @@ -572,8 +578,8 @@ <h2>Graphs<a class="headerlink" href="#graphs" title="Permalink to this heading"
<li><p><strong>Acyclic</strong> - as nodes cannot have a directed path from itself back to itself <a class="reference external" href="https://learning.edx.org/course/course-v1:HarvardX+PH559x+2T2020/home">[HarvardX PH559x]</a></p></li>
</ul>
<p>Example:</p>
<div class="mermaid">
flowchart LR;
<pre class="mermaid">
flowchart LR;

asp(&quot;Aspirin&quot;):::white;
str(&quot;Stroke&quot;):::white;
Expand All @@ -582,7 +588,7 @@ <h2>Graphs<a class="headerlink" href="#graphs" title="Permalink to this heading"

classDef white fill:#FFFFFF, stroke:#FFFFFF
classDef black fill:#FFFFFF, stroke:#000000
</div><p>We don’t draw causal diagrams as an exact, accurate representation of the world - instead, we draw causal DAGs to help us think about possible sources of bias when making causal inferences.</p>
</pre><p>We don’t draw causal diagrams as an exact, accurate representation of the world - instead, we draw causal DAGs to help us think about possible sources of bias when making causal inferences.</p>
<ul class="simple">
<li><p>They make sure we illustrate and identify our sources of biases (assumptions)</p>
<ul>
Expand Down Expand Up @@ -637,8 +643,8 @@ <h2>Structural equation modelling (SEM)<a class="headerlink" href="#structural-e
</ul>
</li>
</ol>
<div class="mermaid">
flowchart LR;
<pre class="mermaid">
flowchart LR;

soccer(&quot;Soccer&quot;):::white;
dehy(&quot;Dehydration&quot;):::white;
Expand All @@ -649,7 +655,7 @@ <h2>Structural equation modelling (SEM)<a class="headerlink" href="#structural-e

classDef white fill:#FFFFFF, stroke:#FFFFFF
classDef black fill:#FFFFFF, stroke:#000000
</div><ol class="arabic simple" start="4">
</pre><ol class="arabic simple" start="4">
<li><p>There are <strong>no “back doors”</strong> from cause to effect <a class="reference external" href="https://support.sas.com/resources/papers/proceedings19/3240-2019.pdf">[Madhanagopal and Amrhein 2019]</a></p></li>
</ol>
<p><strong>Covariance matrix</strong></p>
Expand Down
Loading

0 comments on commit 39e2b32

Please sign in to comment.