

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Elaborazione dei dati del grafo esportati da Neptune per l'addestramento
<a name="machine-learning-on-graphs-processing"></a>

La fase di elaborazione dei dati utilizza i dati del grafo di Neptune creati dal processo di esportazione e crea le informazioni utilizzate da [Deep Graph Library](https://www.dgl.ai/) (DGL) durante l'addestramento. Include l'esecuzione di varie mappature e trasformazioni dei dati:
+ Analisi di nodi e archi per creare i file di mappatura di grafo e ID richiesti da DGL.
+ Conversione delle proprietà dei nodi e degli archi nelle funzionalità di nodi e archi richieste da DGL.
+ Divisione dei dati in set di addestramento, convalida e test.

## Gestione della fase di elaborazione dei dati per Neptune ML
<a name="machine-learning-on-graphs-processing-managing"></a>

Dopo aver esportato i dati da Neptune che desideri utilizzare per l'addestramento dei modelli, puoi avviare un processo di elaborazione dati utilizzando un comando come il seguente:

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

Per ulteriori informazioni, vedere [start-ml-data-processing-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-data-processing-job.html) nel Command Reference. AWS CLI 

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

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster 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"
      }'
```

------

I dettagli su come utilizzare questo comando sono illustrati in [Comando dataprocessing](machine-learning-api-dataprocessing.md), insieme a informazioni su come recuperare lo stato di un processo in esecuzione, come arrestare un processo in esecuzione e come elencare tutti i processi in esecuzione.

## Elaborazione dei dati del grafo aggiornati per Neptune ML
<a name="machine-learning-on-graphs-processing-updated"></a>

È inoltre possibile fornire un `previousDataProcessingJobId` all'API per garantire che il nuovo processo di elaborazione dei dati utilizzi lo stesso metodo di elaborazione di un processo precedente. Questo è necessario quando si desidera ottenere previsioni per i dati del grafo aggiornati in Neptune, riaddestrando il modello precedente sui nuovi dati o ricalcolando gli artefatti del modello sui nuovi dati.

Puoi farlo usando un comando come questo:

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

Per ulteriori informazioni, vedere [start-ml-data-processing-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-data-processing-job.html) nel AWS CLI Command Reference.

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

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster 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)"
      }'
```

------

Imposta il valore del parametro `previousDataProcessingJobId` sull'ID processo del processo di elaborazione dati precedente corrispondente al modello addestrato.

**Nota**  
Le eliminazioni dei nodi nel grafo aggiornato non sono attualmente supportate. Se i nodi sono stati rimossi in un grafo aggiornato, è necessario avviare un processo di elaborazione dei dati completamente nuovo anziché usare `previousDataProcessingJobId`.