

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Melatih model menggunakan Neptune ML
<a name="machine-learning-on-graphs-model-training"></a>

Setelah Anda memproses data yang Anda ekspor dari Neptunus untuk pelatihan model, Anda dapat memulai pekerjaan pelatihan model menggunakan perintah seperti berikut:

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

```
aws neptunedata start-ml-model-training-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-training job ID)}}" \
  --data-processing-job-id "{{(the data-processing job-id of a completed job)}}" \
  --train-model-s3-location "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer"
```

Untuk informasi selengkapnya, lihat [start-ml-model-training-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-training-job.html) di Referensi AWS CLI Perintah.

------
#### [ 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_model_training_job(
    id='{{(a unique model-training job ID)}}',
    dataProcessingJobId='{{(the data-processing job-id of a completed job)}}',
    trainModelS3Location='s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer'
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer"
      }'
```

**catatan**  
Contoh ini mengasumsikan bahwa AWS kredenal Anda dikonfigurasi di lingkungan Anda. Ganti {{us-east-1}} dengan Wilayah cluster Neptunus Anda.

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

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer"
      }'
```

------

Rincian tentang cara menggunakan perintah ini dijelaskan dalam [Perintah modeltraining](machine-learning-api-modeltraining.md), bersama dengan informasi tentang cara untuk mendapatkan status tugas yang sedang berjalan, cara menghentikan tugas yang sedang berjalan, dan mendaftar semua tugas yang sedang berjalan.

Anda juga dapat menyediakan informasi penggunaan dari pekerjaan pelatihan model Neptunus ML yang telah selesai untuk mempercepat pencarian hyperparameter dalam pekerjaan pelatihan baru. `previousModelTrainingJobId` Ini berguna selama [pelatihan ulang model pada data grafik baru](machine-learning-overview-evolving-data-incremental.md#machine-learning-overview-model-retraining), serta [pelatihan tambahan pada data grafik yang sama](machine-learning-overview-evolving-data-incremental.md#machine-learning-overview-incremental). Gunakan perintah seperti ini:

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

```
aws neptunedata start-ml-model-training-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-training job ID)}}" \
  --data-processing-job-id "{{(the data-processing job-id of a completed job)}}" \
  --train-model-s3-location "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer" \
  --previous-model-training-job-id "{{(the model-training job-id of a completed job)}}"
```

Untuk informasi selengkapnya, lihat [start-ml-model-training-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-training-job.html) di Referensi AWS CLI Perintah.

------
#### [ 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_model_training_job(
    id='{{(a unique model-training job ID)}}',
    dataProcessingJobId='{{(the data-processing job-id of a completed job)}}',
    trainModelS3Location='s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer',
    previousModelTrainingJobId='{{(the model-training job-id of a completed job)}}'
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer",
        "previousModelTrainingJobId" : "{{(the model-training job-id of a completed job)}}"
      }'
```

**catatan**  
Contoh ini mengasumsikan bahwa AWS kredenal Anda dikonfigurasi di lingkungan Anda. Ganti {{us-east-1}} dengan Wilayah cluster Neptunus Anda.

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

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-graph-autotrainer",
        "previousModelTrainingJobId" : "{{(the model-training job-id of a completed job)}}"
      }'
```

------

Anda dapat melatih implementasi model Anda sendiri pada infrastruktur pelatihan Neptunus Neptunus dengan memasok objek, `customModelTrainingParameters` seperti ini:

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

```
aws neptunedata start-ml-model-training-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-training job ID)}}" \
  --data-processing-job-id "{{(the data-processing job-id of a completed job)}}" \
  --train-model-s3-location "s3://{{(your Amazon S3 bucket)}}/neptune-model-graph-autotrainer" \
  --model-name "custom" \
  --custom-model-training-parameters '{
    "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
    "trainingEntryPointScript": "{{(your training script entry-point name in the Python module)}}",
    "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
  }'
```

Untuk informasi selengkapnya, lihat [start-ml-model-training-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-training-job.html) di Referensi AWS CLI Perintah.

------
#### [ 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_model_training_job(
    id='{{(a unique model-training job ID)}}',
    dataProcessingJobId='{{(the data-processing job-id of a completed job)}}',
    trainModelS3Location='s3://{{(your Amazon S3 bucket)}}/neptune-model-graph-autotrainer',
    modelName='custom',
    customModelTrainingParameters={
        'sourceS3DirectoryPath': 's3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}',
        'trainingEntryPointScript': '{{(your training script entry-point name in the Python module)}}',
        'transformEntryPointScript': '{{(your transform script entry-point name in the Python module)}}'
    }
)

print(response)
```

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

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your Amazon S3 bucket)}}/neptune-model-graph-autotrainer",
        "modelName": "custom",
        "customModelTrainingParameters" : {
          "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
          "trainingEntryPointScript": "{{(your training script entry-point name in the Python module)}}",
          "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
        }
      }'
```

**catatan**  
Contoh ini mengasumsikan bahwa AWS kredenal Anda dikonfigurasi di lingkungan Anda. Ganti {{us-east-1}} dengan Wilayah cluster Neptunus Anda.

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

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltraining \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-training job ID)}}",
        "dataProcessingJobId" : "{{(the data-processing job-id of a completed job)}}",
        "trainModelS3Location" : "s3://{{(your Amazon S3 bucket)}}/neptune-model-graph-autotrainer",
        "modelName": "custom",
        "customModelTrainingParameters" : {
          "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
          "trainingEntryPointScript": "{{(your training script entry-point name in the Python module)}}",
          "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
        }
      }'
```

------



Lihat [Perintah modeltraining](machine-learning-api-modeltraining.md) untuk informasi selengkapnya, seperti tentang cara mendapatkan status pekerjaan yang sedang berjalan, cara menghentikan pekerjaan yang sedang berjalan, dan cara membuat daftar semua pekerjaan yang sedang berjalan. Lihat [Model khusus di Neptunus ML](machine-learning-custom-models.md) untuk informasi tentang cara menerapkan dan menggunakan model kustom.

**Topics**
+ [Model dan pelatihan model di Amazon Neptunus](machine-learning-models-and-training.md)
+ [Menyesuaikan konfigurasi hyperparameter model di Neptune ML](machine-learning-customizing-hyperparams.md)
+ [Praktik terbaik pelatihan model](machine-learning-improve-model-performance.md)