dl_propensity_score
Estimate propensity scores with a neural network to balance treatment and control groups for causal effect estimation, enabling adjustment for observed confounders.
Instructions
Neural-net propensity score estimator (arXiv:2404.04794, 2024). Assumptions: Unconfoundedness / selection on observables: treatment is conditionally independent of potential outcomes given covariates; Overlap (positivity): 0 < e(X) < 1 for all units (scores are clipped to [0.02, 0.98]); Covariates are pre-treatment and the MLP correctly approximates e(X) = P(T=1 | X). Pre-conditions: Cross-sectional or pooled DataFrame with a binary treatment column and numeric covariate columns; No missing values in the covariate matrix passed to the network; Enough observations per treatment arm to fit a small MLP without overfitting. Failure modes: Heavy clipping at 0.02/0.98 indicates near-deterministic treatment and positivity violation -> Trim or restrict to the region of common support before using the scores in a weighted estimator; torch absent and sklearn MLP fails to converge in max_iter with lbfgs -> Increase max_iter, scale covariates, or shrink hidden_sizes for a simpler network. Alternatives: sp.overlap_weighted_did, sp.drdid, sp.did. Typical minimum N: 200.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | No | Payload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip. | agent |
| as_handle | No | If true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running. | |
| data_path | Yes | Absolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://. | |
| result_id | No | Optional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns. | |
| treatment | Yes | Treatment indicator, treatment variable, or treatment array. | |
| covariates | Yes | Covariate matrix, DataFrame, or column names. | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| hidden_sizes | No | hidden_sizes parameter (list). | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||