Skip to content

Experiment Handler

Exitare edited this page Aug 5, 2022 · 4 revisions

The experiment handler is designed to provide helper functions for handling experiments

To create an Experiment Handler instance, multiple options are possible.

from mlflow_wrapper.experiment_handler import ExperimentHandler

# Connect to local mlflow server
exp_handler: ExperimentHandler = ExperimentHandler()


# Connect to a remote server
exp_handler: ExperimentHandler = ExperimentHandler(tracking_url="https://your-tracking-url.com")

# Use a client

client = MlflowClient()
exp_handler: ExperimentHandler = ExperimentHandler(client = client)

Create an experiment

Creates a new experiment with the given name. Raises an exception if the experiment already exists.

id: str = create_experiment(self, name: str) 

Get experiment by name

Experiments can be queried by name. This function is natively supported by Mlflow. However, if an experiment does not exist, it just returns None. This function however, accepts a setting to create an experiment if it does not exist on the fly.

experiment_id: str = exp_handler.get_experiment_by_name("Your experiment name", create_experiment=True)
Clone this wiki locally