View a markdown version of this page

Neptune からエクスポートされたグラフデータをトレーニング用に処理する - Amazon Neptune

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

Neptune からエクスポートされたグラフデータをトレーニング用に処理する

データ処理ステップでは、エクスポートプロセスによって Neptune グラフデータが取得され、トレーニング中にディープグラフライブラリ (DGL) が使用する情報が作成されます。これには、さまざまなデータマッピングと変換の実行が含まれます。

  • ノードとエッジを解析して、DGL で必要とされるグラフおよび ID マッピングファイルを構築する。

  • ノードとエッジプロパティを DGL で必要なノードおよびエッジ特徴に変換する。

  • データをトレーニング、検証、およびテストセットに分割します。

Neptune ML のデータ処理ステップを管理する

モデルトレーニングに使用する 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」を参照してください。

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" }'

このコマンドの使用方法の詳細については、データ処理コマンド を参照してください。また、実行中のジョブのステータスの取得方法、実行中のジョブの停止方法、実行中のすべてのジョブの一覧表示方法について説明した情報もご覧ください。

Neptune ML の更新されたグラフデータの処理

また、previousDataProcessingJobId をAPI に追加して、新しいデータ処理ジョブが前のジョブと同じ処理方法を使用するようにします。これは、新しいデータで古いモデルを再学習するか、新しいデータのモデルアーティファクトを再計算することによって、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」を参照してください。

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

トレーニング済みモデルに対応する前のデータ処理ジョブのジョブ ID に previousDataProcessingJobId パラメータの値を設定します。

注記

更新されたグラフでのノードの削除は、現在サポートされていません。更新されたグラフでノードが削除されている場合は、previousDataProcessingJobId を使用するのではなく、まったく新しいデータ処理ジョブを開始する必要があります。