Create or delete an experiment

You can use either the Vertex AI SDK for Python or console to either create or delete an experiment.

Create experiment

Console

Use the following instructions to create an experiment.

  1. In the console, go to the Experiments page.
    Go to Experiments
  2. Be sure you're in the project you want to create the experiment in.
    Vertex AI select project
  3. Click Create to open the Experiment pane. The Create experiment pane appears.
  4. In the Experiment name field, provide a name to uniquely identify your experiment.
  5. Optional. In the TensorBoard instance field, select an instance from the drop-down or provide a name for your new TensorBoard instance.
  6. Click Create to create your experiment.

API

Create an experiment and associate a Vertex AI TensorBoard instance using the Vertex AI SDK for Python. Add a description for the experiment to document its purpose. See init in the Vertex AI SDK reference documentation.

Python

def create_experiment_sample(
    experiment_name: str,
    experiment_description: str,
    experiment_tensorboard: Optional[Union[str, aiplatform.Tensorboard]],
    project: str,
    location: str,
):
    aiplatform.init(
        experiment_name=experiment_name,
        experiment_description=experiment_description,
        experiment_tensorboard=experiment_tensorboard,
        project=project,
        location=location,
    )

  • experiment_name: Provide a name for your experiment.
  • experiment_description: Provide a description for your experiment.
  • experiment_tensorboard: Optional. The Vertex TensorBoard instance to use as a backing TensorBoard for the provided experiment.
  • project: Your project ID. You can find these IDs in the console welcome page.
  • location: See List of available locations Be sure to use a region that supports TensorBoard if creating a TensorBoard instance.

Delete experiment

Deleting an experiment deletes that experiment and all experiment runs under the experiment. However, any pipeline runs, artifacts, and executions associated with the deleted experiment are not removed.

Console

Use the following instructions to delete an experiment.

  1. In the console, go to the Experiments page.
    Go to Experiments
  2. Select the checkbox associated with the experiment you want to delete. The Delete option appears.
  3. Click Delete.
    • Alternatively, you can go to the  options menu that is in the same row as the experiment and select delete.

API

Python

def delete_experiment_sample(
    experiment_name: str,
    project: str,
    location: str,
    delete_backing_tensorboard_runs: bool = False,
):
    experiment = aiplatform.Experiment(
        experiment_name=experiment_name, project=project, location=location
    )

    experiment.delete(delete_backing_tensorboard_runs=delete_backing_tensorboard_runs)

  • experiment_name: Provide a name for your experiment.
  • project: Your project ID. You can find these IDs in the console welcome page.
  • location: See List of available locations
  • delete_backing_tensorboard_runs: If True will also delete the Vertex AI TensorBoard runs associated with the experiment runs under this experiment that we used to store time series metrics.

View list of experiments in console

  1. In the Google Cloud console, in the Vertex AI section, go to the Experiments page.

    Go to the Experiments page

  2. Check to be sure you are in the correct project.

  3. A list of experiments for your project appears in the Experiment tracking view.
    If you associated a Vertex AI TensorBoard instance with your experiment it shows up in the list as "your-experiment Backing Tensorboard Experiment".

Vertex AIList of experiments

What's next

Relevant notebook sample