

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# `endpoints` コマンドを使用して推論エンドポイントを管理する
<a name="machine-learning-api-endpoints"></a>

Neptune ML `endpoints` コマンドを使用して、推論エンドポイントの作成、そのステータスの確認、削除、または既存の推論エンドポイントのリストを表示します。

## Neptune ML `endpoints` コマンドを使用した推論エンドポイントの作成
<a name="machine-learning-api-endpoints-create-job"></a>

トレーニングジョブによって作成されたモデルから推論エンドポイントを作成するための Neptune ML `endpoints` コマンドは、次のようになります。

------
#### [ 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)}}"
      }'
```

------

トレーニングジョブによって作成されたモデルから既存の推論エンドポイントを更新するための Neptune ML `endpoints` コマンドは、次のようになります。

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

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --update \
  --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)}}',
    update=True,
    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)}}",
        "update" : "true",
        "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)}}",
        "update" : "true",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

------

モデル変換ジョブによって作成されたモデルから推論エンドポイントを作成するための Neptune ML `endpoints` コマンドは、次のようになります。

------
#### [ 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)}}"
      }'
```

------

モデル変換ジョブによって作成されたモデルから既存の推論エンドポイントを更新するための Neptune ML `endpoints` コマンドは、次のようになります。

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

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --update \
  --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)}}',
    update=True,
    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)}}",
        "update" : "true",
        "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)}}",
        "update" : "true",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

------

**`endpoints` 推論エンドポイントの作成のパラメータ**
+ **`id`** — (*オプション*) 新しい推論エンドポイントの一意の識別子。

  *タイプ*: 文字列。*デフォルト値*: 自動生成されたタイムスタンプ付きの名前。
+ **`mlModelTrainingJobId`** — 推論エンドポイントが指すモデルを作成した、完了したモデルトレーニングジョブのジョブ ID。

  *タイプ*: 文字列。

  *注意*: 次のいずれかを支給する必要があります。`mlModelTrainingJobId` または `mlModelTransformJobId`。
+ **`mlModelTransformJobId`** — 完了したモデル変換ジョブのジョブ ID。

  *タイプ*: 文字列。

  *注意*: 次のいずれかを支給する必要があります。`mlModelTrainingJobId` または `mlModelTransformJobId`。
+ **`update`** — (*オプション*) 存在する場合、このパラメータはこれが更新リクエストであることを示します。

  *タイプ*: ブール値。*デフォルト*: `false`

  *注意*: 次のいずれかを支給する必要があります。`mlModelTrainingJobId` または `mlModelTransformJobId`。
+ **`neptuneIamRoleArn`** — (*オプション*) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。

  *タイプ*: 文字列。*注意*: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーがスローされます。
+ **`modelName`** — (*オプション*) トレーニングのモデルタイプ。デフォルトでは、`modelType` に基づき ML モデルは自動的にデータ処理で使用されますが、ここで別のモデルタイプを指定できます。

  *タイプ*: 文字列。*デフォルト値*: `rgcn` の場合異種グラフと `kge` の場合ナレッジグラフ。*有効な値*: 異種グラフの場合: `rgcn`。ナレッジグラフの場合: `kge`、`transe`、`distmult` または `rotate`。
+ **`instanceType`** — (*オプション*) オンラインサービスに使用される ML インスタンスのタイプ。

  *タイプ*: 文字列。*デフォルト*: `ml.m5.xlarge`。

  *注意*: 推論エンドポイントの ML インスタンスの選択は、タスクタイプ、グラフサイズ、および予算によって異なります。「[推論エンドポイントのインスタンスを選択する](machine-learning-on-graphs-instance-selection.md#machine-learning-on-graphs-inference-endpoint-instance-size)」を参照してください。
+ **`instanceCount`** — (*オプション*) 予測のためにエンドポイントにデプロイする Amazon EC2 インスタンスの最小数。

  *タイプ*: 整数。*デフォルト*: `1`。
+ **`volumeEncryptionKMSKey`**   –   (*オプション*) エンドポイントを実行する ML コンピューティングインスタンス AWS Key Management Service (複数可AWS KMS) にアタッチされたストレージボリュームのデータを暗号化するために SageMaker AI が使用する () キー。

  *タイプ*: 文字列。*デフォルト*: *なし*。

## Neptune ML `endpoints` コマンドを使用した推論エンドポイントのステータスの取得
<a name="machine-learning-api-endpoints-get-endpoint-status"></a>

インスタンスエンドポイントのステータスのサンプル Neptune ML `endpoints` コマンドは、次のようになります。

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

```
aws neptunedata get-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}"
```

詳細については、 AWS CLI 「 コマンドリファレンス」の[get-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-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.get_ml_endpoint(
    id='{{(the inference endpoint ID)}}'
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

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

```
curl -s \
  "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}" \
  | python -m json.tool
```

------

**`endpoints` インスタンスエンドポイントステータスのパラメータ**
+ **`id`** — (*必須*) 推論エンドポイントの一意の識別子。

  *タイプ*: 文字列。
+ **`neptuneIamRoleArn`** — (*オプション*) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。

  *タイプ*: 文字列。*注意*: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーがスローされます。

## Neptune ML `endpoints` コマンドを使用したインスタンスエンドポイントの削除
<a name="machine-learning-api-endpoints-delete-endpoint"></a>

インスタンスエンドポイントを削除するサンプル Neptune ML `endpoints` コマンドは、次のようになります。

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

```
aws neptunedata delete-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}"
```

関連するアーティファクトもクリーンアップするには:

```
aws neptunedata delete-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}" \
  --clean
```

詳細については、 AWS CLI 「 コマンドリファレンス」の[delete-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/delete-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.delete_ml_endpoint(
    id='{{(the inference endpoint ID)}}',
    clean=True
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

関連するアーティファクトもクリーンアップするには:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}?clean=true" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

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

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}"
```

または、このようになります。

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}?clean=true"
```

------

**`endpoints` 推論エンドポイントの削除のパラメータ**
+ **`id`** — (*必須*) 推論エンドポイントの一意の識別子。

  *タイプ*: 文字列。
+ **`neptuneIamRoleArn`** — (*オプション*) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。

  *タイプ*: 文字列。*注意*: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーがスローされます。
+ **`clean`** — (*オプション*) このエンドポイントに関連するすべてのアーティファクトも削除する必要があることを示します。

  *タイプ*: ブール値。*デフォルト*: `FALSE`。

## Neptune ML `endpoints` コマンドを使用した推論エンドポイントの一覧表示
<a name="machine-learning-api-endpoints-list-endpoints"></a>

推論エンドポイントを一覧表示するための Neptune ML `endpoints` コマンドは次のようになります。

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

```
aws neptunedata list-ml-endpoints \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}}
```

結果の数を制限するには:

```
aws neptunedata list-ml-endpoints \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --max-items 3
```

詳細については、 AWS CLI 「 コマンドリファレンス」の[list-ml-endpoints](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/list-ml-endpoints.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.list_ml_endpoints(
    maxItems=3
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

結果の数を制限するには:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints?maxItems=3" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

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

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints" \
  | python -m json.tool
```

または、このようになります。

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints?maxItems=3" \
  | python -m json.tool
```

------

**`dataprocessing` 推論エンドポイントの一覧表示のパラメータ**
+ **`maxItems`** — (*オプション*) 返される項目の最大数。

  *タイプ*: 整数。*デフォルト*: `10`。*最大許容値*: `1024`。
+ **`neptuneIamRoleArn`** — (*オプション*) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。

  *タイプ*: 文字列。*注意*: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーがスローされます。