causal-insights
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCausal Insight Analysis for doubleml-pipeline
Outputs
doubleml-pipelinedoubleml-pipeline
输出的因果洞察分析
doubleml-pipelineThe pipeline has already estimated debiased causal effects with Double Machine
Learning (DML). Read the completed files directly using the exact
metric definitions in
references/metric_formulas.md — never refit raw
regressions on the input panel.
output_dirAdapt to the run's schema ( first): Treatments, channels,
interventions, outcome KPIs, entity dimensions (, ), and
covariates vary across users and domains (including non-monetary treatments with
no spend column). Derive every lever name, unit type, segment label, and driver
strictly from and the columns present in
— never assume specific channels, treatments, or
domain constructs that are not in the data. When a question cannot be answered
from the run's outputs, say so explicitly and name the exact pipeline setting
(, , , /
, , or ) needed to answer it.
metadata.jsongeo_colitem_colmetadata.jsonconsolidated_1a_full_df.csvtreatment_colsx_cols_listcovariates_for_cate_listgeo_colitem_coloptimize=Truerun_sensitivity=True该流水线已使用 Double Machine Learning (DML) 估计经过去偏的因果效应。直接读取已完成的 文件,并严格采用 references/metric_formulas.md 中的精确指标定义——绝不要在输入面板数据上重新拟合原始回归模型。
output_dir根据本次运行的 schema 调整(先读取 ): 处理项、渠道、干预措施、结果 KPI、实体维度(、)和协变量会因用户和领域而异(包括没有支出列的非货币型处理项)。所有杠杆名称、单位类型、分群标签和驱动因素都必须严格根据 以及 中存在的列推导——绝不能假设数据中不存在的特定渠道、处理项或领域构念。如果无法从本次运行的输出中回答某个问题,应明确说明,并指出回答该问题所需的确切 pipeline 设置(、、、 / 、 或 )。
metadata.jsongeo_colitem_colmetadata.jsonconsolidated_1a_full_df.csvtreatment_colsx_cols_listcovariates_for_cate_listgeo_colitem_coloptimize=Truerun_sensitivity=TrueOutput Directory Reading Order
输出目录读取顺序
| Step | File in | What to extract |
|---|---|---|
| 1 | | |
| 2 | | Row-level panel + |
| 3 | | Pooled |
| 4 | | Phase 3 repetition stability ( |
| 5 | | OVB |
| 6 | | Phase 0 |
| 7 | | |
| 步骤 | | 要提取的内容 |
|---|---|---|
| 1 | | |
| 2 | | 行级面板数据,以及 |
| 3 | | 池化后的 |
| 4 | | Phase 3 重复稳定性( |
| 5 | | OVB |
| 6 | | Phase 0 |
| 7 | | |
Four Non-Negotiable Calculation Rules
四条不可违背的计算规则
Always apply the formulas in
references/metric_formulas.md to avoid silent
calculation errors:
- Order row-level 95% bounds before summing:
and
estimated_incremental_KPI_<d>_2.5%are_97.5%, so they swap order whenever(T - zero_point) * bound. Always computeT < zero_pointandnp.minimum(c25, c975).sum(). Computenp.maximum(c25, c975).sum()(and its ordered 95% interval) by dividing byeffect_per_unit, leaving it unset if a slice mixes positive and negative treatment values.T.sum() - Divide by monetary spend for ROI (): In
treatment_spend_cols,consolidated_3b_summary*.csvistotal_estimated_roi(effect per raw unit of treatmentincremental_kpi / total_input, NOT monetary ROI when<d>istreatment_types[d],percentage,price, or another non-spend unit). Always compute monetary ROI fromimpressionsby dividingconsolidated_1a_full_df.csv(and its ordered 95% bounds) byincremental_kpiwhen spend is mapped (otherwise reportdf[treatment_spend_cols[d]].sum()and its 95% interval). Compareeffect_per_unitagainst[roi_low, roi_high]:opt_threshold_roi->roi_high < threshold_roi;not_worth_investing->roi_low > threshold_roi; straddling ->worth_investing(omit verdict ifundeterminedisopt_threshold_roior no spend column exists). Anulltreatment is estimated as a gapprice(its column is namedbenchmark price - price;<price>_gapgives the benchmark, the benchmark column and the investment column), sometadata["price_benchmarks"][d]is "incremental KPI per currency unit of price cut", rows with a zero gap were sold at the benchmark price, and a negative gap (price above the benchmark) counts as zero investment.effect_per_unit - Grade CATE heterogeneity from the row with Bonferroni scaling: In
median(cate_coef_dict_pooling.csv), match all basis p-values for covariatemodel == "median"(c,<c>_pvalue,bs(<c>, ...)), computeC(<c>)..., and classifyp_adj = min(1.0, min(ps) * len(ps))as< 0.05,strong (p=...)as< 0.10, andweak (p=...)as>= 0.10(quotingnone (p=...)belowp<0.001). Pooled BLP p-values ignore first-stage estimation error, so treat them as an approximate grade rather than a formal hypothesis test.0.001 - Exclude synthetic ground truth and derived cluster columns: Never read,
profile, or report ,
TrueContrib_*,total_ground_truth_KPI,true_incremental_KPI_*,ground_truth_*,true_total_roi,SMAPE,R_squared,MAE, orRMSEunless the user explicitly asks to audit synthetic recovery. Excludemetadata["ground_truth_metrics"](cluster_dml.derived_columns) from driver analyses.cluster_date_block
Allowed manual arithmetic & multi-run rule: Break-even gross margin when represents gross revenue, and rescaling
to natural units (e.g., dividing by when
stored on to report per 1
percentage point). Never invent margins or benchmarks (ask the user instead),
and never extrapolate outside observed support. Across multiple
runs estimated separately, compare side by side only when matches,
and never sum across runs. Speak in plain domain terms
matching the user's column semantics and language without leaking internal
schema keys.
1 / roi_on_spendoutcome_coleffect_per_unit100treatment_types[d] == "percentage"[0, 1]output_diroutcome_colincremental_kpi始终应用 references/metric_formulas.md 中的公式,避免无声的计算错误:
- 对行级 95% 上下界排序后再求和:
和
estimated_incremental_KPI_<d>_2.5%为_97.5%,因此当(T - zero_point) * bound时上下界会互换。始终使用T < zero_point和np.minimum(c25, c975).sum()计算。通过除以np.maximum(c25, c975).sum()得到T.sum()及其排序后的 95% 区间;如果某个切片同时包含正值和负值处理量,则不设置该值。effect_per_unit - 计算 ROI 时除以货币支出(): 在
treatment_spend_cols中,consolidated_3b_summary*.csv为total_estimated_roi,表示处理incremental_kpi / total_input每个原始单位的效应;当<d>为treatment_types[d]、percentage、price或其他非impressions单位时,它并非货币 ROI。只要存在支出映射,始终应从spend中将consolidated_1a_full_df.csv(及其排序后的 95% 上下界)除以incremental_kpi来计算货币 ROI;否则应报告df[treatment_spend_cols[d]].sum()及其 95% 区间。将effect_per_unit与[roi_low, roi_high]比较:opt_threshold_roi->roi_high < threshold_roi;not_worth_investing->roi_low > threshold_roi;区间跨越阈值 ->worth_investing。如果undetermined为opt_threshold_roi或不存在支出列,则省略判定。null处理项以差距price进行估计(其列名为benchmark price - price;<price>_gap提供基准值、基准列和投资列),因此metadata["price_benchmarks"][d]表示“每削减一货币单位价格带来的增量 KPI”;差距为零的行表示按基准价格售出,负差距(价格高于基准)计为零投资。effect_per_unit - 使用经过 Bonferroni 缩放的 行对 CATE 异质性进行分级: 在
median(cate_coef_dict_pooling.csv)中,匹配协变量model == "median"的所有基函数 p 值(c、<c>_pvalue、bs(<c>, ...)),计算C(<c>)...,并将其分类为p_adj = min(1.0, min(ps) * len(ps))->< 0.05、strong (p=...)->< 0.10、weak (p=...)->>= 0.10(低于none (p=...)的值引述为0.001)。池化 BLP p 值会忽略第一阶段估计误差,因此应将其视为近似等级,而不是正式的假设检验。p<0.001 - 排除合成的 ground truth 和派生的 cluster 列:
除非用户明确要求审计合成数据恢复情况,否则绝不读取、分析或报告 、
TrueContrib_*、total_ground_truth_KPI、true_incremental_KPI_*、ground_truth_*、true_total_roi、SMAPE、R_squared、MAE或RMSE。从驱动因素分析中排除metadata["ground_truth_metrics"](cluster_dml.derived_columns)。cluster_date_block
允许的手工计算与多运行规则: 当 表示毛收入时,盈亏平衡毛利率为 ;将 换算为自然单位(例如,当 且以 存储时除以 ,以报告每 1 个百分点的影响)。绝不能臆造利润率或基准值(应改为询问用户),也绝不能外推到观测支持范围之外。对于分别估计的多个 运行,仅在 一致时进行并列比较,且绝不跨运行汇总 。使用符合用户列语义和语言习惯的领域术语进行表达,不要泄露内部 schema 键名。
outcome_col1 / roi_on_spendeffect_per_unittreatment_types[d] == "percentage"[0, 1]100output_diroutcome_colincremental_kpi7-Step Analysis Playbook
七步分析执行手册
Work through the steps needed to answer the user's question. For a comprehensive
review, execute all applicable steps and follow
references/report_template.md.
- Frame the run: Read and inspect date frequency (
metadata.json,daily,weekly), row count, active entity axes (monthly,geo_col), treatments (item_col,treatment_cols,treatment_types), confounders (treatment_spend_cols),x_cols_list,covariates_for_cate_list,opt_threshold_roi, and Phase 0 / Phase 4 flags.cluster_dml - Headline causal impact: Summarize total (or treatment volume) and treated row count (Fact:), then
spendwith 95% interval,incremental_kpi(or rescaledroi_on_spend),effect_per_unit, break-even margin (if revenue KPI), and payback verdict (Inference:).share_of_outcome - Where it works (&
geo_col): Groupitem_colby each configured entity axis (consolidated_1a_full_df.csv,geo_col). Sort byitem_colfor efficiency questions orroi_on_spendfor volume questions. Check whetherincremental_kpi/geo_colis initem_col.covariates_for_cate_list - When it works (calendar cadence): When is present, group by month-of-year (and day-of-week when median date step <= 2 days, plus year-month or quarter for trajectory).
date_col - What amplifies it (drivers & 2-D interactions): Bin continuous drivers
with within-entity quantiles (in references/metric_formulas.md, grouping by
within_quantile_binsorgeo_colwhen present) so each unit is judged against its own baseline, and cross-tabulate 2-D interactions (e.g., a CATE covariate x treatment intensity, or two covariates from the run).item_col - Can we trust it? (Diagnostics & raw segment profiles): Check repetition
stability, OVB sensitivity (vs.
robustness_valueoverall and least-robust segments), Phase 0 saturation diagnostics,max(benchmark_cf_d, benchmark_cf_y)(low_sampletreated rows), and< 30. Whenever two segments have non-overlapping 95% intervals (plausibility_flagsonci_separationorroi_on_spend) oreffect_per_unitfire, profile that segment's raw data (plausibility_flags,gap_in_row_sd,ratio_to_overall, and treatedtreated_share) before interpreting.p25/p50/p75 - How should allocation move? (Optimization): When exists, report historical vs. optimized spend, incremental KPI, and ROI (total, by
007_optimization//geo_col, and yearly fromitem_col), row counts shifted (optimization_yearly_summary.csv,increased,reduced), reconciliation withcut_to_zero, and optimizer assumptions/warnings. Never design custom allocations, scale to unmodeled budgets, or shift budget across treatments or runs. If absent, note that optimization requires a single-treatment run withoptimization_metrics.csv,optimize=True, and spend mapping.date_col
逐步执行回答用户问题所需的步骤。若要进行全面审查,应执行所有适用步骤,并遵循 references/report_template.md。
- 界定本次运行: 读取 ,检查日期频率(
metadata.json、daily、weekly)、行数、启用的实体轴(monthly、geo_col)、处理项(item_col、treatment_cols、treatment_types)、混杂因素(treatment_spend_cols)、x_cols_list、covariates_for_cate_list、opt_threshold_roi,以及 Phase 0 / Phase 4 标志。cluster_dml - 核心因果影响: 汇总总 (或处理量)和接受处理的行数(Fact:),然后给出
spend及 95% 区间、incremental_kpi(或重新缩放的roi_on_spend)、effect_per_unit、盈亏平衡毛利率(如果结果 KPI 为收入)和回本结论(Inference:)。share_of_outcome - 在哪里有效(与
geo_col): 按每个已配置的实体轴(item_col、geo_col)对item_col分组。对于效率问题,按consolidated_1a_full_df.csv排序;对于规模问题,按roi_on_spend排序。检查incremental_kpi/geo_col是否包含在item_col中。covariates_for_cate_list - 何时有效(日历节奏): 如果存在 ,按月份分组;当中位日期步长 <= 2 天时,再按星期几分组;并按年-月或季度分组以观察趋势。
date_col - 什么会放大效果(驱动因素与二维交互): 使用实体内分位数对连续驱动因素分箱(,见 references/metric_formulas.md;存在
within_quantile_bins或geo_col时按其分组),从而将每个单元与其自身基线比较;并交叉制表分析二维交互(例如,一个 CATE 协变量 × 处理强度,或运行中的两个协变量)。item_col - 能否信任结果?(诊断与原始分群画像): 检查重复稳定性、OVB 敏感性(整体及最不稳健分群中 与
robustness_value的关系)、Phase 0 saturation 诊断、max(benchmark_cf_d, benchmark_cf_y)(接受处理的行数low_sample)和< 30。每当两个分群的 95% 区间不重叠(plausibility_flags或roi_on_spend上的effect_per_unit)或触发ci_separation时,在解释前先对该分群的原始数据进行画像(plausibility_flags、gap_in_row_sd、ratio_to_overall以及接受处理样本的treated_share)。p25/p50/p75 - 应如何调整资源分配?(优化): 如果存在 ,报告历史支出与优化后支出、增量 KPI 和 ROI(总体、按
007_optimization//geo_col分组,以及来自item_col的逐年结果)、行数变化(optimization_yearly_summary.csv、increased、reduced)、与cut_to_zero的核对结果,以及优化器的假设和警告。绝不能设计自定义分配、扩展到未建模的预算,或在不同处理项或运行之间转移预算。如果不存在该目录,应说明优化需要具备optimization_metrics.csv、optimize=True和支出映射的单处理项运行。date_col
Causal & Domain Interpretation Rules
因果与领域解释规则
- Reading 95% intervals: Always lead with the point estimate and
(
effect_direction,positive,negative). Aggregate 95% bands sum row-level bounds conservatively and routinely span zero. Never call an estimate "statistically significant", "not significant", "inconclusive", or "indistinguishable from zero", and never use the words significant or p-value in prose (except quoting CATE grades verbatim likezeroas an approximate heterogeneity grade).strong (p=0.0022) - Average vs. Marginal ROI: is the average return on past spend.
roi_on_spendjustifies keeping historical spend;worth_investingjustifies cutting/stopping;not_worth_investingcalls for a controlled test. Scaling budget up requires marginal returns from an active saturation curve or KKTundetermined. Under saturation, per-unit effect naturally falls at higher spend along diminishing returns.optimization - Column Role (|
cate_covariate|confounder) & Constant-Effect Runs: Per-unit treatment effects vary only throughunused. Ifcovariates_for_cate_listis empty, per-unit effect is constant by construction andcovariates_for_cate_listdiffers across slices only with treatment volume. If a slice column isincremental_kpi(inconfounderonly, including entity dummies) orx_cols_list, splitting by it is descriptive — showing where effects landed via covariate mix and intensity, not modeled slice-specific response. Say so explicitly and recommend adding the column tounusedto test it. Warn against conditioning on post-treatment variables (columns moved by the treatment itself) as targeting pre-conditions.covariates_for_cate_list - Confounding, Carryover & Spillover: Inspect against the other columns in
x_cols_listto flag unadjusted concurrent treatments or levers, intertemporal pull-forward or lagged carryover effects (consolidated_1a_full_df.csvlagged columns), and cross-unit spillover or substitution across_l<k>/geo_col.item_col
- 解读 95% 区间: 始终先给出点估计和 (
effect_direction、positive、negative)。汇总 95% 区间时,对行级上下界采用保守求和;这些区间通常会跨越零。绝不将估计称为“statistically significant”“not significant”“inconclusive”或“indistinguishable from zero”,也绝不在正文中使用 significant 或 p-value 这两个词;但按原文引用 CATE 等级(如zero)作为近似异质性等级时除外。strong (p=0.0022) - 平均 ROI 与边际 ROI: 是过去支出的平均回报。
roi_on_spend支持保留历史支出;worth_investing支持削减或停止;not_worth_investing则需要开展受控测试。要扩大预算,必须有来自活跃 saturation 曲线或 KKTundetermined的边际收益。在 saturation 下,随着支出增加,单位效应会因边际收益递减而自然下降。optimization - 列角色(|
cate_covariate|confounder)与恒定效应运行: 单位处理效应只会通过unused产生变化。如果covariates_for_cate_list为空,则单位效应按构造保持恒定,covariates_for_cate_list在不同切片间的差异仅来自处理量。如果某个切片列是incremental_kpi(仅出现在confounder中,包括实体虚拟变量)或x_cols_list,按它拆分仅属于描述性分析——展示效果通过协变量组合与处理强度落在何处,而不是模型估计出的切片特异性响应。应明确说明这一点,并建议将该列加入unused以进行检验。同时警告,不要把处理本身改变的 post-treatment 变量作为定向投放的前置条件。covariates_for_cate_list - 混杂、Carryover 与 Spillover: 将 与
x_cols_list中的其他列进行对照,标记未调整的同时期处理项或杠杆、时间上的提前拉动(pull-forward)或滞后 carryover 效应(consolidated_1a_full_df.csv滞后列),以及跨_l<k>/geo_col的 spillover 或替代效应。item_col
Trust Checklist
信任检查清单
| Check | Required Action |
|---|---|
| Payback & multiplicity | Keep |
| Driver evidence | Claim a covariate shifts per-unit response only when CATE grade is |
| Plausibility & support | Flag |
| Model & Phase 0 | Caveat high repetition CV ( |
| Optimizer discipline | Frame |
| 检查项 | 必须采取的操作 |
|---|---|
| 回本与多重性 | 保留 |
| 驱动因素证据 | 只有当 CATE 等级为 |
| 合理性与支持度 | 将 |
| 模型与 Phase 0 | 对高重复 CV( |
| 优化器纪律 | 严格将 |
Mandatory Statement Tagging (Fact:
/ Inference:
/ Hypothesis:
)
Fact:Inference:Hypothesis:强制陈述标签(Fact:
/ Inference:
/ Hypothesis:
)
Fact:Inference:Hypothesis:Start every bullet point (and every standalone result sentence) with
exactly one bold tag — never rely on section headers, and split mixed
bullets:
- Fact: Raw input panel quantities (, observed KPI, row/treated counts, treatment intensity quantiles, bin cut points, covariate means).
spend - Inference: DML model outputs (, 95% intervals,
incremental_kpi, payback verdicts, CATE evidence grades, sensitivityroi_on_spend, model-implied optimization numbers).RV - Hypothesis: Proposed mechanism explaining why an inference occurred, always paired with a concrete verification step (config change or holdout experiment).
每个要点(以及每个独立的结果句)都必须以恰好一个粗体标签开头——绝不能依赖章节标题;包含多种内容的要点必须拆分。
- Fact: 原始输入面板中的数量(、观测到的 KPI、行数/接受处理数、处理强度分位数、分箱切点、协变量均值)。
spend - Inference: DML 模型输出(、95% 区间、
incremental_kpi、回本结论、CATE 证据等级、敏感性roi_on_spend、模型隐含的优化数值)。RV - Hypothesis: 为解释某个推断为何发生而提出的机制,并且始终配套一个具体的验证步骤(配置变更或留出实验)。
Bundled References
内置参考文件
- Exact aggregation, ROI, CATE grading, diagnostics, and optimization formulas: references/metric_formulas.md
- Full causal review structure and statement-tagging examples: references/report_template.md
- 精确的汇总、ROI、CATE 分级、诊断和优化公式:references/metric_formulas.md
- 完整的因果审查结构和陈述标签示例:references/report_template.md