AutoML Natural Language API – Anleitung

In dieser Anleitung wird veranschaulicht, wie Sie ein benutzerdefiniertes Modell zum Klassifizieren von Inhalten mit AutoML Natural Language erstellen. Die Anwendung trainiert ein benutzerdefiniertes Modell mit einer Reihe von "glücklichen Momenten" aus dem Open-Source-Dataset HappyDB von Kaggle. Das resultierende Modell klassifiziert glückliche Momente in Kategorien, die jeweils die Ursachen von Glück angeben.

Die Daten werden über eine Creative Commons CCO: Public Domain-Lizenz zur Verfügung gestellt.

In dieser Anleitung erfahren Sie, wie Sie ein benutzerdefiniertes Modell trainieren, dessen Leistung bewerten und neuen Inhalt klassifizieren.

Vorbereitung

Projektumgebung konfigurieren

  1. Melden Sie sich bei Ihrem Google Cloud-Konto an. Wenn Sie mit Google Cloud noch nicht vertraut sind, erstellen Sie ein Konto, um die Leistungsfähigkeit unserer Produkte in der Praxis sehen und bewerten zu können. Neukunden erhalten außerdem ein Guthaben von 300 $, um Arbeitslasten auszuführen, zu testen und bereitzustellen.
  2. Wählen Sie in der Google Cloud Console auf der Seite der Projektauswahl ein Google Cloud-Projekt aus oder erstellen Sie eines.

    Zur Projektauswahl

  3. Die Abrechnung für das Google Cloud-Projekt muss aktiviert sein.

  4. AutoML Natural Language APIs aktivieren.

    Aktivieren Sie die APIs

  5. Wählen Sie in der Google Cloud Console auf der Seite der Projektauswahl ein Google Cloud-Projekt aus oder erstellen Sie eines.

    Zur Projektauswahl

  6. Die Abrechnung für das Google Cloud-Projekt muss aktiviert sein.

  7. AutoML Natural Language APIs aktivieren.

    Aktivieren Sie die APIs

  8. Installieren Sie die Google Cloud CLI.
  9. Folgen Sie der Anleitung zum Erstellen eines Dienstkontos und Herunterladen einer Schlüsseldatei.
  10. Legen Sie die Umgebungsvariable GOOGLE_APPLICATION_CREDENTIALS so fest, dass sie auf die Schlüsseldatei des Dienstkontos verweist. Die Schlüsseldatei haben Sie beim Erstellen des Dienstkontos heruntergeladen. Beispiel:
         export GOOGLE_APPLICATION_CREDENTIALS=key-file
  11. Fügen Sie das neue Dienstkonto mit folgenden Befehlen zur IAM-Rolle AutoML Editor hinzu. Ersetzen Sie project-id durch den Namen Ihres Google Cloud-Projekts und service-account-name durch den Namen Ihres neuen Dienstkontos, z. B. service-account1@myproject.iam.gserviceaccount.com.
         gcloud auth login
         gcloud config set project project-id
         gcloud projects add-iam-policy-binding project-id 
    --member=serviceAccount:service-account-name
    --role='roles/automl.editor'
  12. Gewähren Sie dem AutoML Natural Language-Dienstkonto Zugriff auf Ihre Google Cloud-Projektressourcen.
    gcloud projects add-iam-policy-binding project-id 
    --member="serviceAccount:custom-vision@appspot.gserviceaccount.com"
    --role="roles/storage.admin"
  13. Clientbibliothek installieren
  14. Legen Sie die Umgebungsvariablen PROJECT_ID und REGION_NAME fest.

    Ersetzen Sie project-id durch die Projekt-ID Ihres Google Cloud Platform-Projekts. AutoML Natural Language erfordert derzeit den Standort us-central1.
         export PROJECT_ID="project-id"
         export REGION_NAME="us-central1"
         
  15. Erstellen Sie einen Google Cloud Storage-Bucket zum Speichern der Dokumente, die Sie zum Trainieren Ihres benutzerdefinierten Modells verwenden.

    Der Bucket-Name muss das Format $PROJECT_ID-lcm haben. Mit dem folgenden Befehl wird ein Speicher-Bucket in der Region us-central1 mit der Bezeichnung $PROJECT_ID-lcm erstellt.
    gsutil mb -p $PROJECT_ID -c regional -l $REGION_NAME gs://$PROJECT_ID-lcm/
  16. Kopieren Sie die Datei happiness.csv aus dem öffentlichen Bucket in Ihren Google Cloud Storage-Bucket.

    Die Datei happiness.csv befindet sich im Ordner NL-Klassifizierung im öffentlichen Bucket cloud-ml-data.

Speicherorte der Quellcodedateien

Den Quellcode finden Sie hier. Sie können die Quellcodedateien auch in Ihren Google Cloud Platform-Projektordner kopieren. Andernfalls empfehlen wir, den Code nach jedem Schritt direkt von dieser Seite zu kopieren.

Python

Die Anleitung besteht aus diesen Python-Programmen:

  • language_text_classification_create_dataset.py – Enthält Features zum Erstellen eines Datasets
  • import_dataset.py – Enthält Features zum Importieren eines Datasets
  • language_text_classification_create_model.py – Enthält Features zum Erstellen eines Modells
  • list_model_evaluations.py – Enthält Features zum Auflisten von Modellbewertungen
  • language_text_classification_predict.py – Enthält Features für die Vorhersage
  • delete_model.py – Enthält Features zum Löschen eines Modells

Java

Die Anleitung besteht aus diesen Java-Dateien:

  • LanguageTextClassificationCreateDataset.java – Enthält Features zum Erstellen eines Datasets
  • ImportDataset.java – Enthält Features zum Importieren eines Datasets
  • LanguageTextClassificationCreateModel.java – Enthält Features zum Erstellen eines Modells
  • ListModelEvaluations.java – Enthält Features zum Auflisten von Modellbewertungen
  • LanguageTextClassificationPredict.java – Enthält Features für die Vorhersage
  • DeleteModel.java – Enthält Features zum Löschen eines Modells

Node.js

Die Anleitung besteht aus diesen Node.js-Dateien:

  • language_text_classification_create_dataset.js – Enthält Features zum Erstellen eines Datasets
  • import_dataset.js – Enthält Features zum Importieren eines Datasets
  • language_text_classification_create_model.js – Enthält Features zum Erstellen eines Modells
  • list_model_evaluations.js – Enthält Features zum Auflisten von Modellbewertungen
  • language_text_classification_predict.js – Enthält Features für die Vorhersage
  • delete_model.js – Feature zum Löschen eines Modells einschließen

Anwendung ausführen

Schritt 1: Dataset erstellen

Der erste Schritt zum Erstellen eines benutzerdefinierten Modells besteht darin, ein leeres Dataset zu erstellen, das mit den Trainingsdaten für das Modell gefüllt wird. Wenn Sie ein Dataset erstellen, geben Sie den Klassifizierungstyp an, den das benutzerdefinierte Modell ausführen soll:

  • MULTICLASS weist jedem klassifizierten Dokument ein einzelnes Label zu
  • MULTILABEL kann einem Dokument mehrere Labels zuweisen

In dieser Anleitung wird ein Dataset mit dem Namen 'happydb' erstellt und MULTICLASS verwendet.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# display_name = "YOUR_DATASET_NAME"

client = automl.AutoMlClient()

# A resource that represents Google Cloud Platform location.
project_location = f"projects/{project_id}/locations/us-central1"
# Specify the classification type
# Types:
# MultiLabel: Multiple labels are allowed for one example.
# MultiClass: At most one label is allowed per example.
metadata = automl.TextClassificationDatasetMetadata(
    classification_type=automl.ClassificationType.MULTICLASS
)
dataset = automl.Dataset(
    display_name=display_name,
    text_classification_dataset_metadata=metadata,
)

# Create a dataset with the dataset metadata in the region.
response = client.create_dataset(parent=project_location, dataset=dataset)

created_dataset = response.result()

# Display the dataset information
print(f"Dataset name: {created_dataset.name}")
print("Dataset id: {}".format(created_dataset.name.split("/")[-1]))

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.ClassificationType;
import com.google.cloud.automl.v1.Dataset;
import com.google.cloud.automl.v1.LocationName;
import com.google.cloud.automl.v1.OperationMetadata;
import com.google.cloud.automl.v1.TextClassificationDatasetMetadata;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

class LanguageTextClassificationCreateDataset {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String displayName = "YOUR_DATASET_NAME";
    createDataset(projectId, displayName);
  }

  // Create a dataset
  static void createDataset(String projectId, String displayName)
      throws IOException, ExecutionException, InterruptedException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // A resource that represents Google Cloud Platform location.
      LocationName projectLocation = LocationName.of(projectId, "us-central1");

      // Specify the classification type
      // Types:
      // MultiLabel: Multiple labels are allowed for one example.
      // MultiClass: At most one label is allowed per example.
      ClassificationType classificationType = ClassificationType.MULTILABEL;

      // Specify the text classification type for the dataset.
      TextClassificationDatasetMetadata metadata =
          TextClassificationDatasetMetadata.newBuilder()
              .setClassificationType(classificationType)
              .build();
      Dataset dataset =
          Dataset.newBuilder()
              .setDisplayName(displayName)
              .setTextClassificationDatasetMetadata(metadata)
              .build();
      OperationFuture<Dataset, OperationMetadata> future =
          client.createDatasetAsync(projectLocation, dataset);

      Dataset createdDataset = future.get();

      // Display the dataset information.
      System.out.format("Dataset name: %s\n", createdDataset.getName());
      // To get the dataset id, you have to parse it out of the `name` field. As dataset Ids are
      // required for other methods.
      // Name Form: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`
      String[] names = createdDataset.getName().split("/");
      String datasetId = names[names.length - 1];
      System.out.format("Dataset id: %s\n", datasetId);
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function createDataset() {
  // Construct request
  const request = {
    parent: client.locationPath(projectId, location),
    dataset: {
      displayName: displayName,
      textClassificationDatasetMetadata: {
        classificationType: 'MULTICLASS',
      },
    },
  };

  // Create dataset
  const [operation] = await client.createDataset(request);

  // Wait for operation to complete.
  const [response] = await operation.promise();

  console.log(`Dataset name: ${response.name}`);
  console.log(`
    Dataset id: ${
      response.name
        .split('/')
        [response.name.split('/').length - 1].split('\n')[0]
    }`);
}

createDataset();

Anfrage

Führen Sie das Feature create_dataset aus, um ein leeres Dataset zu erstellen. Sie müssen die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Legen Sie als display_name für das Dataset happydb fest.

Python

python language_text_classification_create_dataset.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.LanguageTextClassificationCreateDataset"

Node.js

node language_text_classification_create_dataset.js

Antwort

Die Antwort enthält die Details des neu erstellten Datasets, darunter die Dataset-ID, mit der Sie bei zukünftigen Anfragen auf das Dataset verweisen. Es wird empfohlen, die Umgebungsvariable DATASET_ID auf den zurückgegebenen Wert der Dataset-ID festzulegen.

Dataset name: projects/216065747626/locations/us-central1/datasets/TCN7372141011130533778
Dataset id: TCN7372141011130533778
Dataset display name: happydb
Text classification dataset specification:
       classification_type: MULTICLASS
Dataset example count: 0
Dataset create time:
       seconds: 1530251987
       nanos: 216586000

Schritt 2: Trainingselemente in das Dataset importieren

Der nächste Schritt besteht darin, das Dataset mit Trainingselementen zu füllen, die mit den Zielkategorien versehen sind.

Die Funktionsschnittstelle import_dataset übernimmt als Eingabe eine CSV-Datei, in der die Speicherorte aller Trainingsdokumente und das richtige Label für jedes Trainingsdokument aufgeführt sind. (Weitere Informationen zum erforderlichen Format finden Sie unter Trainingsdaten vorbereiten.) Für diese Anleitung verwenden Sie happiness.csv, das Sie oben in Google Cloud Storage hochgeladen haben.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# dataset_id = "YOUR_DATASET_ID"
# path = "gs://YOUR_BUCKET_ID/path/to/data.csv"

client = automl.AutoMlClient()
# Get the full path of the dataset.
dataset_full_id = client.dataset_path(project_id, "us-central1", dataset_id)
# Get the multiple Google Cloud Storage URIs
input_uris = path.split(",")
gcs_source = automl.GcsSource(input_uris=input_uris)
input_config = automl.InputConfig(gcs_source=gcs_source)
# Import data from the input URI
response = client.import_data(name=dataset_full_id, input_config=input_config)

print("Processing import...")
print(f"Data imported. {response.result()}")

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.DatasetName;
import com.google.cloud.automl.v1.GcsSource;
import com.google.cloud.automl.v1.InputConfig;
import com.google.cloud.automl.v1.OperationMetadata;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

class ImportDataset {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String datasetId = "YOUR_DATASET_ID";
    String path = "gs://BUCKET_ID/path_to_training_data.csv";
    importDataset(projectId, datasetId, path);
  }

  // Import a dataset
  static void importDataset(String projectId, String datasetId, String path)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // Get the complete path of the dataset.
      DatasetName datasetFullId = DatasetName.of(projectId, "us-central1", datasetId);

      // Get multiple Google Cloud Storage URIs to import data from
      GcsSource gcsSource =
          GcsSource.newBuilder().addAllInputUris(Arrays.asList(path.split(","))).build();

      // Import data from the input URI
      InputConfig inputConfig = InputConfig.newBuilder().setGcsSource(gcsSource).build();
      System.out.println("Processing import...");

      // Start the import job
      OperationFuture<Empty, OperationMetadata> operation =
          client.importDataAsync(datasetFullId, inputConfig);

      System.out.format("Operation name: %s%n", operation.getName());

      // If you want to wait for the operation to finish, adjust the timeout appropriately. The
      // operation will still run if you choose not to wait for it to complete. You can check the
      // status of your operation using the operation's name.
      Empty response = operation.get(45, TimeUnit.MINUTES);
      System.out.format("Dataset imported. %s%n", response);
    } catch (TimeoutException e) {
      System.out.println("The operation's polling period was not long enough.");
      System.out.println("You can use the Operation's name to get the current status.");
      System.out.println("The import job is still running and will complete as expected.");
      throw e;
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const datasetId = 'YOUR_DISPLAY_ID';
// const path = 'gs://BUCKET_ID/path_to_training_data.csv';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function importDataset() {
  // Construct request
  const request = {
    name: client.datasetPath(projectId, location, datasetId),
    inputConfig: {
      gcsSource: {
        inputUris: path.split(','),
      },
    },
  };

  // Import dataset
  console.log('Proccessing import');
  const [operation] = await client.importData(request);

  // Wait for operation to complete.
  const [response] = await operation.promise();
  console.log(`Dataset imported: ${response}`);
}

importDataset();

Anfrage

Führen Sie das Feature import_data aus, um den Trainingsinhalt zu importieren. Der erste zu ändernde Code ist die Dataset-ID aus dem vorherigen Schritt, der zweite ist der URI von happiness.csv. Sie müssen die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Legen Sie dataset_id für das Dataset fest (aus der Ausgabe des vorherigen Schritts).
  • Legen Sie den Pfadparameter path fest. Das ist der URI von gs://YOUR_PROJECT_ID-lcm/csv/happiness.csv.

Python

python import_dataset.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.ImportDataset"

Node.js

node import_dataset.js

Antwort

Processing import...
Dataset imported.

Schritt 3: Modell erstellen (trainieren)

Sie haben nun ein Dataset aus Trainingsdokumenten mit Labels und können ein neues Modell trainieren.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# dataset_id = "YOUR_DATASET_ID"
# display_name = "YOUR_MODEL_NAME"

client = automl.AutoMlClient()

# A resource that represents Google Cloud Platform location.
project_location = f"projects/{project_id}/locations/us-central1"
# Leave model unset to use the default base model provided by Google
metadata = automl.TextClassificationModelMetadata()
model = automl.Model(
    display_name=display_name,
    dataset_id=dataset_id,
    text_classification_model_metadata=metadata,
)

# Create a model with the model metadata in the region.
response = client.create_model(parent=project_location, model=model)

print(f"Training operation name: {response.operation.name}")
print("Training started...")

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.LocationName;
import com.google.cloud.automl.v1.Model;
import com.google.cloud.automl.v1.OperationMetadata;
import com.google.cloud.automl.v1.TextClassificationModelMetadata;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

class LanguageTextClassificationCreateModel {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String datasetId = "YOUR_DATASET_ID";
    String displayName = "YOUR_DATASET_NAME";
    createModel(projectId, datasetId, displayName);
  }

  // Create a model
  static void createModel(String projectId, String datasetId, String displayName)
      throws IOException, ExecutionException, InterruptedException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // A resource that represents Google Cloud Platform location.
      LocationName projectLocation = LocationName.of(projectId, "us-central1");
      // Set model metadata.
      TextClassificationModelMetadata metadata =
          TextClassificationModelMetadata.newBuilder().build();
      Model model =
          Model.newBuilder()
              .setDisplayName(displayName)
              .setDatasetId(datasetId)
              .setTextClassificationModelMetadata(metadata)
              .build();

      // Create a model with the model metadata in the region.
      OperationFuture<Model, OperationMetadata> future =
          client.createModelAsync(projectLocation, model);
      // OperationFuture.get() will block until the model is created, which may take several hours.
      // You can use OperationFuture.getInitialFuture to get a future representing the initial
      // response to the request, which contains information while the operation is in progress.
      System.out.format("Training operation name: %s\n", future.getInitialFuture().get().getName());
      System.out.println("Training started...");
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const dataset_id = 'YOUR_DATASET_ID';
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function createModel() {
  // Construct request
  const request = {
    parent: client.locationPath(projectId, location),
    model: {
      displayName: displayName,
      datasetId: datasetId,
      textClassificationModelMetadata: {}, // Leave unset, to use the default base model
    },
  };

  // Don't wait for the LRO
  const [operation] = await client.createModel(request);
  console.log(`Training started... ${operation}`);
  console.log(`Training operation name: ${operation.name}`);
}

createModel();

Anfrage

Rufen Sie die Funktion create_model auf, um ein Modell zu erstellen. Die Dataset-ID stammt aus den vorherigen Schritten. Sie müssen die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Legen Sie die dataset_id für das Dataset fest (aus der Ausgabe des vorherigen Schritts).
  • Legen Sie den display_name für Ihr Modell fest (happydb_model).

Python

python language_text_classification_create_model.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.LanguageTextClassificationCreateModel"

Node.js

node language_text_classification_create_model.js

Antwort

Das Feature create_model startet einen Trainingsvorgang und gibt den Namen des Vorgangs aus. Das Training erfolgt asynchron und kann einige Zeit in Anspruch nehmen. Anhand der Vorgangs-ID können Sie den Trainingsstatus abrufen. Nach Abschluss des Trainings gibt create_model die Modell-ID zurück. Wie bei der Dataset-ID möchten Sie unter Umständen eine Umgebungsvariable MODEL_ID für den zurückgegebenen Wert der Modell-ID festlegen.

Training operation name: projects/216065747626/locations/us-central1/operations/TCN3007727620979824033
Training started...
Model name: projects/216065747626/locations/us-central1/models/TCN7683346839371803263
Model id: TCN7683346839371803263
Model display name: happydb_model
Model create time:
        seconds: 1529649600
        nanos: 966000000
Model deployment state: deployed

Schritt 4: Modell bewerten

Nach dem Training können Sie die Bereitschaft des Modells bewerten. Dazu prüfen Sie die Genauigkeit, die Trefferquote und den F1-Wert.

Das Feature display_evaluation verwendet die Modell-ID als Parameter.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"

client = automl.AutoMlClient()
# Get the full path of the model.
model_full_id = client.model_path(project_id, "us-central1", model_id)

print("List of model evaluations:")
for evaluation in client.list_model_evaluations(parent=model_full_id, filter=""):
    print(f"Model evaluation name: {evaluation.name}")
    print(f"Model annotation spec id: {evaluation.annotation_spec_id}")
    print(f"Create Time: {evaluation.create_time}")
    print(f"Evaluation example count: {evaluation.evaluated_example_count}")
    print(
        "Classification model evaluation metrics: {}".format(
            evaluation.classification_evaluation_metrics
        )
    )

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.ListModelEvaluationsRequest;
import com.google.cloud.automl.v1.ModelEvaluation;
import com.google.cloud.automl.v1.ModelName;
import java.io.IOException;

class ListModelEvaluations {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    listModelEvaluations(projectId, modelId);
  }

  // List model evaluations
  static void listModelEvaluations(String projectId, String modelId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // Get the full path of the model.
      ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
      ListModelEvaluationsRequest modelEvaluationsrequest =
          ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();

      // List all the model evaluations in the model by applying filter.
      System.out.println("List of model evaluations:");
      for (ModelEvaluation modelEvaluation :
          client.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {

        System.out.format("Model Evaluation Name: %s\n", modelEvaluation.getName());
        System.out.format("Model Annotation Spec Id: %s", modelEvaluation.getAnnotationSpecId());
        System.out.println("Create Time:");
        System.out.format("\tseconds: %s\n", modelEvaluation.getCreateTime().getSeconds());
        System.out.format("\tnanos: %s", modelEvaluation.getCreateTime().getNanos() / 1e9);
        System.out.format(
            "Evalution Example Count: %d\n", modelEvaluation.getEvaluatedExampleCount());
        System.out.format(
            "Classification Model Evaluation Metrics: %s\n",
            modelEvaluation.getClassificationEvaluationMetrics());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function listModelEvaluations() {
  // Construct request
  const request = {
    parent: client.modelPath(projectId, location, modelId),
    filter: '',
  };

  const [response] = await client.listModelEvaluations(request);

  console.log('List of model evaluations:');
  for (const evaluation of response) {
    console.log(`Model evaluation name: ${evaluation.name}`);
    console.log(`Model annotation spec id: ${evaluation.annotationSpecId}`);
    console.log(`Model display name: ${evaluation.displayName}`);
    console.log('Model create time');
    console.log(`\tseconds ${evaluation.createTime.seconds}`);
    console.log(`\tnanos ${evaluation.createTime.nanos / 1e9}`);
    console.log(
      `Evaluation example count: ${evaluation.evaluatedExampleCount}`
    );
    console.log(
      `Classification model evaluation metrics: ${evaluation.classificationEvaluationMetrics}`
    );
  }
}

listModelEvaluations();

Anfrage

Stellen Sie eine Anfrage, um die Gesamtbewertung des Modells aufzurufen. Führen Sie zu diesem Zweck die folgende Anfrage aus. Sie müssen die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Setzen Sie die model_id auf die ID Ihres Modells.

Python

python list_model_evaluations.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.ListModelEvaluations"

Node.js

node list_model_evaluations.js

Antwort

Wenn die Werte für Genauigkeit und Trefferquote zu niedrig sind, können Sie das Trainings-Dataset verbessern und Ihr Modell neu trainieren. Weitere Informationen finden Sie unter Modelle bewerten.

Precision and recall are based on a score threshold of 0.5
Model Precision: 96.3%
Model Recall: 95.7%
Model F1 score: 96.0%
Model Precision@1: 96.33%
Model Recall@1: 95.74%
Model F1 score@1: 96.04%

Schritt 5: Modell bereitstellen

Wenn das benutzerdefinierte Modell Ihren Qualitätsstandards entspricht, können Sie es bereitstellen und anschließend eine Vorhersageanfrage senden.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"

client = automl.AutoMlClient()
# Get the full path of the model.
model_full_id = client.model_path(project_id, "us-central1", model_id)
response = client.deploy_model(name=model_full_id)

print(f"Model deployment finished. {response.result()}")

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.DeployModelRequest;
import com.google.cloud.automl.v1.ModelName;
import com.google.cloud.automl.v1.OperationMetadata;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

class DeployModel {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    deployModel(projectId, modelId);
  }

  // Deploy a model for prediction
  static void deployModel(String projectId, String modelId)
      throws IOException, ExecutionException, InterruptedException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // Get the full path of the model.
      ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);
      DeployModelRequest request =
          DeployModelRequest.newBuilder().setName(modelFullId.toString()).build();
      OperationFuture<Empty, OperationMetadata> future = client.deployModelAsync(request);

      future.get();
      System.out.println("Model deployment finished");
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function deployModel() {
  // Construct request
  const request = {
    name: client.modelPath(projectId, location, modelId),
  };

  const [operation] = await client.deployModel(request);

  // Wait for operation to complete.
  const [response] = await operation.promise();
  console.log(`Model deployment finished. ${response}`);
}

deployModel();

Anfrage

Für die Funktion deploy_model müssen Sie die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Setzen Sie die model_id auf die ID Ihres Modells.

Python

python deploy_model.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.DeployModel.java"

Node.js

node deploy_model.js

Antwort

Model deployment finished.

Schritt 6: Das Modell für eine Vorhersage verwenden

Nachdem Sie Ihr Modell bereitgestellt haben, können Sie es zum Klassifizieren neuer Inhalte verwenden.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"
# content = "text to predict"

prediction_client = automl.PredictionServiceClient()

# Get the full path of the model.
model_full_id = automl.AutoMlClient.model_path(project_id, "us-central1", model_id)

# Supported mime_types: 'text/plain', 'text/html'
# https://cloud.google.com/automl/docs/reference/rpc/google.cloud.automl.v1#textsnippet
text_snippet = automl.TextSnippet(content=content, mime_type="text/plain")
payload = automl.ExamplePayload(text_snippet=text_snippet)

response = prediction_client.predict(name=model_full_id, payload=payload)

for annotation_payload in response.payload:
    print(f"Predicted class name: {annotation_payload.display_name}")
    print(f"Predicted class score: {annotation_payload.classification.score}")

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.cloud.automl.v1.AnnotationPayload;
import com.google.cloud.automl.v1.ExamplePayload;
import com.google.cloud.automl.v1.ModelName;
import com.google.cloud.automl.v1.PredictRequest;
import com.google.cloud.automl.v1.PredictResponse;
import com.google.cloud.automl.v1.PredictionServiceClient;
import com.google.cloud.automl.v1.TextSnippet;
import java.io.IOException;

class LanguageTextClassificationPredict {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String content = "text to predict";
    predict(projectId, modelId, content);
  }

  static void predict(String projectId, String modelId, String content) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (PredictionServiceClient client = PredictionServiceClient.create()) {
      // Get the full path of the model.
      ModelName name = ModelName.of(projectId, "us-central1", modelId);

      // For available mime types, see:
      // https://cloud.google.com/automl/docs/reference/rest/v1/projects.locations.models/predict#textsnippet
      TextSnippet textSnippet =
          TextSnippet.newBuilder()
              .setContent(content)
              .setMimeType("text/plain") // Types: text/plain, text/html
              .build();
      ExamplePayload payload = ExamplePayload.newBuilder().setTextSnippet(textSnippet).build();
      PredictRequest predictRequest =
          PredictRequest.newBuilder().setName(name.toString()).setPayload(payload).build();

      PredictResponse response = client.predict(predictRequest);

      for (AnnotationPayload annotationPayload : response.getPayloadList()) {
        System.out.format("Predicted class name: %s\n", annotationPayload.getDisplayName());
        System.out.format(
            "Predicted sentiment score: %.2f\n\n",
            annotationPayload.getClassification().getScore());
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const modelId = 'YOUR_MODEL_ID';
// const content = 'text to predict'

// Imports the Google Cloud AutoML library
const {PredictionServiceClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new PredictionServiceClient();

async function predict() {
  // Construct request
  const request = {
    name: client.modelPath(projectId, location, modelId),
    payload: {
      textSnippet: {
        content: content,
        mimeType: 'text/plain', // Types: 'text/plain', 'text/html'
      },
    },
  };

  const [response] = await client.predict(request);

  for (const annotationPayload of response.payload) {
    console.log(`Predicted class name: ${annotationPayload.displayName}`);
    console.log(
      `Predicted class score: ${annotationPayload.classification.score}`
    );
  }
}

predict();

Anfrage

Für die Funktion predict müssen Sie die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Setzen Sie die model_id auf die ID Ihres Modells.
  • Legen Sie die content fest, die Sie vorhersagen möchten.

Python

python language_text_classification_predict.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.LanguageTextClassificationPredict"

Node.js

node language_text_classification_predict.js

Antwort

Die Funktion gibt den Klassifizierungswert für die Übereinstimmung des Inhalts mit jeder Kategorie zurück.

Prediction results:
Predicted class name: affection
Predicted class score: 0.9702693223953247

Schritt 7: Modell löschen

Wenn Sie dieses Beispielmodell nicht mehr verwenden, können Sie es dauerhaft löschen. Anschließend können Sie das Modell nicht mehr für Vorhersagen verwenden.

Code kopieren

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Python API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"

client = automl.AutoMlClient()
# Get the full path of the model.
model_full_id = client.model_path(project_id, "us-central1", model_id)
response = client.delete_model(name=model_full_id)

print(f"Model deleted. {response.result()}")

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Java API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.cloud.automl.v1.AutoMlClient;
import com.google.cloud.automl.v1.ModelName;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

class DeleteModel {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    deleteModel(projectId, modelId);
  }

  // Delete a model
  static void deleteModel(String projectId, String modelId)
      throws IOException, ExecutionException, InterruptedException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (AutoMlClient client = AutoMlClient.create()) {
      // Get the full path of the model.
      ModelName modelFullId = ModelName.of(projectId, "us-central1", modelId);

      // Delete a model.
      Empty response = client.deleteModelAsync(modelFullId).get();

      System.out.println("Model deletion started...");
      System.out.println(String.format("Model deleted. %s", response));
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für AutoML Natural Language finden Sie unter AutoML Natural Language-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur AutoML Natural Language Node.js API.

Richten Sie zur Authentifizierung bei AutoML Natural Language Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();

async function deleteModel() {
  // Construct request
  const request = {
    name: client.modelPath(projectId, location, modelId),
  };

  const [response] = await client.deleteModel(request);
  console.log(`Model deleted: ${response}`);
}

deleteModel();

Anfrage

Stellen Sie eine Anfrage mit dem Vorgangstyp delete_model, um ein von Ihnen erstelltes Modell zu löschen. Dafür müssen Sie die folgenden Codezeilen ändern:

  • Setzen Sie die project_id auf Ihre PROJECT_ID.
  • Setzen Sie die model_id auf die ID Ihres Modells.

Python

python delete_model.py

Java

mvn compile exec:java -Dexec.mainClass="com.example.automl.DeleteModel"

Node.js

node delete_model.js

Antwort

Model deleted.