技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-preparation【数据与研究】Prepare causalml datasets, encodings, propensity scores, matching samples, and balance checks.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this operating sub-skill when the task is about preparing data for CausalML workflows before causal estimation, tree modeling, deep modeling, validation, or decision optimization.
scripts/match_csv.py helper.../causal-estimation/.../tree-models/.../deep-models/.../analysis-and-decision/.| User goal | Primary runtime artifact |
|---|---|
| Generate synthetic regression or uplift-classification data | references/workflows.md#synthetic-data-workflows |
| Convert mixed pandas columns into a numeric model matrix | references/workflows.md#feature-matrix-and-encoding-workflows |
| Estimate clipped binary propensity scores | references/workflows.md#propensity-score-workflows |
| Match treated and control units, including group-stratified matching | references/workflows.md#nearest-neighbor-matching-workflows |
| Check pre/post balance with standardized mean differences | references/workflows.md#balance-table-workflow |
| Prepare CSV data for matching from the shell | scripts/match_csv.py |
| Confirm accepted column shapes and labels | references/data-contracts.md |
| Diagnose common data-preparation failures | references/troubleshooting.md |
Before fitting or matching, confirm these items:
0/1 for propensity and matching APIs.NearestNeighborMatch(replace=False) receives exactly one score column; use replace=True for multi-column nearest-neighbor matching.synthetic_data() draw from NumPy global randomness, so set np.random.seed(...) before calling if reproducibility matters.Run the CSV helper with:
python sub-skills/data-preparation/scripts/match_csv.py \
--input input.csv \
--output matched.csv \
--treatment-column treatment \
--feature-columns age tenure spend_segment \
--matching-covariates age tenure \
--score-column propensity \
--caliper 0.2 \
--ratio 1 \
--random-state 42
The helper imports installed CausalML APIs, writes a matched CSV, and prints balance tables before and after matching when the requested balance covariates support them.