createAlgorithm method

Future<CreateAlgorithmOutput> createAlgorithm({
  1. required String algorithmName,
  2. required TrainingSpecification trainingSpecification,
  3. String? algorithmDescription,
  4. bool? certifyForMarketplace,
  5. InferenceSpecification? inferenceSpecification,
  6. List<Tag>? tags,
  7. AlgorithmValidationSpecification? validationSpecification,
})

Create a machine learning algorithm that you can use in Amazon SageMaker and list in the AWS Marketplace.

Parameter algorithmName : The name of the algorithm.

Parameter trainingSpecification : Specifies details about training jobs run by this algorithm, including the following:

  • The Amazon ECR path of the container and the version digest of the algorithm.
  • The hyperparameters that the algorithm supports.
  • The instance types that the algorithm supports for training.
  • Whether the algorithm supports distributed training.
  • The metrics that the algorithm emits to Amazon CloudWatch.
  • Which metrics that the algorithm emits can be used as the objective metric for hyperparameter tuning jobs.
  • The input channels that the algorithm supports for training data. For example, an algorithm might support train, validation, and test channels.

Parameter algorithmDescription : A description of the algorithm.

Parameter certifyForMarketplace : Whether to certify the algorithm so that it can be listed in AWS Marketplace.

Parameter inferenceSpecification : Specifies details about inference jobs that the algorithm runs, including the following:

  • The Amazon ECR paths of containers that contain the inference code and model artifacts.
  • The instance types that the algorithm supports for transform jobs and real-time endpoints used for inference.
  • The input and output content formats that the algorithm supports for inference.

Parameter tags : An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. For more information, see Tagging AWS Resources.

Parameter validationSpecification : Specifies configurations for one or more training jobs and that Amazon SageMaker runs to test the algorithm's training code and, optionally, one or more batch transform jobs that Amazon SageMaker runs to test the algorithm's inference code.

Implementation

Future<CreateAlgorithmOutput> createAlgorithm({
  required String algorithmName,
  required TrainingSpecification trainingSpecification,
  String? algorithmDescription,
  bool? certifyForMarketplace,
  InferenceSpecification? inferenceSpecification,
  List<Tag>? tags,
  AlgorithmValidationSpecification? validationSpecification,
}) async {
  ArgumentError.checkNotNull(algorithmName, 'algorithmName');
  _s.validateStringLength(
    'algorithmName',
    algorithmName,
    1,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(trainingSpecification, 'trainingSpecification');
  _s.validateStringLength(
    'algorithmDescription',
    algorithmDescription,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateAlgorithm'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AlgorithmName': algorithmName,
      'TrainingSpecification': trainingSpecification,
      if (algorithmDescription != null)
        'AlgorithmDescription': algorithmDescription,
      if (certifyForMarketplace != null)
        'CertifyForMarketplace': certifyForMarketplace,
      if (inferenceSpecification != null)
        'InferenceSpecification': inferenceSpecification,
      if (tags != null) 'Tags': tags,
      if (validationSpecification != null)
        'ValidationSpecification': validationSpecification,
    },
  );

  return CreateAlgorithmOutput.fromJson(jsonResponse.body);
}