Skip to content

create_trial

create_trial(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    trial_name: Optional[ExperimentEntityName] = None,
    display_name: Optional[ExperimentEntityName] = None,
    experiment_name: Optional[ExperimentEntityName] = None,
    metadata_properties: Optional[MetadataProperties] = None,
    tags: Optional[TagList] = None,
) -> CreateTrialResponse

Creates an SageMaker trial. A trial is a set of steps called trial components that produce a machine learning model. A trial is part of a single SageMaker experiment.

When you use SageMaker Studio or the SageMaker Python SDK, all experiments, trials, and trial components are automatically tracked, logged, and indexed. When you use the Amazon Web Services SDK for Python (Boto), you must use the logging APIs provided by the SDK.

You can add tags to a trial and then use the Search API to search for the tags.

To get a list of all your trials, call the ListTrials API. To view a trial's properties, call the DescribeTrial API. To create a trial component, call the CreateTrialComponent API.

Parameters:

  • trial_name (Optional[ExperimentEntityName], default: None ) –

    The name of the trial. The name must be unique in your Amazon Web Services account and is not case-sensitive.

  • display_name (Optional[ExperimentEntityName], default: None ) –

    The name of the trial as displayed. The name doesn't need to be unique. If DisplayName isn't specified, TrialName is displayed.

  • experiment_name (Optional[ExperimentEntityName], default: None ) –

    The name of the experiment to associate the trial with.

  • tags (Optional[TagList], default: None ) –

    A list of tags to associate with the trial. You can use Search API to search on the tags.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_trial(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    trial_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    display_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    experiment_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    metadata_properties: Optional[
        "capo_sagemaker.types.metadata_properties.MetadataProperties"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_trial_response.CreateTrialResponse":
    """<p>Creates an SageMaker <i>trial</i>. A trial is a set of steps called <i>trial components</i> that produce a machine learning model. A trial is part of a single SageMaker <i>experiment</i>.</p> <p>When you use SageMaker Studio or the SageMaker Python SDK, all experiments, trials, and trial components are automatically tracked, logged, and indexed. When you use the Amazon Web Services SDK for Python (Boto), you must use the logging APIs provided by the SDK.</p> <p>You can add tags to a trial and then use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Search.html">Search</a> API to search for the tags.</p> <p>To get a list of all your trials, call the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTrials.html">ListTrials</a> API. To view a trial's properties, call the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrial.html">DescribeTrial</a> API. To create a trial component, call the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrialComponent.html">CreateTrialComponent</a> API.</p>

    Args:
        trial_name: <p>The name of the trial. The name must be unique in your Amazon Web Services account and is not case-sensitive.</p>
        display_name: <p>The name of the trial as displayed. The name doesn't need to be unique. If <code>DisplayName</code> isn't specified, <code>TrialName</code> is displayed.</p>
        experiment_name: <p>The name of the experiment to associate the trial with.</p>
        tags: <p>A list of tags to associate with the trial. You can use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Search.html">Search</a> API to search on the tags.</p>

    Raises:
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_trial_request.CreateTrialRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_trial_response.CreateTrialResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_trial

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_trial.create_trial(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTrial")
    )
    input_: capo_sagemaker.types.create_trial_request.CreateTrialRequest = {}
    if trial_name is not None:
        input_["trial_name"] = trial_name
    if display_name is not None:
        input_["display_name"] = display_name
    if experiment_name is not None:
        input_["experiment_name"] = experiment_name
    if metadata_properties is not None:
        input_["metadata_properties"] = metadata_properties
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output