Skip to content

create_trained_model

create_trained_model(
    membership_identifier: UUID,
    name: NameString,
    configured_model_algorithm_association_arn: ConfiguredModelAlgorithmAssociationArn,
    resource_config: ResourceConfig,
    data_channels: ModelTrainingDataChannels,
    *,
    config_overrides: Optional[CleanRoomsMLClientConfig] = None,
    hyperparameters: Optional[HyperParameters] = None,
    environment: Optional[Environment] = None,
    stopping_condition: Optional[StoppingCondition] = None,
    incremental_training_data_channels: Optional[
        IncrementalTrainingDataChannels
    ] = None,
    training_input_mode: Optional[TrainingInputMode] = None,
    description: Optional[ResourceDescription] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    tags: Optional[TagMap] = None,
    ml_model_training_payer_account_id: Optional[AccountId] = None,
) -> CreateTrainedModelResponse

Creates a trained model from an associated configured model algorithm using data from any member of the collaboration.

Parameters:

  • membership_identifier (UUID) –

    The membership ID of the member that is creating the trained model.

  • name (NameString) –

    The name of the trained model.

  • configured_model_algorithm_association_arn (ConfiguredModelAlgorithmAssociationArn) –

    The associated configured model algorithm used to train this model.

  • hyperparameters (Optional[HyperParameters], default: None ) –

    Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process.

  • environment (Optional[Environment], default: None ) –

    The environment variables to set in the Docker container.

  • resource_config (ResourceConfig) –

    Information about the EC2 resources that are used to train this model.

  • stopping_condition (Optional[StoppingCondition], default: None ) –

    The criteria that is used to stop model training.

  • incremental_training_data_channels (Optional[IncrementalTrainingDataChannels], default: None ) –

    Specifies the incremental training data channels for the trained model.

    Incremental training allows you to create a new trained model with updates without retraining from scratch. You can specify up to one incremental training data channel that references a previously trained model and its version.

    Limit: Maximum of 20 channels total (including both incrementalTrainingDataChannels and dataChannels).

  • data_channels (ModelTrainingDataChannels) –

    Defines the data channels that are used as input for the trained model request.

    Limit: Maximum of 20 channels total (including both dataChannels and incrementalTrainingDataChannels).

  • training_input_mode (Optional[TrainingInputMode], default: None ) –

    The input mode for accessing the training data. This parameter determines how the training data is made available to the training algorithm. Valid values are:

    • File - The training data is downloaded to the training instance and made available as files.

    • FastFile - The training data is streamed directly from Amazon S3 to the training algorithm, providing faster access for large datasets.

    • Pipe - The training data is streamed to the training algorithm using named pipes, which can improve performance for certain algorithms.

  • description (Optional[ResourceDescription], default: None ) –

    The description of the trained model.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The Amazon Resource Name (ARN) of the KMS key. This key is used to encrypt and decrypt customer-owned data in the trained ML model and the associated data.

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

    The optional metadata that you apply to the resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.

    The following basic restrictions apply to tags:

    • Maximum number of tags per resource - 50.

    • For each resource, each tag key must be unique, and each tag key can have only one value.

    • Maximum key length - 128 Unicode characters in UTF-8.

    • Maximum value length - 256 Unicode characters in UTF-8.

    • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

    • Tag keys and values are case sensitive.

    • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for keys as it is reserved for AWS use. You cannot edit or delete tag keys with this prefix. Values can have this prefix. If a tag value has aws as its prefix but the key does not, then Clean Rooms ML considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit.

  • ml_model_training_payer_account_id (Optional[AccountId], default: None ) –

    The account ID of the member that is responsible for paying for model training costs.

Raises:

Source code in docs_src/capo_cleanroomsml/_services/clean_rooms_ml.py
def create_trained_model(
    self,
    membership_identifier: "capo_cleanroomsml.types.uuid.UUID",
    name: "capo_cleanroomsml.types.name_string.NameString",
    configured_model_algorithm_association_arn: "capo_cleanroomsml.types.configured_model_algorithm_association_arn.ConfiguredModelAlgorithmAssociationArn",
    resource_config: "capo_cleanroomsml.types.resource_config.ResourceConfig",
    data_channels: "capo_cleanroomsml.types.model_training_data_channels.ModelTrainingDataChannels",
    *,
    config_overrides: Optional[CleanRoomsMLClientConfig] = None,
    hyperparameters: Optional[
        "capo_cleanroomsml.types.hyper_parameters.HyperParameters"
    ] = None,
    environment: Optional["capo_cleanroomsml.types.environment.Environment"] = None,
    stopping_condition: Optional[
        "capo_cleanroomsml.types.stopping_condition.StoppingCondition"
    ] = None,
    incremental_training_data_channels: Optional[
        "capo_cleanroomsml.types.incremental_training_data_channels.IncrementalTrainingDataChannels"
    ] = None,
    training_input_mode: Optional[
        "capo_cleanroomsml.types.training_input_mode.TrainingInputMode"
    ] = None,
    description: Optional[
        "capo_cleanroomsml.types.resource_description.ResourceDescription"
    ] = None,
    kms_key_arn: Optional["capo_cleanroomsml.types.kms_key_arn.KmsKeyArn"] = None,
    tags: Optional["capo_cleanroomsml.types.tag_map.TagMap"] = None,
    ml_model_training_payer_account_id: Optional[
        "capo_cleanroomsml.types.account_id.AccountId"
    ] = None,
) -> "capo_cleanroomsml.types.create_trained_model_response.CreateTrainedModelResponse":
    """<p>Creates a trained model from an associated configured model algorithm using data from any member of the collaboration.</p>

    Args:
        membership_identifier: <p>The membership ID of the member that is creating the trained model.</p>
        name: <p>The name of the trained model.</p>
        configured_model_algorithm_association_arn: <p>The associated configured model algorithm used to train this model.</p>
        hyperparameters: <p>Algorithm-specific parameters that influence the quality of the model. You set hyperparameters before you start the learning process.</p>
        environment: <p>The environment variables to set in the Docker container.</p>
        resource_config: <p>Information about the EC2 resources that are used to train this model.</p>
        stopping_condition: <p>The criteria that is used to stop model training.</p>
        incremental_training_data_channels: <p>Specifies the incremental training data channels for the trained model. </p> <p>Incremental training allows you to create a new trained model with updates without retraining from scratch. You can specify up to one incremental training data channel that references a previously trained model and its version.</p> <p>Limit: Maximum of 20 channels total (including both <code>incrementalTrainingDataChannels</code> and <code>dataChannels</code>).</p>
        data_channels: <p>Defines the data channels that are used as input for the trained model request.</p> <p>Limit: Maximum of 20 channels total (including both <code>dataChannels</code> and <code>incrementalTrainingDataChannels</code>).</p>
        training_input_mode: <p>The input mode for accessing the training data. This parameter determines how the training data is made available to the training algorithm. Valid values are:</p> <ul> <li> <p> <code>File</code> - The training data is downloaded to the training instance and made available as files.</p> </li> <li> <p> <code>FastFile</code> - The training data is streamed directly from Amazon S3 to the training algorithm, providing faster access for large datasets.</p> </li> <li> <p> <code>Pipe</code> - The training data is streamed to the training algorithm using named pipes, which can improve performance for certain algorithms.</p> </li> </ul>
        description: <p>The description of the trained model.</p>
        kms_key_arn: <p>The Amazon Resource Name (ARN) of the KMS key. This key is used to encrypt and decrypt customer-owned data in the trained ML model and the associated data.</p>
        tags: <p>The optional metadata that you apply to the resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.</p> <p>The following basic restrictions apply to tags:</p> <ul> <li> <p>Maximum number of tags per resource - 50.</p> </li> <li> <p>For each resource, each tag key must be unique, and each tag key can have only one value.</p> </li> <li> <p>Maximum key length - 128 Unicode characters in UTF-8.</p> </li> <li> <p>Maximum value length - 256 Unicode characters in UTF-8.</p> </li> <li> <p>If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.</p> </li> <li> <p>Tag keys and values are case sensitive.</p> </li> <li> <p>Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for keys as it is reserved for AWS use. You cannot edit or delete tag keys with this prefix. Values can have this prefix. If a tag value has aws as its prefix but the key does not, then Clean Rooms ML considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit.</p> </li> </ul>
        ml_model_training_payer_account_id: <p>The account ID of the member that is responsible for paying for model training costs.</p>

    Raises:
        capo_cleanroomsml.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_cleanroomsml.errors.conflict_exception.ConflictException: <p>You can't complete this action because another resource depends on this resource.</p>
        capo_cleanroomsml.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred. Retry your request. If the problem persists, contact AWS Support.</p>
        capo_cleanroomsml.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource you are requesting does not exist.</p>
        capo_cleanroomsml.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded your service quota.</p>
        capo_cleanroomsml.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_cleanroomsml.errors.validation_exception.ValidationException: <p>The request parameters for this request are incorrect.</p>
        capo_cleanroomsml.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cleanroomsml.types.create_trained_model_request.CreateTrainedModelRequest]",
    ) -> OperationResponse[
        "capo_cleanroomsml.types.create_trained_model_response.CreateTrainedModelResponse"
    ]:
        import capo_cleanroomsml._operations.aws_stark_control_service.create_trained_model

        output, http_response = (
            capo_cleanroomsml._operations.aws_stark_control_service.create_trained_model.create_trained_model(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTrainedModel")
    )
    input_: capo_cleanroomsml.types.create_trained_model_request.CreateTrainedModelRequest = {
        "membership_identifier": membership_identifier,
        "name": name,
        "configured_model_algorithm_association_arn": configured_model_algorithm_association_arn,
        "resource_config": resource_config,
        "data_channels": data_channels,
    }
    if hyperparameters is not None:
        input_["hyperparameters"] = hyperparameters
    if environment is not None:
        input_["environment"] = environment
    if stopping_condition is not None:
        input_["stopping_condition"] = stopping_condition
    if incremental_training_data_channels is not None:
        input_["incremental_training_data_channels"] = (
            incremental_training_data_channels
        )
    if training_input_mode is not None:
        input_["training_input_mode"] = training_input_mode
    if description is not None:
        input_["description"] = description
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if tags is not None:
        input_["tags"] = tags
    if ml_model_training_payer_account_id is not None:
        input_["ml_model_training_payer_account_id"] = (
            ml_model_training_payer_account_id
        )

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