Experiment: ITE/ATE recovery vs training-set size (overfitting check)#24
Merged
Conversation
experiments/ite_train_size.py: fit the all-CI S-learner TRAM-DAG from the ITE notebook on n = 500..20000 observational rows, evaluate every model on the same fixed 5k test set, and report ATE recovery, ITE correlation/MAE, and the train-vs-test NLL gap (overfitting diagnostic). Median over 3 seeds; per-seed points overlaid. Robust to the small-n counterfactual blow-up (one n=500 seed's ITE extrapolates to ~1e7 while its NLL stays normal — clipped + annotated, not allowed to rescale the axes). Findings (median, fixed 5k test): ITE corr 0.44 -> 0.98, MAE 0.40 -> 0.05, and the NLL gap 1.07 -> 0.02 as n grows from 500 to 20000 — a clear systematic dependency with the overfitting gap closing by n~5000. results/ is gitignored; regenerate with `uv run python experiments/ite_train_size.py`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the ITE benchmark (#23): a small experiment quantifying how the
all-CI S-learner TRAM-DAG's effect recovery scales with training-set size, and
whether it overfits.
experiments/ite_train_size.pyfits the notebook's all-CI model onn = 500, 1000, 2000, 5000, 10000, 20000 observational rows and evaluates
every model on the same fixed 5000-row test set, reporting:
Median over 3 seeds (data draw + weight init); per-seed points overlaid.
Findings (median, fixed 5k test)
A clear systematic dependency: ITE correlation climbs 0.44 → 0.98 and the
overfitting gap closes from ~1.07 to ~0.02, essentially converged by n ≈ 5000.
The ATE is roughly unbiased even at small n (it's an average), but the
individual effects are not recoverable until there's enough data.
Small-n instability (reported honestly, not hidden)
At n=500, 1 of 3 seeds had its counterfactual extrapolation blow up — a few
test individuals' predicted ITE reached ~1e7 (the all-CI Bernstein inverse
extrapolating wildly on a poorly-constrained fit) even though that seed's NLL
was normal. The plots use the median over seeds and clip such points to the
axis edge with an annotation, so one blow-up doesn't rescale the figure. This is
itself part of the overfitting story.
results/is gitignored (like the other experiments); regenerate withuv run python experiments/ite_train_size.py. Two figures are written underresults/ite_train_size/plots/(ITE scatter grid + the summary curves), shown inthe chat.
🤖 Generated with Claude Code