Skip to content

create_algorithm

create_algorithm(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    algorithm_name: Optional[EntityName] = None,
    algorithm_description: Optional[EntityDescription] = None,
    training_specification: Optional[TrainingSpecification] = None,
    inference_specification: Optional[InferenceSpecification] = None,
    validation_specification: Optional[AlgorithmValidationSpecification] = None,
    certify_for_marketplace: Optional[CertifyForMarketplace] = None,
    tags: Optional[TagList] = None,
) -> CreateAlgorithmOutput

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

Parameters:

  • algorithm_name (Optional[EntityName], default: None ) –

    The name of the algorithm.

  • algorithm_description (Optional[EntityDescription], default: None ) –

    A description of the algorithm.

  • training_specification (Optional[TrainingSpecification], default: None ) –

    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.

  • inference_specification (Optional[InferenceSpecification], default: None ) –

    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.

  • validation_specification (Optional[AlgorithmValidationSpecification], default: None ) –

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

  • certify_for_marketplace (Optional[CertifyForMarketplace], default: None ) –

    Whether to certify the algorithm so that it can be listed in Amazon Web Services Marketplace.

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

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

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_algorithm(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    algorithm_name: Optional["capo_sagemaker.types.entity_name.EntityName"] = None,
    algorithm_description: Optional[
        "capo_sagemaker.types.entity_description.EntityDescription"
    ] = None,
    training_specification: Optional[
        "capo_sagemaker.types.training_specification.TrainingSpecification"
    ] = None,
    inference_specification: Optional[
        "capo_sagemaker.types.inference_specification.InferenceSpecification"
    ] = None,
    validation_specification: Optional[
        "capo_sagemaker.types.algorithm_validation_specification.AlgorithmValidationSpecification"
    ] = None,
    certify_for_marketplace: Optional[
        "capo_sagemaker.types.certify_for_marketplace.CertifyForMarketplace"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_algorithm_output.CreateAlgorithmOutput":
    """<p>Create a machine learning algorithm that you can use in SageMaker and list in the Amazon Web Services Marketplace.</p>

    Args:
        algorithm_name: <p>The name of the algorithm.</p>
        algorithm_description: <p>A description of the algorithm.</p>
        training_specification: <p>Specifies details about training jobs run by this algorithm, including the following:</p> <ul> <li> <p>The Amazon ECR path of the container and the version digest of the algorithm.</p> </li> <li> <p>The hyperparameters that the algorithm supports.</p> </li> <li> <p>The instance types that the algorithm supports for training.</p> </li> <li> <p>Whether the algorithm supports distributed training.</p> </li> <li> <p>The metrics that the algorithm emits to Amazon CloudWatch.</p> </li> <li> <p>Which metrics that the algorithm emits can be used as the objective metric for hyperparameter tuning jobs.</p> </li> <li> <p>The input channels that the algorithm supports for training data. For example, an algorithm might support <code>train</code>, <code>validation</code>, and <code>test</code> channels.</p> </li> </ul>
        inference_specification: <p>Specifies details about inference jobs that the algorithm runs, including the following:</p> <ul> <li> <p>The Amazon ECR paths of containers that contain the inference code and model artifacts.</p> </li> <li> <p>The instance types that the algorithm supports for transform jobs and real-time endpoints used for inference.</p> </li> <li> <p>The input and output content formats that the algorithm supports for inference.</p> </li> </ul>
        validation_specification: <p>Specifies configurations for one or more training jobs and that SageMaker runs to test the algorithm's training code and, optionally, one or more batch transform jobs that SageMaker runs to test the algorithm's inference code.</p>
        certify_for_marketplace: <p>Whether to certify the algorithm so that it can be listed in Amazon Web Services Marketplace.</p>
        tags: <p>An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_algorithm_input.CreateAlgorithmInput]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_algorithm_output.CreateAlgorithmOutput"
    ]:
        import capo_sagemaker._operations.sage_maker.create_algorithm

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAlgorithm")
    )
    input_: capo_sagemaker.types.create_algorithm_input.CreateAlgorithmInput = {}
    if algorithm_name is not None:
        input_["algorithm_name"] = algorithm_name
    if algorithm_description is not None:
        input_["algorithm_description"] = algorithm_description
    if training_specification is not None:
        input_["training_specification"] = training_specification
    if inference_specification is not None:
        input_["inference_specification"] = inference_specification
    if validation_specification is not None:
        input_["validation_specification"] = validation_specification
    if certify_for_marketplace is not None:
        input_["certify_for_marketplace"] = certify_for_marketplace
    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