Elimine uma tarefa de aperfeiçoamento de hiperparâmetros

Elimina uma tarefa de hiperaperfeiçoamento dos parâmetros através do método delete_hyperparameter_tuning_job.

Exemplo de código

Python

Antes de experimentar este exemplo, siga as Pythoninstruções de configuração no início rápido do Vertex AI com bibliotecas de cliente. Para mais informações, consulte a documentação de referência da API Python Vertex AI.

Para se autenticar no Vertex AI, configure as Credenciais padrão da aplicação. Para mais informações, consulte o artigo Configure a autenticação para um ambiente de desenvolvimento local.

from google.cloud import aiplatform


def delete_hyperparameter_tuning_job_sample(
    project: str,
    hyperparameter_tuning_job_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
    timeout: int = 300,
):
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.JobServiceClient(client_options=client_options)
    name = client.hyperparameter_tuning_job_path(
        project=project,
        location=location,
        hyperparameter_tuning_job=hyperparameter_tuning_job_id,
    )
    response = client.delete_hyperparameter_tuning_job(name=name)
    print("Long running operation:", response.operation.name)
    delete_hyperparameter_tuning_job_response = response.result(timeout=timeout)
    print(
        "delete_hyperparameter_tuning_job_response:",
        delete_hyperparameter_tuning_job_response,
    )

O que se segue?

Para pesquisar e filtrar exemplos de código para outros Google Cloud produtos, consulte o Google Cloud navegador de exemplos.