Uplift Model Sample Preparation 标志

Uplift Model Sample Preparation

组织
QFIN-tech
uplift-model-sample-preparation

在 uplift-model-task-spec 产出 confirmed task_config_path 后使用:检查样本语义、起草并确认切分方案、生成建模样本产物。不要用于任务定义、特征选择、建模、调参、模型比较或最终报告。

概览

发布者QFIN-tech
代码仓库model-evo
技能名称uplift-model-sample-preparation
星标数
52
复刻数
17
附带文件
4
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 4 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 QFIN-tech 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Uplift Model Sample Preparation AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/QFIN-tech/model-evo/tree/main/model-skills/uplift-model-sample-preparation
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/QFIN-tech/model-evo.git /tmp/model-evo
mkdir -p .claude/skills
cp -r /tmp/model-evo/model-skills/uplift-model-sample-preparation .claude/skills/uplift-model-sample-preparation
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Uplift Model Sample Preparation,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Uplift Model Sample Preparation。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Uplift Model Sample Preparation 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

样本准备

1. 输入依赖

本 skill 在 uplift-model-task-spec 已产出 confirmed task_config_path 后使用,用来准备 uplift 建模样本。

流程:

text
raw_sample_check
-> confirm data_semantics_plan
-> split_planning
-> confirm split_plan
-> post_split_validation
-> modeling_sample_spec.confirmed
-> uplift-model-sample-homogeneity-check

2. 执行入口

使用统一 runner:

bash
python <skill-dir>/scripts/run.py --input - --output-dir <output_dir>

Windows 环境可按需将路径分隔符改为反斜杠。

--output-dir 必须是已存在的 run_dir;runner 不创建 run_dir,不扫描 latest/current。本 skill 输出到:

text
{run_dir}/uplift-model-sample-preparation/{timestamp}_sample_preparation/
  inputs/0001_<action>.request.json
  results/0001_<action>.result.json
  artifacts/
  _flow_manifest.json
  _flow_log.jsonl
  report.md

所有 stdout、result、manifest 和 log 中的持久化 path 都是 run_dir 相对路径。raw_sample_check 创建 flow;后续 action 必须显式传入上一步 outputs.flow_dir,不得从 artifact path 反推 flow。

request JSON 必须通过 UTF-8 stdin 传入:

json
{"action": "raw_sample_check", "payload": {"task_config_path": "..."}}

stdout 和落盘 result JSON 都使用共同返回 shape:

text
status, summary, outputs, issues, next_steps

只从 outputs.result_path 读取当前 action 的 result JSON。存在报告时读取 outputs.report_path。复用同一个 flow 时读取 outputs.flow_dir 后作为下一次请求的 flow_dir 输入。不要读取或传播顶层 flow_dir、result_path、warnings。

旧输入字段如果以 _ref 或 _refs 结尾,runner 会返回 needs_input,并在 issues / next_steps 中给出对应 _path 或 _paths 替代字段。业务数据字段 data_ref 仍可出现在 task config 内。

如果缺少 Python 包,runner 返回 status=failed、code=PYTHON_IMPORT_ERROR issue,并在 issue/next_steps 中提示阅读本 skill 的缺依赖处理说明,不返回 skill 安装目录文件路径。

3. Actions 与参数说明

raw_sample_check

必填 payload:

json
{
  "task_config_path": "<confirmed task_config artifact>"
}

可选 payload:

json
{
  "data_source": {"kind": "local_csv", "path": "..."}
}

如果省略 data_source,runner 使用 task_config.external_inputs.data_source 或 task config 中的 data_ref。

输出:

text
outputs.data_semantics_plan_path

该 action 写入 artifacts/data_semantics_plan.draft.v1.json,并返回 needs_confirmation。

confirm_artifact

必填 payload:

json
{
  "source_draft_path": "<draft artifact path>",
  "artifact_kind": "data_semantics_plan",
  "confirmed_by": "user"
}

artifact_kind 可为 data_semantics_plan 或 split_plan。确认后写入:

text
artifacts/data_semantics_plan.confirmed.v1.json
artifacts/split_plan.confirmed.v1.json

输出会暴露 outputs.data_semantics_plan_path 或 outputs.split_plan_path。

split_planning

必填 payload:

json
{
  "task_config_path": "<confirmed task_config artifact>",
  "data_semantics_plan_path": "<confirmed data_semantics_plan artifact>"
}

可选 payload:

json
{
  "split_method": "random",
  "ratios": {"train": 0.8, "test": 0.2, "valid": 0.0},
  "random_seed": 42
}

时间切分需提供 split_method=time、time_column、oot_window.start、可选 oot_window.end_exclusive 和可选 non_oot_random_ratios。

输出:

text
outputs.split_plan_path

该 action 写入 artifacts/split_plan.draft.v1.json,并返回 needs_confirmation。

post_split_validation

必填 payload:

json
{
  "task_config_path": "<confirmed task_config artifact>",
  "data_semantics_plan_path": "<confirmed data_semantics_plan artifact>",
  "split_plan_path": "<confirmed split_plan artifact>"
}

该 action 会 dry-run 切分,校验启用切分中的 treatment/control 和 outcome 支撑;只有验证通过才写入产物。

输出:

text
outputs.modeling_sample_spec_path
outputs.modeling_sample_path
outputs.modeling_sample_paths
outputs.report_path

产物:

text
artifacts/modeling_sample_spec.confirmed.v1.json
artifacts/modeling_sample.v1.csv
artifacts/modeling_sample.train.v1.csv
artifacts/modeling_sample.test.v1.csv
artifacts/modeling_sample.valid.v1.csv
artifacts/modeling_sample.oot.v1.csv
report.md

只写入启用的 split 数据集。

4. 输出产物

典型输出目录:

text
{run_dir}/uplift-model-sample-preparation/{timestamp}_sample_preparation/
  inputs/0001_<action>.request.json
  results/0001_<action>.result.json
  artifacts/
    data_semantics_plan.draft.v1.json
    data_semantics_plan.confirmed.v1.json
    split_plan.draft.v1.json
    split_plan.confirmed.v1.json
    modeling_sample_spec.confirmed.v1.json
    modeling_sample.v1.csv
    modeling_sample.train.v1.csv
    modeling_sample.test.v1.csv
    modeling_sample.valid.v1.csv
    modeling_sample.oot.v1.csv
  _flow_manifest.json
  _flow_log.jsonl
  report.md

关键下游路径:

  • outputs.data_semantics_plan_path
  • outputs.split_plan_path
  • outputs.modeling_sample_spec_path
  • outputs.modeling_sample_path
  • outputs.modeling_sample_paths
  • outputs.report_path

5. 与其他 skill 的关联

方向Skill关系
上游uplift-model-task-spec提供 confirmed task_config_path
下游uplift-model-sample-homogeneity-check消费 confirmed modeling_sample_spec_path 做 treatment/control 同质性检查

6. 执行约束

本 skill 只负责样本语义检查、切分方案确认和建模样本产物生成,不做任务定义、特征选择、建模、调参、模型比较或最终报告。

所有表格读取必须经过 _common.data_loader,其实现位于 model-skills/_uplift-common/scripts/_common/data_loader.py。Gate 1 支持 local_csv;local_parquet 仅预留 kind,并返回明确 unsupported 结果,不做 fallback。

  • raw_sample_check 返回 needs_confirmation 时,必须请用户确认或修改样本语义计划,不能直接进入切分。
  • split_planning 返回 needs_confirmation 时,必须请用户确认或修改切分方案,不能直接生成建模样本。
  • 只有拿到 confirmed modeling_sample_spec_path 后,才建议进入 uplift-model-sample-homogeneity-check。

7. 异常处理

7.1 缺依赖处理

如果缺少 Python 包,runner 返回 status=failed、code=PYTHON_IMPORT_ERROR issue,并在 issue/next_steps 中提示阅读本 skill 的缺依赖处理说明,不返回 skill 安装目录文件路径。

7.2 字段兼容与流程异常

旧输入字段如果以 _ref 或 _refs 结尾,runner 会返回 needs_input,并在 issues / next_steps 中给出对应 _path 或 _paths 替代字段。业务数据字段 data_ref 仍可出现在 task config 内。

post_split_validation 如果返回失败或需要输入,必须说明阻塞原因,并请用户补充字段、修订语义计划或修订切分方案。

8. 面向用户回复

  • 默认使用中文回复,除非用户明确要求英文。
  • 先给业务结论:样本语义是否可确认、切分方案是否需要确认、建模样本 spec 是否已生成。
  • 有报告时可以链接 outputs.report_path;需要交接到下一步时内部使用 outputs.modeling_sample_spec_path,默认不要把该 JSON 路径展示给用户。
  • 不展示 raw stdout、raw result JSON 或内部长路径清单,除非用户明确要求调试。不要把路径放进独立代码块作为主要回复内容。
  • 除非用户明确要求查看 JSON、调试、获取产物路径或手动接力下游流程,否则不要在用户回复中展示工程中的 .json 文件路径。JSON 产物和 outputs.*_path 仍然是机器接口与下游 skill 的契约,可以在内部读取和传递。
  • 当 action 产出 draft artifact 且需要用户确认时,必须读取 draft artifact,用业务字段和值解释“要确认什么”,不要只展示 outputs.*_path。
  • 技术路径最多作为末尾“技术详情”一行展示;用户没有要求调试时,可以省略草稿路径。

raw_sample_check 需要确认时的回复结构

raw_sample_check 返回 needs_confirmation 后,回复必须面向业务用户,使用类似结构:

text
样本语义检查已通过,下一步需要你确认这套字段解释是否符合业务口径。

请确认以下 4 点:
- 人群分组:字段 `<treatment_column>` 中,`<treatment_value>` 表示处理组,`<control_value>` 表示对照组。
- 目标结果:字段 `<outcome_column>` 是 `<outcome_type>` 类型;如果是二分类,`<positive_value>` 表示正例,`<negative_value>` 表示负例。
- 样本支撑:共 `<row_count>` 行,处理组 `<treated_rows>` 行,对照组 `<control_rows>` 行;如果是二分类,同时给出处理组/对照组的正负例数量。
- 缺失和异常:关键字段缺失数、警告和假设。没有问题时写“未发现关键字段缺失或阻塞风险”。

如果以上口径正确,请回复:确认样本语义。
如果不正确,请直接指出要改的字段或取值。

不要使用下面这种只展示路径的回复:

text
数据源:<long path>
语义计划草稿:<long path>
如果确认无误,请回复:确认样本语义

split_planning 需要确认时的回复结构

split_planning 返回 needs_confirmation 后,必须解释切分方式,而不是只展示 split_plan_path:

text
切分方案已生成,下一步需要你确认是否按这个方案产出建模样本。

请确认以下 3 点:
- 切分方式:随机切分或时间切分;如果是时间切分,说明时间字段和 OOT 窗口。
- 样本比例/行数:train/test/valid/oot 的比例和预计行数。
- 风险提示:未启用分层、空切分、时间字段解析等警告;没有问题时写“未发现阻塞风险”。

如果以上切分方案正确,请回复:确认切分方案。
如果不正确,请说明希望调整的切分方式、比例或 OOT 时间窗口。

post_split_validation 成功时的回复结构

post_split_validation 成功后,默认只展示业务摘要,不展示 modeling_sample_spec_path、modeling_sample_path 或 modeling_sample_paths:

text
样本准备已完成,切分后验证通过。

样本切分结果:
- 总样本:<row_count>
- 训练集:<train_rows>
- 测试集:<test_rows>
- 验证集:<valid_rows 或 未启用>
- OOT:<oot_rows 或 未启用>

未发现阻塞风险。下一步可以进入样本同质性检查。

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Uplift Model Sample Preparation AI 技能有什么作用?

在 uplift-model-task-spec 产出 confirmed task_config_path 后使用:检查样本语义、起草并确认切分方案、生成建模样本产物。不要用于任务定义、特征选择、建模、调参、模型比较或最终报告。

为什么在 TypingMind 中使用 Uplift Model Sample Preparation?

因为您只需安装一次,就能搭配任何模型使用。Uplift Model Sample Preparation 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Uplift Model Sample Preparation?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/QFIN-tech/model-evo/tree/main/model-skills/uplift-model-sample-preparation。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Uplift Model Sample Preparation?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Uplift Model Sample Preparation 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Uplift Model Sample Preparation 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Uplift Model Sample Preparation AI 技能免费吗?

是的。QFIN-tech 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇