

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 模型特征归因偏移违规
<a name="clarify-model-monitor-model-attribution-drift-violations"></a>

特征归因偏移作业根据当前 `MonitoringExecution` 的分析结果评估[基准配置](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModelExplainabilityJobDefinition.html#sagemaker-CreateModelExplainabilityJobDefinition-request-ModelExplainabilityBaselineConfig)提供的基准约束。如果检测到违规行为，则该作业会将其列在执行输出位置的 *constraint\$1violations.json* 文件中，并将执行状态标记为 [解释结果](model-monitor-interpreting-results.md)。

以下是特征归因偏移违规文件的架构。
+ `label` - 标签名称、作业分析配置 `label_headers` 或占位符（如 `"label0"`）。
+ `metric_name` - 可解释性分析方法的名称。目前仅支持 `shap`。
+ `constraint_check_type` - 监控的违规类型。目前仅支持 `feature_attribution_drift_check`。
+ `description` - 解释违规行为的描述性消息。

```
{
    "version": "1.0",
    "violations": [{
        "label": "string",
        "metric_name": "string",
        "constraint_check_type": "string",
        "description": "string"
    }]
}
```

对于 `explanations` 部分中的每个标签，监控作业在基准约束文件和作业分析结果文件 (*analysis.json*) 中计算其全局 SHAP 值的 [nDCG 得分](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.ndcg_score.html)。如果得分低于 0.9，则会记录违规行为。将求出组合的全局 SHAP 值，因此违规条目中没有 `“feature”` 字段。以下输出提供了一个示例，介绍了几个记录的违规行为。

```
{
    "version": "1.0",
    "violations": [{
        "label": "label0",
        "metric_name": "shap",
        "constraint_check_type": "feature_attribution_drift_check",
        "description": "Feature attribution drift 0.7639720923277322 exceeds threshold 0.9"
    }, {
        "label": "label1",
        "metric_name": "shap",
        "constraint_check_type": "feature_attribution_drift_check",
        "description": "Feature attribution drift 0.7323763972092327 exceeds threshold 0.9"
    }]
}
```