Trial Component

class smexperiments.trial_component.TrialComponent(sagemaker_boto_client, **kwargs)

Bases: smexperiments._base_types.Record

This class represents a SageMaker trial component object.

A trial component is a stage in a trial.

Trial components are created automatically within the SageMaker runtime and may not be created directly. To automatically associate trial components with a trial and experiment supply an experiment config when creating a job. For example: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html

Parameters:
  • trial_component_name (str) – The name of the trial component. Generated by SageMaker from the name of the source job with a suffix specific to the type of source job.
  • trial_component_arn (str) – The ARN of the trial component.
  • display_name (str) – The name of the trial component that will appear in UI, such as SageMaker Studio.
  • source (obj) – A TrialComponentSource object with a source_arn attribute.
  • status (str) – Status of the source job.
  • start_time (datetime) – When the source job started.
  • end_time (datetime) – When the source job ended.
  • creation_time (datetime) – When the source job was created.
  • created_by (obj) – Contextual info on which account created the trial component.
  • last_modified_time (datetime) – When the trial component was last modified.
  • last_modified_by (obj) – Contextual info on which account last modified the trial component.
  • parameters (dict) – Dictionary of parameters to the source job.
  • input_artifacts (dict) – Dictionary of input artifacts.
  • output_artifacts (dict) – Dictionary of output artifacts.
  • metrics (obj) – Aggregated metrics for the job.
  • parameters_to_remove (list) – The hyperparameters to remove from the component.
  • input_artifacts_to_remove (list) – The input artifacts to remove from the component.
  • output_artifacts_to_remove (list) – The output artifacts to remove from the component.
  • tags (List[dict[str, str]]) – A list of tags to associate with the trial component.
trial_component_name = None
trial_component_arn = None
display_name = None
source = None
status = None
start_time = None
end_time = None
creation_time = None
created_by = None
last_modified_time = None
last_modified_by = None
parameters = None
input_artifacts = None
output_artifacts = None
metrics = None
parameters_to_remove = None
input_artifacts_to_remove = None
output_artifacts_to_remove = None
tags = None
save()

Save the state of this TrialComponent to SageMaker.

delete(force_disassociate=None)

Delete this TrialComponent from SageMaker.

Parameters:
  • force_disassociate (boolean) – Indicates whether to force disassociate the trial component with the trials
  • deletion. If set to true, force disassociate the trial component with associated trials first, then (before) –
  • the trial component. If it's not set or set to false, it will delete the trial component directory (delete) –

    without disassociation.

    Returns:
    dict: Delete trial component response.
list_trials()

Load a list of trials that contains the same trial component name

Returns:A list of trials that contains the same trial component name
classmethod load(trial_component_name, sagemaker_boto_client=None)

Load an existing trial component and return an TrialComponent object representing it.

Parameters:
  • trial_component_name (str) – Name of the trial component
  • sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be created and used.
Returns:

A SageMaker TrialComponent object

Return type:

smexperiments.trial_component.TrialComponent

classmethod create(trial_component_name, display_name=None, tags=None, sagemaker_boto_client=None)

Create a trial component and return a TrialComponent object representing it.

Parameters:
  • trial_component_name (str) – The name of the trial component.
  • display_name (str) – Display name of the trial component used by Studio. Defaults to None.
  • tags (dict) – Tags to add to the trial component. Defaults to None.
  • sagemaker_boto_client (obj) – SageMaker boto client. Defaults to None.
Returns:

A SageMaker TrialComponent

object.

Return type:

smexperiments.trial_component.TrialComponent

classmethod list(source_arn=None, created_before=None, created_after=None, sort_by=None, sort_order=None, sagemaker_boto_client=None, trial_name=None, experiment_name=None, max_results=None, next_token=None)

Return a list of trial component summaries.

Parameters:
  • source_arn (str, optional) – A SageMaker Training or Processing Job ARN.
  • created_before (datetime.datetime, optional) – Return trial components created before this instant.
  • created_after (datetime.datetime, optional) – Return trial components created after this instant.
  • sort_by (str, optional) – Which property to sort results by. One of ‘SourceArn’, ‘CreatedBefore’, ‘CreatedAfter’
  • sort_order (str, optional) – One of ‘Ascending’, or ‘Descending’.
  • sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be created and used.
  • trial_name (str, optional) – If provided only trial components related to the trial are returned.
  • experiment_name (str, optional) – If provided only trial components related to the experiment are returned.
  • max_results (int, optional) – maximum number of trial components to retrieve
  • next_token (str, optional) – token for next page of results
Returns:

An iterator

over TrialComponentSummary objects.

Return type:

collections.Iterator[smexperiments.api_types.TrialComponentSummary]

classmethod search(search_expression=None, sort_by=None, sort_order=None, max_results=None, sagemaker_boto_client=None)

Search experiments. Returns SearchResults in the account matching the search criteria.

Parameters:
  • search_expression – (dict, optional): A Boolean conditional statement. Resource objects must satisfy this condition to be included in search results. You must provide at least one subexpression, filter, or nested filter.
  • sort_by (str, optional) – The name of the resource property used to sort the SearchResults. The default is LastModifiedTime
  • sort_order (str, optional) – How SearchResults are ordered. Valid values are Ascending or Descending . The default is Descending .
  • max_results (int, optional) – The maximum number of results to return in a SearchResponse.
  • sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be used.
Returns:

An iterator over search results matching the search criteria.

Return type:

collections.Iterator[SearchResult]