本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
檢查報告中的資料偏差偏離
如果您無法在 SageMaker Studio 中檢查所產生報告中的監控結果,您可以列印出來,如下所示:
schedule_desc = model_bias_monitor.describe_schedule() execution_summary = schedule_desc.get("LastMonitoringExecutionSummary") if execution_summary and execution_summary["MonitoringExecutionStatus"] in ["Completed", "CompletedWithViolations"]: last_model_bias_monitor_execution = model_bias_monitor.list_executions()[-1] last_model_bias_monitor_execution_report_uri = last_model_bias_monitor_execution.output.destination print(f'Report URI: {last_model_bias_monitor_execution_report_uri}') last_model_bias_monitor_execution_report_files = sorted(S3Downloader.list(last_model_bias_monitor_execution_report_uri)) print("Found Report Files:") print("\n ".join(last_model_bias_monitor_execution_report_files)) else: last_model_bias_monitor_execution = None print("====STOP==== \n No completed executions to inspect further. Please wait till an execution completes or investigate previously reported failures.")
如果與基準相比存在違規,則會在此列出:
if last_model_bias_monitor_execution: model_bias_violations = last_model_bias_monitor_execution.constraint_violations() if model_bias_violations: print(model_bias_violations.body_dict)
如果您的模型部署到即時端點,您可以選擇端點索引標籤,然後按兩下端點,在 Studio 中 SageMaker查看分析結果和 CloudWatch 指標的視覺化。