

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 결과 해석
<a name="model-monitor-interpreting-results"></a>

기준 처리 작업을 실행하여 데이터세트에 대한 통계 및 제약 조건을 얻은 후에는 통계를 계산하고 기준 제약 조건과 관련해 발생한 위반을 나열하는 모니터링 작업을 실행할 수 있습니다. Amazon CloudWatch 지표는 기본적으로 사용자 계정에서도 보고됩니다. Amazon SageMaker Studio에서 모니터링 결과를 보는 방법에 대한 자세한 내용은 [Amazon SageMaker Studio에서 실시간 엔드포인트의 결과 시각화](model-monitor-interpreting-visualize-results.md)섹션을 참조하세요.

## 실행 나열
<a name="model-monitor-interpreting-results-list-executions"></a>

지정된 간격으로 일정이 모니터링 작업을 시작합니다. 다음 코드는 가장 최근의 5개 실행을 나열합니다. 시간별 일정을 생성한 후에 이 코드를 실행하는 경우, 실행이 비어 있을 수 있으며 시간 경계(UTC)를 넘을 때까지 기다려야 실행이 시작될 수 있습니다. 다음 코드에는 대기를 위한 로직이 포함되어 있습니다.

```
mon_executions = my_default_monitor.list_executions()
print("We created a hourly schedule above and it will kick off executions ON the hour (plus 0 - 20 min buffer.\nWe will have to wait till we hit the hour...")

while len(mon_executions) == 0:
    print("Waiting for the 1st execution to happen...")
    time.sleep(60)
    mon_executions = my_default_monitor.list_executions()
```

## 특정 실행 검사
<a name="model-monitor-interpreting-results-inspect-specific-execution"></a>

 

이전 단계에서, 사용자는 마지막으로 완료되었거나 실패한 예약 실행을 선택했습니다. 사용자는 성공한 실행과 실패한 실행을 탐색할 수 있습니다. 터미널 상태는 다음과 같습니다.
+ `Completed` – 모니터링 실행이 완료되었으며 위반 보고서에서 문제가 발견되지 않았습니다.
+ `CompletedWithViolations` – 실행이 완료되었지만 제약 조건 위반이 감지되었습니다.
+ `Failed` – 클라이언트 오류(예: 역할 문제) 또는 인프라 문제로 인해 모니터링 실행이 실패했습니다. 원인을 확인하려면 `FailureReason`및 `ExitMessage`섹션을 참조하세요.

```
latest_execution = mon_executions[-1] # latest execution's index is -1, previous is -2 and so on..
time.sleep(60)
latest_execution.wait(logs=False)

print("Latest execution status: {}".format(latest_execution.describe()['ProcessingJobStatus']))
print("Latest execution result: {}".format(latest_execution.describe()['ExitMessage']))

latest_job = latest_execution.describe()
if (latest_job['ProcessingJobStatus'] != 'Completed'):
        print("====STOP==== \n No completed executions to inspect further. Please wait till an execution completes or investigate previously reported failures.")
```

```
report_uri=latest_execution.output.destination
print('Report Uri: {}'.format(report_uri))
```

## 생성된 보고서 나열
<a name="model-monitor-interpreting-results-list-generated-reports"></a>

생성된 보고서를 다음 코드를 사용하여 나열합니다.

```
from urllib.parse import urlparse
s3uri = urlparse(report_uri)
report_bucket = s3uri.netloc
report_key = s3uri.path.lstrip('/')
print('Report bucket: {}'.format(report_bucket))
print('Report key: {}'.format(report_key))

s3_client = boto3.Session().client('s3')
result = s3_client.list_objects(Bucket=report_bucket, Prefix=report_key)
report_files = [report_file.get("Key") for report_file in result.get('Contents')]
print("Found Report Files:")
print("\n ".join(report_files))
```

## 위반 보고서
<a name="model-monitor-interpreting-results-violations-report"></a>

기준과 비교하여 위반이 있는 경우, 해당 내역이 위반 보고서에 생성됩니다. 다음 코드를 사용하여 위반 사항을 나열하세요.

```
violations = my_default_monitor.latest_monitoring_constraint_violations()
pd.set_option('display.max_colwidth', -1)
constraints_df = pd.io.json.json_normalize(violations.body_dict["violations"])
constraints_df.head(10)
```

이는 테이블 형식 데이터가 포함된 데이터세트에만 적용됩니다. 다음 스키마 파일은 계산된 통계 및 모니터링되는 위반을 지정합니다.

테이블 형식 데이터 세트의 출력 파일


| 파일 이름 | 설명 | 
| --- | --- | 
| statistics.json |  분석되는 데이터세트의 각 기능에 대한 열 기반 통계를 포함합니다. 다음 항목에서 이 파일의 스키마를 참조하세요.  이 파일은 데이터 품질 모니터링용으로만 생성됩니다.   | 
| constraint\$1violations.json |  `baseline_constaints` 및 `baseline_statistics`경로에 지정된 기준 통계 및 제약 조건 파일과 비교하여 현재 데이터세트에서 발견된 위반 목록을 포함합니다.  | 

[Amazon SageMaker Model Monitor 사전 구축 컨테이너](model-monitor-pre-built-container.md)는 기본적으로 각 특징에 대한 Amazon CloudWatch 지표의 집합을 저장합니다.

컨테이너 코드는 이 위치(`/opt/ml/output/metrics/cloudwatch`)에 CloudWatch 지표를 내보낼 수 있습니다.