48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
"""视频级切分选择:signal 分层、视频聚合、贪心联合约束选择(纯函数)。
|
||
|
||
结果驱动切分管线的核心:把诊断信号投影为多样性格子,供贪心选择器最大化覆盖。
|
||
本模块起步定义 evolution_target 派生与多样性格子;后续追加 score_signal /
|
||
build_video_records / select_split。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
_EVOLUTION_TARGET = {
|
||
"extraction_failure": "tool",
|
||
"search_failure": "skill",
|
||
"reasoning_failure": "skill",
|
||
"mixed": "system",
|
||
}
|
||
|
||
|
||
def evolution_target_of(error_type: str) -> str:
|
||
"""由 error_type 确定性派生进化目标(tool/skill/system)。
|
||
|
||
这是报告用的派生标注,非独立多样性轴(多样性主格子=task_type×error_type)。
|
||
|
||
参数:
|
||
error_type: 诊断瀑布归因的错误类别(extraction/search/reasoning/mixed_failure)。
|
||
|
||
返回:
|
||
进化目标字符串 tool / skill / system。
|
||
|
||
异常:
|
||
ValueError: error_type 不在已知集合内(不静默兜底)。
|
||
"""
|
||
if error_type not in _EVOLUTION_TARGET:
|
||
raise ValueError(f"未知 error_type: {error_type}")
|
||
return _EVOLUTION_TARGET[error_type]
|
||
|
||
|
||
def cell_of(task_type: str, error_type: str) -> tuple[str, str]:
|
||
"""构造多样性主格子 = (task_type, error_type)。
|
||
|
||
参数:
|
||
task_type: 题型(12 类之一)。
|
||
error_type: 错误类别(4 类之一)。
|
||
|
||
返回:
|
||
(task_type, error_type) 二元组,作为覆盖计数的格子键。
|
||
"""
|
||
return (task_type, error_type)
|