HyperDriveRun Class

HyperDriveRun contains the details of a submitted HyperDrive experiment.

This class can be used to manage, check status, and retrieve run details for the HyperDrive run and each of the generated child runs.

Initialize a HyperDrive run.

Inheritance
HyperDriveRun

Constructor

HyperDriveRun(experiment, run_id, hyperdrive_config=None, **kwargs)

Parameters

experiment
Experiment
Required

The experiment for the HyperDrive run.

run_id
str
Required

The HyperDrive run ID.

hyperdrive_config
HyperDriveConfig
default value: None

The configuration for this HyperDrive run.

experiment
Experiment
Required

The experiment for the HyperDrive run.

run_id
str
Required

The HyperDrive run id.

hyperdrive_config
HyperDriveConfig
Required

The configuration for this HyperDrive run. If None, we assume that the run already exists and will try to hydrate from the cloud.

Methods

cancel

Return True if the HyperDrive run was cancelled successfully.

fail

Do not use. The fail method is not supported for the HyperDriveRun subclass.

get_best_run_by_primary_metric

Find and return the Run instance that corresponds to the best performing run amongst all child runs.

The best performing run is identified solely based on the primary metric parameter specified in the HyperDriveConfig. The PrimaryMetricGoal governs whether the minimum or maximum of the primary metric is used. To do a more detailed analysis of all the ExperimentRun metrics launched by this HyperDriveRun, use get_metrics. Only one of the runs is returned, even if several of the Runs launched by this HyperDrive run reached the same best metric.

get_children_sorted_by_primary_metric

Return a list of children sorted by their best primary metric.

The sorting is done according to the primary metric and its goal: if it is maximize, then the children are returned in descending order of their best primary metric. If reverse is True, the order is reversed.

Each child in the result has run id, hyperparameters, best primary metric value and status.

Children without primary metric are discarded when discard_no_metric is True. Otherwise, they are appended to the list behind other children with primary metric. Note that the reverse option has no impact on them.

get_diagnostics

Do not use. The get_diagnostics method is not supported for the HyperDriveRun subclass.

get_hyperparameters

Return the hyperparameters for all the child runs that were launched by this HyperDriveRun.

get_metrics

Return the metrics from all the runs that were launched by this HyperDriveRun.

cancel

Return True if the HyperDrive run was cancelled successfully.

cancel()

Returns

Whether or not the run was cancelled successfully.

Return type

fail

Do not use. The fail method is not supported for the HyperDriveRun subclass.

fail()

Exceptions

get_best_run_by_primary_metric

Find and return the Run instance that corresponds to the best performing run amongst all child runs.

The best performing run is identified solely based on the primary metric parameter specified in the HyperDriveConfig. The PrimaryMetricGoal governs whether the minimum or maximum of the primary metric is used. To do a more detailed analysis of all the ExperimentRun metrics launched by this HyperDriveRun, use get_metrics. Only one of the runs is returned, even if several of the Runs launched by this HyperDrive run reached the same best metric.

get_best_run_by_primary_metric(include_failed=True, include_canceled=True, include_resume_from_runs=True) -> Run | None

Parameters

include_failed
bool
default value: True

Whether to include failed runs.

include_canceled
bool
default value: True

Whether to include canceled runs.

include_resume_from_runs
bool
default value: True

Whether to include inherited resume_from runs.

Returns

The best Run, or None if no child has the primary metric.

Return type

Run

get_children_sorted_by_primary_metric

Return a list of children sorted by their best primary metric.

The sorting is done according to the primary metric and its goal: if it is maximize, then the children are returned in descending order of their best primary metric. If reverse is True, the order is reversed.

Each child in the result has run id, hyperparameters, best primary metric value and status.

Children without primary metric are discarded when discard_no_metric is True. Otherwise, they are appended to the list behind other children with primary metric. Note that the reverse option has no impact on them.

get_children_sorted_by_primary_metric(top=0, reverse=False, discard_no_metric=False)

Parameters

top
int
default value: 0

Number of top children to be returned. If it is 0, all children will be returned.

reverse
bool
default value: False

If it is True, the order will be reversed. It only impacts children with primary metric.

discard_no_metric
bool
default value: False

If it is False, children without primary metric will be appended to the list.

Returns

List of dictionaries with run id, hyperparameters, best primary metric and status

Return type

get_diagnostics

Do not use. The get_diagnostics method is not supported for the HyperDriveRun subclass.

get_diagnostics()

Exceptions

get_hyperparameters

Return the hyperparameters for all the child runs that were launched by this HyperDriveRun.

get_hyperparameters()

Returns

Hyperparameters for all the child runs. It is a dictionary with run_id as key.

Return type

get_metrics

Return the metrics from all the runs that were launched by this HyperDriveRun.

get_metrics()

Returns

The metrics for all the children of this run.

Return type

Attributes

hyperdrive_config

Return the hyperdrive run config.

Returns

The hyperdrive run config.

Return type

HYPER_DRIVE_RUN_USER_AGENT

HYPER_DRIVE_RUN_USER_AGENT = 'sdk_run_hyper_drive'

RUN_TYPE

RUN_TYPE = 'hyperdrive'