createTrial method

Future<CreateTrialResponse> createTrial({
  1. required String experimentName,
  2. required String trialName,
  3. String? displayName,
  4. MetadataProperties? metadataProperties,
  5. List<Tag>? tags,
})

Creates an Amazon 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 Amazon SageMaker experiment.

When you use Amazon SageMaker Studio or the Amazon SageMaker Python SDK, all experiments, trials, and trial components are automatically tracked, logged, and indexed. When you use the AWS 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.

May throw ResourceNotFound. May throw ResourceLimitExceeded.

Parameter experimentName : The name of the experiment to associate the trial with.

Parameter trialName : The name of the trial. The name must be unique in your AWS account and is not case-sensitive.

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

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

Implementation

Future<CreateTrialResponse> createTrial({
  required String experimentName,
  required String trialName,
  String? displayName,
  MetadataProperties? metadataProperties,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(experimentName, 'experimentName');
  _s.validateStringLength(
    'experimentName',
    experimentName,
    1,
    120,
    isRequired: true,
  );
  ArgumentError.checkNotNull(trialName, 'trialName');
  _s.validateStringLength(
    'trialName',
    trialName,
    1,
    120,
    isRequired: true,
  );
  _s.validateStringLength(
    'displayName',
    displayName,
    1,
    120,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateTrial'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ExperimentName': experimentName,
      'TrialName': trialName,
      if (displayName != null) 'DisplayName': displayName,
      if (metadataProperties != null)
        'MetadataProperties': metadataProperties,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateTrialResponse.fromJson(jsonResponse.body);
}