

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

# 쿼리할 추론 엔드포인트 생성
<a name="machine-learning-on-graphs-inference-endpoint"></a>

추론 엔드포인트를 사용하면 모델 훈련 프로세스에서 구성한 특정 모델 하나를 쿼리할 수 있습니다. 엔드포인트는 훈련 프로세스에서 생성할 수 있었던 특정 유형의 모델 중 성능이 가장 우수한 모델에 연결됩니다. 그러면 엔드포인트는 Neptune의 Gremlin 쿼리를 수락하고 쿼리의 입력에 대해 해당 모델의 예측을 반환할 수 있습니다. 추론 엔드포인트를 생성한 후에는 삭제할 때까지 활성 상태를 유지합니다.

## Neptune ML의 추론 엔드포인트 관리
<a name="machine-learning-on-graphs-endpoint-managing"></a>

Neptune에서 내보낸 데이터에 대한 모델 훈련을 완료한 후 다음과 같은 명령을 사용하여 추론 엔드포인트를 생성할 수 있습니다.

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

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --ml-model-training-job-id "{{(the model-training job-id of a completed job)}}"
```

자세한 내용은 AWS CLI 명령 참조의 [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.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.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    mlModelTrainingJobId='{{(the model-training job-id of a completed job)}}'
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

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

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

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

------

모델 변환 작업을 완료하여 만든 모델에서 추론 엔드포인트를 생성하는 방법도 거의 동일합니다.

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

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --ml-model-transform-job-id "{{(the model-transform job-id of a completed job)}}"
```

자세한 내용은 AWS CLI 명령 참조의 [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.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.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    mlModelTransformJobId='{{(the model-transform job-id of a completed job)}}'
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

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

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

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

------

이러한 명령을 사용하는 방법에 대한 자세한 내용은 엔드포인트 상태를 가져오는 방법, 엔드포인트를 삭제하는 방법, 모든 추론 엔드포인트를 나열하는 방법과 함께 [endpoints 명령](machine-learning-api-endpoints.md)에 설명되어 있습니다.