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,
- Connect to H2O MLOps. For instructions, see Connect to H2O MLOps.
- 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",
)
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 |
-
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 thenargument. This allows more rows to be shown when needed. For example:experiments.show(n=100)This will display up to 100 experiments.
-
The
experimentscan 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
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