Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5939cb8
Fix adjusted MSE for the extra flexible model
1106maxi Sep 23, 2026
f4b25e0
Fix no-selection check in double lasso simulation
1106maxi Sep 23, 2026
6ea1a3b
Use HC1 robust SEs and fix interaction term selection
1106maxi Sep 23, 2026
05c2bc3
Update to current pgmpy API
1106maxi Sep 23, 2026
1ef2857
Update to current pgmpy API
1106maxi Sep 23, 2026
84c15a5
Correct CI method descriptions, add Cornfield exact interval
1106maxi Sep 23, 2026
37761cc
Correct CI method descriptions, add Cornfield exact interval
1106maxi Sep 23, 2026
ee448bf
Use heteroskedasticity-robust SEs to match Python notebook
1106maxi Sep 23, 2026
7097b19
Add restyled histogram of estimation error
1106maxi Sep 23, 2026
88bdea8
Remove stale Colab badge pointing at feature branch
1106maxi Sep 23, 2026
91d309f
Remove trailing empty cell
1106maxi Sep 23, 2026
ebd5fdf
Update .gitignore
1106maxi Sep 23, 2026
bc4399c
Add long story short examples
1106maxi Sep 25, 2026
1ffa2b6
PM-4 Simulation Figures
chansen776 Sep 25, 2026
634e78f
Remove unused imports
1106maxi Sep 28, 2026
91827b3
Update AC-1 notebooks
chansen776 Sep 29, 2026
abe22d1
Update python-debiased-ml-for-partially-linear-iv-model.ipynb
chansen776 Sep 30, 2026
ed60dc2
AC-2 AJR notebooks
chansen776 Sep 30, 2026
b26815d
AC-2 401k notebooks
chansen776 Sep 30, 2026
538bbaf
ADML 401k notebook
chansen776 Sep 30, 2026
01046c5
Update r-ADML-401k.irnb
chansen776 Oct 1, 2026
f3beebe
T-ADML notebooks
chansen776 Oct 1, 2026
b38e656
ADML notebooks
chansen776 Oct 1, 2026
c1cd113
CI: run all folders, add T-ADML, fix system deps and lint config
1106maxi Oct 22, 2026
73aec5f
requirements: raise scikit-learn pin to >=1.4,<1.7
1106maxi Oct 22, 2026
b704925
Install hdmpy from PyPI instead of cloning the repo
1106maxi Oct 22, 2026
6d39022
Pin econml 0.16.0 where it is installed
1106maxi Oct 22, 2026
6f9887a
Update notebooks for current scikit-learn, pgmpy, xgboost and rpy2
1106maxi Oct 22, 2026
377dce0
Install archived rdd package from the CRAN archive
1106maxi Oct 22, 2026
c3c6953
Fix flake8 errors in AC1 and CM1
1106maxi Oct 22, 2026
d682587
Style T-ADML R notebooks to pass lintr
1106maxi Oct 22, 2026
93004e7
Fix flake8 errors in T-ADML gas notebook
1106maxi Oct 22, 2026
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
17 changes: 11 additions & 6 deletions .github/workflows/check-R-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
test-R-notebooks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory: ['PM1', 'PM2', 'PM3', 'PM4', 'PM5', 'CM1', 'CM2', 'CM3', 'AC1', 'AC2', 'T']
directory: ['PM1', 'PM2', 'PM3', 'PM4', 'PM5', 'CM1', 'CM2', 'CM3', 'AC1', 'AC2', 'T', 'T-ADML']
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -37,21 +38,21 @@ jobs:
grep -E '^${{ matrix.directory }}/[^/]+\.Rmd$' changed_files.txt
exit 1
fi
grep -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-and-transform-R-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt
grep -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-R-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt

- name: Find changed notebooks in Push
if: github.event_name == 'push'
id: find_notebooks_push
run: |
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > changed_files.txt
grep -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-and-transform-R-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt
grep -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-R-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt

- name: Check if any notebooks changed in PR or Push
if: (github.event_name == 'push') || (github.event_name == 'pull_request')
id: check_notebooks
run: |
cat changed_notebooks.txt
if grep -q -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-and-transform-R-notebooks.yml$' changed_notebooks.txt; then
if grep -q -E '^${{ matrix.directory }}/[^/]+\.irnb$|^${{ matrix.directory }}/.*\.R|\.github/workflows/check-R-notebooks.yml$' changed_notebooks.txt; then
echo "notebooks_changed=true" >> $GITHUB_ENV
else
echo "notebooks_changed=false" >> $GITHUB_ENV
Expand All @@ -70,7 +71,7 @@ jobs:
if: env.notebooks_changed == 'true'
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y libcurl4-openssl-dev libuv1-dev libglpk-dev

- name: Set up Python
if: env.notebooks_changed == 'true'
Expand Down Expand Up @@ -125,7 +126,9 @@ jobs:
library(lintr)
linters <- linters_with_defaults(line_length_linter = line_length_linter(120),
object_name_linter = object_name_linter(styles = c("snake_case", "CamelCase", "camelCase")),
object_usage_linter = NULL)
object_usage_linter = NULL,
pipe_consistency_linter = NULL,
return_linter = NULL)
rmd_files <- list.files(path = "${{ matrix.directory }}", pattern = "\\.Rmd$", full.names = TRUE)
linting_error <- FALSE
for (rfile in rmd_files) {
Expand Down Expand Up @@ -195,6 +198,8 @@ jobs:
' 2>/dev/null
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# let R (reticulate/keras) use the Python with TensorFlow installed above
RETICULATE_PYTHON: ${{ env.pythonLocation }}/bin/python

- name: Upload execution log
if: "((env.notebooks_changed == 'true') && (env.linting_errors_found == 'false'))"
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/check-python-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
test-python-notebooks:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Removed: {windows-latest, macos-latest} as they were taking too long. Consider adding back in the future
os: [ubuntu-latest]
directory: [PM1, PM2, PM3, PM4, PM5, CM1, CM2, CM3, AC1, AC2, T]
directory: [PM1, PM2, PM3, PM4, PM5, CM1, CM2, CM3, AC1, AC2, T, T-ADML]

steps:
- name: Checkout repository
Expand All @@ -34,21 +35,21 @@ jobs:
# git fetch origin ${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }}
# git diff --name-only origin/${{ github.event.pull_request.base.ref }}...origin/${{ github.event.pull_request.head.ref }} > changed_files.txt
git diff --name-only -r HEAD^1 HEAD > changed_files.txt
grep -E '\.ipynb$|\.py$|\.github/workflows/python-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt
grep -E '\.ipynb$|\.py$|\.github/workflows/check-python-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt

- name: Find changed notebooks in Push
if: github.event_name == 'push'
id: find_notebooks_push
run: |
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > changed_files.txt
grep -E '\.ipynb$|\.py$|\.github/workflows/python-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt
grep -E '\.ipynb$|\.py$|\.github/workflows/check-python-notebooks.yml$' changed_files.txt > changed_notebooks.txt || echo "No notebooks changed" > changed_notebooks.txt

- name: Check if any notebooks changed in PR or Push
if: (github.event_name == 'push') || (github.event_name == 'pull_request')
id: check_notebooks
run: |
cat changed_notebooks.txt
if grep -q -E '^${{ matrix.directory }}/[^/]+\.ipynb$|^${{ matrix.directory }}/.*\.py$|\.github/workflows/python-notebooks.yml$' changed_notebooks.txt; then
if grep -q -E '^${{ matrix.directory }}/[^/]+\.ipynb$|^${{ matrix.directory }}/.*\.py$|\.github/workflows/check-python-notebooks.yml$' changed_notebooks.txt; then
echo "notebooks_changed=true" >> $GITHUB_ENV
else
echo "notebooks_changed=false" >> $GITHUB_ENV
Expand Down Expand Up @@ -81,12 +82,9 @@ jobs:
run: sudo apt-get install -y libgraphviz-dev
shell: bash

- name: Install R if folder is CM3
if: "(env.notebooks_changed == 'true') && (matrix.directory == 'CM3' && matrix.os == 'ubuntu-latest')"
run: |
sudo apt-get update
sudo apt-get install -y r-base
shell: bash
- name: Install R if folder is CM3 or T-ADML
if: "(env.notebooks_changed == 'true') && ((matrix.directory == 'CM3' || matrix.directory == 'T-ADML') && matrix.os == 'ubuntu-latest')"
uses: r-lib/actions/setup-r@v2

- name: Set up Python
if: "(env.notebooks_changed == 'true') && (! (matrix.directory == 'CM3' && (matrix.os == 'windows-latest' || matrix.os == 'macos-latest')))"
Expand Down Expand Up @@ -117,6 +115,8 @@ jobs:
flake8_errors=0
for notebook in ${{ matrix.directory }}/*.ipynb; do
[ "$(basename "$notebook")" = "python-dosearch.ipynb" ] && continue
# uses %%R (rpy2) cells, which flake8 cannot parse
[ "$(basename "$notebook")" = "python-ADML-401k.ipynb" ] && continue
flake8-nb --config=.flake8 "$notebook" > "linting_logs/$(basename "$notebook" .ipynb)_linting.txt" 2>&1 || flake8_errors=$((flake8_errors+1))
done
echo "flake8_errors=$flake8_errors" >> $GITHUB_ENV
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,8 @@ dmypy.json
/CM1/hdmpy
/AC1/hdmpy
/PM2/hdmpy

# Notebook updates
/TEMP_updated_notebooks
/tools
.vscode/settings.json
4 changes: 3 additions & 1 deletion AC1/python-proxy-controls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,10 @@
"data = data[data.wt != 999]\n",
"data = data[data.parity != 99]\n",
"data = data[data.parity != 9]\n",
"data = data[data.race != 99]\n",
"data = data[np.logical_and(data.number != 98, data.number != 99)]\n",
"data = data[np.logical_and(data.inc != 98, data.inc != 99)]\n",
"data = data[data.age != 99]\n",
"data.shape"
]
},
Expand All @@ -624,7 +626,7 @@
},
"outputs": [],
"source": [
"X = np.array(patsy.dmatrix('0 + C(race) + age + C(sex)', data))\n",
"X = np.array(patsy.dmatrix('0 + C(race) + age', data))\n",
"D = np.array(patsy.dmatrix('0 + number', data))\n",
"Q = np.array(patsy.dmatrix('0 + C(ed)', data))\n",
"S = np.array(patsy.dmatrix('0 + parity', data))\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@
},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(1, \"./hdmpy\")\n",
"import hdmpy\n",
"\n",
"\n",
Expand Down
3 changes: 3 additions & 0 deletions AC1/r-proxy-controls.irnb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@
"source": [
"# Filter data to exclude entries where income, number of cigarettes smoked,\n",
"# race, age are not asked or not known\n",
"data <- data[data$wt != 999, ]\n",
"data <- data[data$parity != 99, ]\n",
"data <- data[data$parity != 9, ]\n",
"data <- data[data$race != 99, ]\n",
"data <- data[!(data$number %in% c(98, 99)), ]\n",
"data <- data[!(data$inc %in% c(98, 99)), ]\n",
Expand Down
Loading
Loading