

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Neptune ML 模型訓練 API
<a name="data-api-dp-ml-training"></a>

**模型訓練動作：**
+ [StartMLModelTrainingJob (動作)](#StartMLModelTrainingJob)
+ [ListMLModelTrainingJobs (動作)](#ListMLModelTrainingJobs)
+ [GetMLModelTrainingJob (動作)](#GetMLModelTrainingJob)
+ [CancelMLModelTrainingJob (動作)](#CancelMLModelTrainingJob)

**模型訓練結構：**
+ [CustomModelTrainingParameters (結構)](#CustomModelTrainingParameters)

## StartMLModelTrainingJob (動作)
<a name="StartMLModelTrainingJob"></a>

         此 API 的 AWS CLI 名稱為：`start-ml-model-training-job`。

建立新的 Neptune ML 模型訓練工作。請參閱[使用 `modeltraining` 命令進行模型訓練](https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html)。

在已啟用 IAM 身分驗證的 Neptune 叢集中調用此操作時，發出請求的 IAM 使用者或角色必須附加一個政策，在該叢集中允許 [neptune-db:StartMLModelTrainingJob](https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#startmlmodeltrainingjob) IAM 動作。

**請求**
+ **baseProcessingInstanceType** (在 CLI 中：`--base-processing-instance-type`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  用於準備和管理 ML 模型訓練的 ML 執行個體類型。這是根據記憶體需求選擇的 CPU 執行個體，用於處理訓練資料和模型。
+ **customModelTrainingParameters** (在 CLI 中：`--custom-model-training-parameters`) – [CustomModelTrainingParameters](#CustomModelTrainingParameters) 物件。

  自訂模型訓練的組態。這是 JSON 物件。
+ **dataProcessingJobId** (在 CLI 中：`--data-processing-job-id`) – *必要：*字串，類型為：`string` (UTF-8 編碼的字串)。

  已完成資料處理工作的工作 ID，該工作已建立訓練將使用的資料。
+ **enableManagedSpotTraining** (在 CLI 中:`--enable-managed-spot-training`) – 布林值，類型為：`boolean` (布林值 (true 或 false))。

  使用 Amazon Elastic Compute Cloud Spot 執行個體，將訓練機器學習模型的成本最佳化。預設值為 `False`。
+ **id** (在 CLI 中：`--id`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  新工作的唯一識別符。預設值為自動產生的 UUID。
+ **maxHPONumberOfTrainingJobs** (在 CLI 中：`--max-hpo-number-of-training-jobs`) – 整數，類型為：`integer` (帶正負號的 32 位元整數)。

  要對超參數調校工作啟動的訓練工作總數上限。預設為 2。Neptune ML 會自動調校機器學習模型的超參數。若要取得效能良好的模型，請至少使用 10 個工作 (換句話說，將 `maxHPONumberOfTrainingJobs` 設為 10)。一般來說，調校執行越多，結果越好。
+ **maxHPOParallelTrainingJobs** (在 CLI 中：`--max-hpo-parallel-training-jobs`) – 整數，類型為：`integer` (帶正負號的 32 位元整數)。

  要對超參數調校工作啟動的並行訓練工作數目上限。預設為 2。您可以執行的並行工作數目受制於訓練執行個體上可用的資源。
+ **neptuneIamRoleArn** (在 CLI 中：`--neptune-iam-role-arn`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  IAM 角色的 ARN，此角色可讓 Neptune 存取 SageMaker 和 Amazon S3 資源。這必須列示在您的資料庫叢集參數群組中，否則會發生錯誤。
+ **previousModelTrainingJobId** (在 CLI 中：`--previous-model-training-job-id`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  已完成模型訓練工作的工作 ID，您想要根據更新的資料以增量方式更新此工作。
+ **s3OutputEncryptionKMSKey** (在 CLI 中：`--s-3-output-encryption-kms-key`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  SageMaker 用來加密處理工作輸出的 Amazon Key Management Service (KMS) 金鑰。預設為 none。
+ **sagemakerIamRoleArn** (在 CLI 中：`--sagemaker-iam-role-arn`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  SageMaker 執行的 IAM 角色的 ARN。這必須列示在您的資料庫叢集參數群組中，否則會發生錯誤。
+ **securityGroupIds** (在 CLI 中：`--security-group-ids`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  VPC 安全群組 ID。預設值為 None (無)。
+ **subnets** (在 CLI 中：`--subnets`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  Neptune VPC 中子網路的 ID。預設值為 None (無)。
+ **trainingInstanceType** (在 CLI 中：`--training-instance-type`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  用於模型訓練的 ML 執行個體類型。所有 Neptune ML 模型都支援 CPU、GPU 和多 GPU 訓練。預設值為 `ml.p3.2xlarge`。選擇適合訓練的執行個體類型取決於工作類型、圖形大小和您的預算。
+ **trainingInstanceVolumeSizeInGB** (在 CLI 中：`--training-instance-volume-size-in-gb`) – 整數，類型為：`integer` (帶正負號的 32 位元整數)。

  訓練執行個體的磁碟區大小。輸入資料和輸出模型都會儲存在磁碟上，因此磁碟區大小必須大到足以保留這兩個資料集。預設值為 0。如果未指定或指定 0，Neptune ML 會根據資料處理步驟中產生的建議選取磁碟區大小。
+ **trainingTimeOutInSeconds** (在 CLI 中：`--training-time-out-in-seconds`) – 整數，類型為：`integer` (帶正負號的 32 位元整數)。

  訓練工作的逾時 (以秒為單位)。預設值為 86,400 (1 天)。
+ **trainModelS3Location** (在 CLI 中：`--train-model-s3-location`) – *必要：*字串，類型為：`string` (UTF-8 編碼的字串)。

  Amazon S3 中要儲存模型成品的位置。
+ **volumeEncryptionKMSKey** (在 CLI 中：`--volume-encryption-kms-key`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  SageMaker 用來加密儲存磁碟區上資料的 Amazon Key Management Service (KMS) 金鑰，而該儲存磁碟區附加到執行訓練工作的 ML 運算執行個體。預設值為 None (無)。

**回應**
+ **arn** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  新模型訓練工作的 ARN。
+ **creationTimeInMillis** - Long 整數，類型為：`long` (帶有正負號的 64 位元整數)。

  模型訓練工作建立時間，以毫秒為單位。
+ **id** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  新模型訓練工作的唯一 ID。

**錯誤**
+ [UnsupportedOperationException](data-api-dp-errors.md#UnsupportedOperationException)
+ [BadRequestException](data-api-dp-errors.md#BadRequestException)
+ [MLResourceNotFoundException](data-api-dp-errors.md#MLResourceNotFoundException)
+ [InvalidParameterException](data-api-dp-errors.md#InvalidParameterException)
+ [ClientTimeoutException](data-api-dp-errors.md#ClientTimeoutException)
+ [PreconditionsFailedException](data-api-dp-errors.md#PreconditionsFailedException)
+ [ConstraintViolationException](data-api-dp-errors.md#ConstraintViolationException)
+ [InvalidArgumentException](data-api-dp-errors.md#InvalidArgumentException)
+ [MissingParameterException](data-api-dp-errors.md#MissingParameterException)
+ [IllegalArgumentException](data-api-dp-errors.md#IllegalArgumentException)
+ [TooManyRequestsException](data-api-dp-errors.md#TooManyRequestsException)

## ListMLModelTrainingJobs (動作)
<a name="ListMLModelTrainingJobs"></a>

         此 API 的 AWS CLI 名稱為：`list-ml-model-training-jobs`。

列出 Neptune ML 模型訓練工作。請參閱[使用 `modeltraining` 命令進行模型訓練](https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html)。

在已啟用 IAM 身分驗證的 Neptune 叢集中調用此操作時，發出請求的 IAM 使用者或角色必須附加一個政策，在該叢集中允許 [neptune-db:neptune-db:ListMLModelTrainingJobs](https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#neptune-db:listmlmodeltrainingjobs) IAM 動作。

**請求**
+ **maxItems** (在 CLI 中：`--max-items`) – ListMLModelTrainingJobsInputMaxItemsInteger，類型為：`integer` (帶有正負號的 32 位元整數)，不小於 1 或大於 1024 ?st?s。

  要傳回的項目數目上限 (從 1 到 1024；預設值為 10)。
+ **neptuneIamRoleArn** (在 CLI 中：`--neptune-iam-role-arn`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  IAM 角色的 ARN，此角色可讓 Neptune 存取 SageMaker 和 Amazon S3 資源。這必須列示在您的資料庫叢集參數群組中，否則會發生錯誤。

**回應**
+ **ids** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  模型訓練工作 ID 的清單頁面。

**錯誤**
+ [UnsupportedOperationException](data-api-dp-errors.md#UnsupportedOperationException)
+ [BadRequestException](data-api-dp-errors.md#BadRequestException)
+ [MLResourceNotFoundException](data-api-dp-errors.md#MLResourceNotFoundException)
+ [InvalidParameterException](data-api-dp-errors.md#InvalidParameterException)
+ [ClientTimeoutException](data-api-dp-errors.md#ClientTimeoutException)
+ [PreconditionsFailedException](data-api-dp-errors.md#PreconditionsFailedException)
+ [ConstraintViolationException](data-api-dp-errors.md#ConstraintViolationException)
+ [InvalidArgumentException](data-api-dp-errors.md#InvalidArgumentException)
+ [MissingParameterException](data-api-dp-errors.md#MissingParameterException)
+ [IllegalArgumentException](data-api-dp-errors.md#IllegalArgumentException)
+ [TooManyRequestsException](data-api-dp-errors.md#TooManyRequestsException)

## GetMLModelTrainingJob (動作)
<a name="GetMLModelTrainingJob"></a>

         此 API 的 AWS CLI 名稱為：`get-ml-model-training-job`。

擷取 Neptune ML 模型訓練工作的相關資訊。請參閱[使用 `modeltraining` 命令進行模型訓練](https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html)。

在已啟用 IAM 身分驗證的 Neptune 叢集中調用此操作時，發出請求的 IAM 使用者或角色必須附加一個政策，在該叢集中允許 [neptune-db:GetMLModelTrainingJobStatus](https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#getmlmodeltrainingjobstatus) IAM 動作。

**請求**
+ **id** (在 CLI 中：`--id`) – *必要：*字串，類型為：`string` (UTF-8 編碼的字串)。

  要擷取的模型訓練工作的唯一識別符。
+ **neptuneIamRoleArn** (在 CLI 中：`--neptune-iam-role-arn`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  IAM 角色的 ARN，此角色可讓 Neptune 存取 SageMaker 和 Amazon S3 資源。這必須列示在您的資料庫叢集參數群組中，否則會發生錯誤。

**回應**
+ **hpoJob** – [MlResourceDefinition](data-api-dp-ml-data-processing.md#MlResourceDefinition) 物件。

  HPO 工作。
+ **id** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  此模型訓練工作的唯一識別符。
+ **mlModels** – 一個 [MlConfigDefinition](data-api-dp-ml-data-processing.md#MlConfigDefinition) 物件陣列。

  所使用之 ML 模型的組態清單。
+ **modelTransformJob** – [MlResourceDefinition](data-api-dp-ml-data-processing.md#MlResourceDefinition) 物件。

  模型轉換工作。
+ **processingJob** – [MlResourceDefinition](data-api-dp-ml-data-processing.md#MlResourceDefinition) 物件。

  資料處理工作。
+ **status** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  模型訓練工作的狀態。

**錯誤**
+ [UnsupportedOperationException](data-api-dp-errors.md#UnsupportedOperationException)
+ [BadRequestException](data-api-dp-errors.md#BadRequestException)
+ [MLResourceNotFoundException](data-api-dp-errors.md#MLResourceNotFoundException)
+ [InvalidParameterException](data-api-dp-errors.md#InvalidParameterException)
+ [ClientTimeoutException](data-api-dp-errors.md#ClientTimeoutException)
+ [PreconditionsFailedException](data-api-dp-errors.md#PreconditionsFailedException)
+ [ConstraintViolationException](data-api-dp-errors.md#ConstraintViolationException)
+ [InvalidArgumentException](data-api-dp-errors.md#InvalidArgumentException)
+ [MissingParameterException](data-api-dp-errors.md#MissingParameterException)
+ [IllegalArgumentException](data-api-dp-errors.md#IllegalArgumentException)
+ [TooManyRequestsException](data-api-dp-errors.md#TooManyRequestsException)

## CancelMLModelTrainingJob (動作)
<a name="CancelMLModelTrainingJob"></a>

         此 API 的 AWS CLI 名稱為：`cancel-ml-model-training-job`。

取消 Neptune ML 模型訓練工作。請參閱[使用 `modeltraining` 命令進行模型訓練](https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html)。

在已啟用 IAM 身分驗證的 Neptune 叢集中調用此操作時，發出請求的 IAM 使用者或角色必須附加一個政策，在該叢集中允許 [neptune-db:CancelMLModelTrainingJob](https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#cancelmlmodeltrainingjob) IAM 動作。

**請求**
+ **clean** (在 CLI 中:`--clean`) – 布林值，類型為：`boolean` (布林值 (true 或 false))。

  如果設定為 `TRUE`，則此旗標指定在工作停止時應刪除所有 Amazon S3 成品。預設值為 `FALSE`。
+ **id** (在 CLI 中：`--id`) – *必要：*字串，類型為：`string` (UTF-8 編碼的字串)。

  要取消的模型訓練工作的唯一識別符。
+ **neptuneIamRoleArn** (在 CLI 中：`--neptune-iam-role-arn`) – 字串，類型為：`string` (UTF-8 編碼的字串)。

  IAM 角色的 ARN，此角色可讓 Neptune 存取 SageMaker 和 Amazon S3 資源。這必須列示在您的資料庫叢集參數群組中，否則會發生錯誤。

**回應**
+ **status** – 字串，類型為：`string` (UTF-8 編碼的字串)。

  取消的狀態。

**錯誤**
+ [UnsupportedOperationException](data-api-dp-errors.md#UnsupportedOperationException)
+ [BadRequestException](data-api-dp-errors.md#BadRequestException)
+ [MLResourceNotFoundException](data-api-dp-errors.md#MLResourceNotFoundException)
+ [InvalidParameterException](data-api-dp-errors.md#InvalidParameterException)
+ [ClientTimeoutException](data-api-dp-errors.md#ClientTimeoutException)
+ [PreconditionsFailedException](data-api-dp-errors.md#PreconditionsFailedException)
+ [ConstraintViolationException](data-api-dp-errors.md#ConstraintViolationException)
+ [InvalidArgumentException](data-api-dp-errors.md#InvalidArgumentException)
+ [MissingParameterException](data-api-dp-errors.md#MissingParameterException)
+ [IllegalArgumentException](data-api-dp-errors.md#IllegalArgumentException)
+ [TooManyRequestsException](data-api-dp-errors.md#TooManyRequestsException)

## *模型訓練結構：*
<a name="data-api-dp-ml-training-model-training-structures-spacer"></a>

## CustomModelTrainingParameters (結構)
<a name="CustomModelTrainingParameters"></a>

包含自訂模型訓練參數。請參閱 [Neptune ML 中的自訂模型](https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-custom-models.html)。

**欄位**
+ **sourceS3DirectoryPath** - 這是*必要：*字串，類型為：`string` (UTF-8 編碼的字串)。

  此路徑通往實作您模型之 Python 模組所在的 Amazon S3 位置。這必須指向有效的現有 Amazon S3 位置，其中至少包含訓練指令碼、轉換指令碼和 `model-hpo-configuration.json` 檔案。
+ **trainingEntryPointScript** - 這是字串，類型為：`string` (UTF-8 編碼的字串)。

  指令碼模組中的進入點名稱，該指令碼會執行模型訓練，並接受超參數作為命令列引數 (包括固定的超參數)。預設值為 `training.py`。
+ **transformEntryPointScript** - 這是字串，類型為：`string` (UTF-8 編碼的字串)。

  指令碼模組中的進入點名稱，該指令碼應在識別了超參數搜尋中的最佳模型之後執行，以計算模型部署所需的模型成品。它應該能夠在沒有命令列參數的情況下執行。預設值為 `transform.py`。