doubleml-for-py
CLAUDE.md795 starsChanged 4 months agoBSD-3-ClauseView on GitHub
DoubleML is a Python package implementing Double/Debiased Machine Learning (DML) methods for causal inference: - Partially Linear Models (PLR, PLIV, PLPR, LPLR) - Interactive Regression Models (IRM, IIVM, APO, QTE, CVAR, SSM) - Difference-in-Differences estimators (DID, DIDCSBinary, DIDMulti) - Regression Discontinuity Design (RDD) Docs: https://docs.doubleml.org | Source: https://github.com/DoubleML/doubleml-for-py Branch status & TODOs: .claude/STATUS.md Core: numpy>=2.0.0, pandas>=2.0.0, scipy>=1.7.0, scikit-learn>=1.6.0, statsmodels>=0.14.0 ML/Tuning: optuna>=4.6.0, joblib>=1.2.0 Visualization: matplotlib>=3.9.0, seaborn>=0.13, plotly>=5.0.0 Dev: pytest>=8.3.0, black>=25.1.0, ruff>=0.11.1, mypy>=1.18.0, xgboost>=2.1.0, lightgbm>=4.6.0 Before completing any task: Detailed conventions are…
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 70
Before completing any task:
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DoubleML for Python
DoubleML is a Python package implementing Double/Debiased Machine Learning (DML) methods for causal inference:
- Partially Linear Models (PLR, PLIV, PLPR, LPLR)
- Interactive Regression Models (IRM, IIVM, APO, QTE, CVAR, SSM)
- Difference-in-Differences estimators (DID, DIDCSBinary, DIDMulti)
- Regression Discontinuity Design (RDD)
Docs: https://docs.doubleml.org | Source: https://github.com/DoubleML/doubleml-for-py
Branch status & TODOs: .claude/STATUS.md
Architecture
Class Hierarchy
DoubleMLBase (ABC)
└─> DoubleMLScalar (ABC) - single-parameter models
├─> LinearScoreMixin - closed-form solver (θ = -E[ψ_b]/E[ψ_a])
│ ├─> DoubleMLPLR
│ ├─> DoubleMLIRM
│ ├─> DoubleMLPLIV
│ ├─> DoubleMLIIVM
│ └─> DoubleML DID variants
└─> NonLinearScoreMixin - numerical solver (planned)
DoubleML - multi-parameter estimation (extends DoubleMLScalar)Design Patterns
- Template Method:
fit()orchestrates; subclasses implement_nuisance_est(),_get_score_elements() - Mixin Pattern:
LinearScoreMixinprovides closed-form coefficient estimation - Delegation:
DoubleMLBasedelegates inference toDoubleMLFramework
Core Files
| File | Purpose |
doubleml/double_ml_base.py | Abstract base with properties (coef, se, summary) and inference |
doubleml/double_ml_scalar.py | Single-parameter estimation orchestrator |
doubleml/double_ml.py | Multi-parameter estimation with sample splitting |
doubleml/double_ml_framework.py | Statistical inference (confint, bootstrap, sensitivity) |
doubleml/double_ml_linear_score.py | Linear score mixin |
Package Structure
doubleml/
├── data/ # Data containers (DoubleMLData, DoubleMLDIDData, etc.)
├── plm/ # Partially Linear Models (PLR, PLIV, PLPR, LPLR)
├── irm/ # Interactive Regression Models (IRM, IIVM, APO, QTE, etc.)
├── did/ # Difference-in-Differences estimators
├── rdd/ # Regression Discontinuity Design
├── utils/ # Helpers (_checks, _estimation, resampling, tuning)
└── tests/ # Main test directoryKey Dependencies
Core: numpy>=2.0.0, pandas>=2.0.0, scipy>=1.7.0, scikit-learn>=1.6.0, statsmodels>=0.14.0 ML/Tuning: optuna>=4.6.0, joblib>=1.2.0 Visualization: matplotlib>=3.9.0, seaborn>=0.13, plotly>=5.0.0 Dev: pytest>=8.3.0, black>=25.1.0, ruff>=0.11.1, mypy>=1.18.0, xgboost>=2.1.0, lightgbm>=4.6.0
Git Workflow
- Main branch:
main - Commits: Conventional Commits —
feat:,fix:,docs:,refactor:,test:,chore:
Verification
Before completing any task:
black . # Format
ruff check --fix . # Lint
mypy # Type check (allowlist: [tool.mypy] files in pyproject.toml)
pytest -m ci # TestsCoding Standards
Detailed conventions are in .claude/rules/:
- py-code-conventions.md — Formatting, type hints, docstrings, naming, DML-specific patterns
- error-handling.md — Exception types, validation patterns, warnings vs. errors
- performance-guidelines.md — Vectorization, pre-allocation, DML computation patterns
- testing-conventions.md — Markers, fixtures, assertion patterns
- dml-scalar-test-structure.md — Mandatory 5-file test structure for scalar models
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- code-simplifierSkill
- techdebtSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

