Skip to main content
Version: v1.0.0

Manage Experiments

This page explains how to create, view, update, and delete experiments; add comments; and manage experiment tags in H2O MLOps using the Python client. It also describes experiment properties and how to compute Kubernetes options.

To learn more about experiments, see Experiments.

Prerequisites

Before you begin,

  1. Connect to H2O MLOps. For instructions, see Connect to H2O MLOps.
  2. Create a workspace. For steps, see Create a workspace.

Create an experiment

Use the create() method to create a new experiment in a workspace:

experiment = workspace.experiments.create(
data="/path/test.zip",
name="my-experiment"
description="Test experiment",
)
note

You can link or unlink an H2O Driverless AI (DAI) experiment, or an existing DAI or H2O MLOps experiment in storage, to a workspace.

Link an experiment by UID:

workspace.experiments.link(uid="your-experiment-uid")

Unlink an experiment:

workspace.experiments.unlink(uid="your-experiment-uid")

View experiments

Count experiments

Get the total number of experiments in a workspace:

Input:

workspace.experiments.count()

Output:

1

List experiments

List all experiments in a workspace:

Input:

experiments = workspace.experiments.list()
experiments

Output:

   | name          | uid                                  | tags
---+---------------+--------------------------------------+--------
0 | my-experiment | d9a47c99-c66c-4ff9-b2b6-30faf5f413ef |
note
  • The output of list() method is displayed in a neatly formatted view. By default, only the first 50 rows are displayed to keep the output concise and manageable.

  • Calling len(experiments) returns the total number of rows it contains, not just the number currently displayed.

  • To customize the number of rows displayed, you can call the show() method with the n argument. This allows more rows to be shown when needed. For example:

    experiments.show(n=100)

    This will display up to 100 experiments.

  • The experiments can be iterated over, as it is designed to behave like an iterator.

Filter experiments

Use the list() method with key-value arguments to filter the experiments.

Input:

workspace.experiments.list(name="my-experiment")

This returns a list of matching experiments as a table.

Output:

   | name                 | uid                                  | tags
---+----------------------+--------------------------------------+--------
0 | my-experiment | d9a47c99-c66c-4ff9-b2b6-30faf5f413ef |

Retrieve an experiment

Retrieve a specific experiment by UID:

Input:

experiment = workspace.experiments.get(uid="d9a47c99-c66c-4ff9-b2b6-30faf5f413ef")
experiment
note

You can also retrieve a specific experiment from the list returned by list() using indexing.
For example, experiment = workspace.experiments.list(key=value)[index]. The key and value arguments are optional.

Output:

<class 'h2o_mlops._experiments.MLOpsExperiment(
uid='d9a47c99-c66c-4ff9-b2b6-30faf5f413ef',
name='my-experiment',
description='Test experiment',
creator_uid='4c4eb198-bcbc-4442-91f6-a27deb53e9c1',
created_time=datetime.datetime(2025, 5, 22, 7, 2, 48, 185159, tzinfo=tzutc()),
last_modified_time=datetime.datetime(2025, 5, 22, 7, 2, 48, 185159, tzinfo=tzutc()),
)'>

Experiment properties

An experiment has the following main properties:

  • uid: The unique identifier of the experiment.
  • name: The name of the experiment.
  • description: A description of the experiment.
  • creator: The user who created the experiment.
  • created_time: The timestamp when the experiment was created.
  • last_modified_time: The timestamp of the last modification.
  • is_registered: If the experiment is registered or not.

Metadata

Each experiment includes metadata you can retrieve using the following method:

Input:

experiment.metadata

Output:

   | key                 | value
---+---------------------+---------------------------------------------
0 | h2o3/algo | glm
1 | h2o3/algo_full_name | Generalized Linear Modeling
2 | h2o3/category | Regression
3 | h2o3/columns | ['Origin', 'Dest', 'fDayofMonth', 'fYear...
4 | h2o3/created_time | 2020-08-24 07:21:50.137000+00:00
5 | input_schema | [{'name': 'Origin', 'type': 'STR'}, {'na...
6 | model_type | h2o3/mojo
7 | output_schema | [{'name': 'Distance', 'type': 'FLOAT64'}...
8 | tool | h2o3

To get a specific metadata entry by index:

Input:

experiment.metadata[3]

Output:

{'h2o3/columns': ['Origin',
'Dest',
'fDayofMonth',
'fYear',
'UniqueCarrier',
'fDayOfWeek',
'fMonth',
'IsDepDelayed']}

Parameters

To access parameters related to the dataset used in the experiment:

Input:

experiment.parameters["target_column"]

Output:

{'training_dataset_id': '',
'validation_dataset_id': '',
'test_dataset_id': '',
'target_column': 'Distance',
'weight_column': '',
'fold_column': ''}

In this example, the target column is Distance.

Statistics

To access training statistics:

Input:

experiment.statistics

Output:

{'training_duration': None}

Input schema

To view the schema of the input dataset:

Input:

experiment.input_schema

Output:

   | name          | type
---+---------------+--------
0 | Origin | STR
1 | Dest | STR
2 | fDayofMonth | STR
3 | fYear | STR
4 | UniqueCarrier | STR
5 | fDayOfWeek | STR
6 | fMonth | STR
7 | IsDepDelayed | STR

Output schema

To view the output schema of the experiment:

Input:

experiment.output_schema

Output:

   | name     | type
---+----------+---------
0 | Distance | FLOAT64

Scoring runtimes

You can list the available scoring runtimes that might be used when deploying the experiment:

Input:

scoring_runtimes = experiment.scoring_runtimes
scoring_runtimes

Output:

   | artifact_type   | runtime_uid                           | runtime_name
---+-----------------+---------------------------------------+----------------------------------------------
0 | h2o3_mojo | h2o3_mojo_runtime | H2O-3 MOJO Scorer
1 | h2o3_mojo | h2o3_mojo_runtime_shapley_transformed | H2O-3 MOJO Scorer (Shapley transformed only)

To view details of a specific scoring runtime:

Input:

scoring_runtimes[0]

Output:

<class 'h2o_mlops._runtimes.MLOpsScoringRuntime(
runtime='h2o3_mojo_runtime',
artifact_type='h2o3_mojo',
artifact_processor='h2o3_mojo_extractor',
model_type='h2o3_mojo',
)'>

Compute Kubernetes options

To compute Kubernetes options for an experiment runtime:

Input:

experiment.compute_k8s_options(
runtime_uid="h2o3_mojo_runtime", workers=1
)

Output:

KubernetesOptions(
replicas=1,
requests={'cpu': '500m', 'memory': '128Mi'},
limits={},
affinity=None,
toleration=None
)

Update an experiment

You can update only the name and description fields of an experiment.

Make sure to retrieve the experiment instance before updating it. See Retrieve an experiment.

Input:

experiment.update(name="new-experiment")
experiment

Output:

<class 'h2o_mlops._experiments.MLOpsExperiment(
uid='d9a47c99-c66c-4ff9-b2b6-30faf5f413ef',
name='new-experiment',
description='Test experiment',
creator_uid='4c4eb198-bcbc-4442-91f6-a27deb53e9c1',
created_time=datetime.datetime(2025, 5, 22, 7, 2, 48, 185159, tzinfo=tzutc()),
last_modified_time=datetime.datetime(2025, 5, 22, 7, 3, 26, 278369, tzinfo=tzutc()),
)'>

Add comments to an experiment

You can add one or more comments to an experiment to share information with collaborators.

experiment.comments.add("Comment 01")
experiment.comments.add("Comment 02")

To list all comments:

Input:

experiment.comments.list()

Output:

   | created_time           | author_username    | message
---+------------------------+--------------------+------------
0 | 2025-05-22 07:03:30 AM | user | Comment 01
1 | 2025-05-22 07:03:31 AM | user | Comment 02

Manage experiment tags

You can create tags and add them to experiments to group related experiments. For example, you can create a tag called Telco for telecommunication-related experiments and later retrieve them as a group.

Create a tag

To create a new tag in a workspace:

tag1 = workspace.tags.create(label="tag1")

List tags

To list all tags in a workspace:

Input:

workspace.tags.list()

Output:

   | label   | uid
---+---------+--------------------------------------
0 | tag1 | 31fc1901-1134-4384-ac07-e0965f8e30c7

Get a specific tag

To retrieve a tag by its label:

Input:

tag1 = workspace.tags.get(label="tag1")
tag1

Output:

<class 'h2o_mlops._projects.MLOpsProjectTag(
uid='31fc1901-1134-4384-ac07-e0965f8e30c7',
label='tag1',
parent_workspace_uid='e37a6146-5248-4754-9d93-68a9798babb2',
created_time=datetime.datetime(2025, 5, 22, 7, 3, 35, 596458, tzinfo=tzutc()),
)'>

Add tag

To add an existing tag to an experiment:

experiment.tags.add(label="tag1")

To add a new tag to an experiment without creating it first:

experiment.tags.add(label="tag2")

To list and verify all tags in an experiment:

Input:

experiment.tags.list()

Output:

   | label   | uid
---+---------+--------------------------------------
0 | tag1 | 31fc1901-1134-4384-ac07-e0965f8e30c7
1 | tag2 | b541b0b1-6371-4106-8095-94c9c25f2f0a

Update a tag

To update a tag’s label and view the updated list:

Input:

tag1.update(label="new-tag1")
experiment.tags.list() # or workspace.tags.list()

Output:

   | label    | uid
---+----------+--------------------------------------
0 | tag2 | b541b0b1-6371-4106-8095-94c9c25f2f0a
1 | new-tag1 | 31fc1901-1134-4384-ac07-e0965f8e30c7

Remove a tag

To remove a tag from an experiment:

Input:

experiment.tags.remove(label="new-tag1")
experiment.tags.list()

Output:

   | label   | uid
---+---------+--------------------------------------
0 | tag2 | b541b0b1-6371-4106-8095-94c9c25f2f0a

This removes the tag only from the experiment, not from the workspace.

To view all tags in a workspace after performing the above removal, use the following method:

Input:

workspace.tags.list()

This displays the list of tags currently available in the workspace.

Output:

   | label    | uid
---+----------+--------------------------------------
0 | tag2 | b541b0b1-6371-4106-8095-94c9c25f2f0a
1 | new-tag1 | 31fc1901-1134-4384-ac07-e0965f8e30c7

Delete a tag

To delete a tag from a workspace:

Input:

tag1.delete()
workspace.tags.list()

Output:

   | label   | uid
---+---------+--------------------------------------
0 | tag2 | b541b0b1-6371-4106-8095-94c9c25f2f0a
note

You cannot delete a tag from a workspace if it has already been added to an experiment.

Delete and restore experiments

This section describes how to delete and restore experiments.

Delete using an experiment instance

If you already have a reference to the experiment object, use the delete() method:

Input:

experiment.delete()
workspace.experiments.list()

Output:

   | name   | uid   | tags
---+--------+-------+--------

Restore using an experiment instance

If you already have a reference to the experiment object, use the restore() method:

Input:

experiment.restore()
workspace.experiments.list()

Output:

   | name                   | uid                                  | tags
---+------------------------+--------------------------------------+--------
0 | new-experiment | d9a47c99-c66c-4ff9-b2b6-30faf5f413ef | tag2

Delete using experiment UIDs

You can also delete multiple experiments at once by specifying their UIDs:

Input:

workspace.experiments.delete(uids=["d9a47c99-c66c-4ff9-b2b6-30faf5f413ef"])
note

You can also pass a list of MLOpsExperiment instances or a _utils.Table containing experiments. Example: workspace.experiments.delete(experiments=[experiment])

Output:

   | experiment_uid                       | is_deleted   | message   | project_uid
---+--------------------------------------+--------------+-----------+--------------------------------------
0 | d9a47c99-c66c-4ff9-b2b6-30faf5f413ef | True | | e37a6146-5248-4754-9d93-68a9798babb2

Restore using experiment UIDs

You can also restore multiple experiments at once by specifying their UIDs:

Input:

workspace.experiments.restore(uids=["d9a47c99-c66c-4ff9-b2b6-30faf5f413ef"])
note

You can also pass a list of MLOpsExperiment instances or a _utils.Table containing experiments. Example: workspace.experiments.restore(experiments=[experiment])

Output:

   | experiment_uid                       | is_restored   | message   | project_uid
---+--------------------------------------+---------------+-----------+--------------------------------------
0 | d9a47c99-c66c-4ff9-b2b6-30faf5f413ef | True | | e37a6146-5248-4754-9d93-68a9798babb2

Feedback