部分依赖图:分析配置和输出 - Amazon SageMaker
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

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

部分依赖图:分析配置和输出

部分依赖图 (PDP) 显示了预测的目标响应对对一组感兴趣的输入要素的依赖性。它们在所有其他输入要素的值上被边缘化,被称为补充功能. 直观地,您可以将部分依赖性解释为目标响应,这是每个感兴趣的输入要素的函数。

部分依赖性图分析配置

要创建部分依赖图 (PDP),亚马逊 SageMaker 澄清最初会查找在的 JSON 数组中指定的功能列analysis_config.json. 必须在此 JSON 文件中提供用于配置处理作业分析的其他参数。有关配置 PDP 和分析的其他方面的更多信息,请参阅配置分析.

以下代码包含 JSON 示例"pdp"中的对象"methods"一个对象analysis_config.json。配置文件。

{ "dataset_type":... "baseline": [[..]] . . "methods": { "shap" : { "baseline": ".." "num_samples": 100 }, "pdp": { "features": ["Age", "MaturityMonths"] // The features for which we need to plot PDP. "grid_resolution": 20, //Required for numerical columns only. //The number of buckets into which the range of values is divided. "top_k_features": 10, //Specifies how many of the top features must be used for PDP plots. The default is 10. }, . . } . . }
注意

如果"features"没有在"pdp"对象但"shap"提供了配置, SageMaker 澄清利用全球 SHAP 结果中的十大功能来绘制 PDP 可视化效果。

部分依赖性图分析输出

下面的代码显示了在分析 .json 结果文件中返回的部分依赖图 (PDP) 架构的示例。这些区域有:"pdp"此分析输出文件中的部分包含生成 PDP 图所需的信息。列表中的每个字典都包含由feature_name.

这些区域有:data_type指示数据是否numerical要么categorical. 这些区域有:feature_values字段包含要素中存在的值。如果data_type澄清推断categoricalfeature_values包含该功能可以假设的所有唯一值。如果data_type澄清推断numerical,它包含每个grid_resolutionClarify 生成的存储桶数量。

如果为特定要素计算部分依赖图,则feature_valuesmodel_predictions, 和data_distributions字段被替换为error包含错误消息的字段。

{ "version": "1.0", "explanations":{ "kernel_shap":{ . . . }, "pdp": [ { "feature_name": "Age", "data_type": "numerical" "feature_values": [ 20.4, 23.2, 26.0, 28.799999999999997, 31.599999999999998, 34.4, 70.8, 73.6 ], "model_predictions": [ [ 0.6830344458296895, 0.6812452118471265, 0.6908621763065458, 0.7008252082392573, 0.733054383918643, 0.7352442337572574, 0.7337257475033403, 0.7395857129991055, ], ], "data_distribution": [ 0.13, 0.25, 0.15, 0.35. 0.17 ] }, { "feature_name": "text_column", "data_type": "free_text" "error": "Detected data type is not supported for PDP. PDP can only be computed for numerical or categorical columns" } ] } }

此 PDP 架构为 “年龄” 功能生成以下部分依赖关系图。PDP 绘制feature_values沿 x 轴。y 轴包含中的值model_predictions 字段中返回的子位置类型。中的每个清单model_predictions字段对应于模型输出中的一个类。


                    年龄的部分依赖情节。

您可以在提供的分析输出路径中查看 report.pdf 文件中的绘图。