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

Name Description
experiment
Required

The experiment for the HyperDrive run.

run_id
Required
str

The HyperDrive run ID.

hyperdrive_config

The configuration for this HyperDrive run.

Default value: None
experiment
Required

The experiment for the HyperDrive run.

run_id
Required
str

The HyperDrive run id.

hyperdrive_config
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

Type Description

Whether or not the run was cancelled successfully.

fail

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

fail()

Exceptions

Type Description

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

Name Description
include_failed

Whether to include failed runs.

Default value: True
include_canceled

Whether to include canceled runs.

Default value: True
include_resume_from_runs

Whether to include inherited resume_from runs.

Default value: True

Returns

Type Description
Run

The best Run, or None if no child has the primary 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_children_sorted_by_primary_metric(top=0, reverse=False, discard_no_metric=False)

Parameters

Name Description
top
int

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

Default value: 0
reverse

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

Default value: False
discard_no_metric

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

Default value: False

Returns

Type Description

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

get_diagnostics

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

get_diagnostics()

Exceptions

Type Description

get_hyperparameters

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

get_hyperparameters()

Returns

Type Description

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

get_metrics

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

get_metrics()

Returns

Type Description

The metrics for all the children of this run.

Attributes

hyperdrive_config

Return the hyperdrive run config.

Returns

Type Description

The hyperdrive run config.

HYPER_DRIVE_RUN_USER_AGENT

HYPER_DRIVE_RUN_USER_AGENT = 'sdk_run_hyper_drive'

RUN_TYPE

RUN_TYPE = 'hyperdrive'