

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

# Neptune에서 내보낸 그래프 데이터를 훈련용으로 처리
<a name="machine-learning-on-graphs-processing"></a>

데이터 처리 단계에서는 내보내기 프로세스에서 생성된 Neptune 그래프 데이터를 가져와 훈련 중에 [딥 그래프 라이브러리(DGL)](https://www.dgl.ai/)에서 사용하는 정보를 생성합니다. 여기에는 다양한 데이터 매핑 및 변환 수행이 포함됩니다.
+ 노드와 엣지를 구문 분석하여 DGL에 필요한 그래프 및 ID 매핑 파일을 구성합니다.
+ 노드 및 엣지 속성을 DGL에 필요한 노드 및 엣지 특성으로 변환합니다.
+ 데이터를 훈련 세트, 검증 세트, 테스트 세트로 분할합니다.

## Neptune ML의 데이터 처리 단계 관리
<a name="machine-learning-on-graphs-processing-managing"></a>

모델 훈련에 사용할 데이터를 Neptune에서 내보낸 후 다음과 같은 명령을 사용하여 데이터 처리 작업을 시작할 수 있습니다.

------
#### [ AWS CLI ]

```
aws neptunedata start-ml-data-processing-job \
  --endpoint-url https://your-neptune-endpoint:port \
  --input-data-s3-location "s3://(S3 bucket name)/(path to your input folder)" \
  --id "(a job ID for the new job)" \
  --processed-data-s3-location "s3://(S3 bucket name)/(path to your output folder)" \
  --config-file-name "training-job-configuration.json"
```

자세한 내용은 AWS CLI 명령 참조의 [start-ml-data-processing-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-data-processing-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://your-neptune-endpoint:port',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.start_ml_data_processing_job(
    inputDataS3Location='s3://(S3 bucket name)/(path to your input folder)',
    id='(a job ID for the new job)',
    processedDataS3Location='s3://(S3 bucket name)/(path to your output folder)',
    configFileName='training-job-configuration.json'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://your-neptune-endpoint:port/ml/dataprocessing \
  --region us-east-1 \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "inputDataS3Location" : "s3://(S3 bucket name)/(path to your input folder)",
        "id" : "(a job ID for the new job)",
        "processedDataS3Location" : "s3://(S3 bucket name)/(path to your output folder)",
        "configFileName" : "training-job-configuration.json"
      }'
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. *us-east-1*을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl \
  -X POST https://your-neptune-endpoint:port/ml/dataprocessing \
  -H 'Content-Type: application/json' \
  -d '{
        "inputDataS3Location" : "s3://(S3 bucket name)/(path to your input folder)",
        "id" : "(a job ID for the new job)",
        "processedDataS3Location" : "s3://(S3 bucket name)/(path to your output folder)",
        "configFileName" : "training-job-configuration.json"
      }'
```

------

이 명령을 사용하는 방법에 대한 자세한 내용은 실행 중인 작업의 상태를 가져오는 방법, 실행 중인 작업을 중지하는 방법, 실행 중인 모든 작업을 나열하는 방법과 함께 [dataprocessing 명령](machine-learning-api-dataprocessing.md)에 설명되어 있습니다.

## Neptune ML의 업데이트된 그래프 데이터 처리
<a name="machine-learning-on-graphs-processing-updated"></a>

새 데이터 처리 작업에서 이전 작업과 동일한 처리 메서드를 사용하도록 API에 `previousDataProcessingJobId`를 제공할 수도 있습니다. 이는 새 데이터에 대해 이전 모델을 재훈련하거나 새 데이터에서 모델 아티팩트를 다시 계산하여 Neptune에서 업데이트된 그래프 데이터에 대한 예측을 얻으려는 경우에 필요합니다.

다음과 같은 명령을 사용하여이 작업을 수행할 수 있습니다.

------
#### [ AWS CLI ]

```
aws neptunedata start-ml-data-processing-job \
  --endpoint-url https://your-neptune-endpoint:port \
  --input-data-s3-location "s3://(Amazon S3 bucket name)/(path to your input folder)" \
  --id "(a job ID for the new job)" \
  --processed-data-s3-location "s3://(Amazon S3 bucket name)/(path to your output folder)" \
  --previous-data-processing-job-id "(the job ID of the previous data-processing job)"
```

자세한 내용은 AWS CLI 명령 참조의 [start-ml-data-processing-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-data-processing-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://your-neptune-endpoint:port',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.start_ml_data_processing_job(
    inputDataS3Location='s3://(Amazon S3 bucket name)/(path to your input folder)',
    id='(a job ID for the new job)',
    processedDataS3Location='s3://(Amazon S3 bucket name)/(path to your output folder)',
    previousDataProcessingJobId='(the job ID of the previous data-processing job)'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://your-neptune-endpoint:port/ml/dataprocessing \
  --region us-east-1 \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "inputDataS3Location" : "s3://(Amazon S3 bucket name)/(path to your input folder)",
        "id" : "(a job ID for the new job)",
        "processedDataS3Location" : "s3://(Amazon S3 bucket name)/(path to your output folder)",
        "previousDataProcessingJobId" : "(the job ID of the previous data-processing job)"
      }'
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. *us-east-1*을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl \
  -X POST https://your-neptune-endpoint:port/ml/dataprocessing \
  -H 'Content-Type: application/json' \
  -d '{
        "inputDataS3Location" : "s3://(Amazon S3 bucket name)/(path to your input folder)",
        "id" : "(a job ID for the new job)",
        "processedDataS3Location" : "s3://(Amazon S3 bucket name)/(path to your output folder)",
        "previousDataProcessingJobId" : "(the job ID of the previous data-processing job)"
      }'
```

------

`previousDataProcessingJobId` 파라미터 값을 훈련된 모델에 해당하는 이전 데이터 처리 작업의 작업 ID로 설정합니다.

**참고**  
업데이트된 그래프의 노드 삭제는 현재 지원되지 않습니다. 업데이트된 그래프에서 노드가 제거된 경우 `previousDataProcessingJobId`를 사용하는 대신 완전히 새로운 데이터 처리 작업을 시작해야 합니다.