Skip to content

create_model_version

create_model_version(
    model_id: modelIdentifier,
    model_type: ModelTypeEnum,
    training_data_source: TrainingDataSourceEnum,
    training_data_schema: TrainingDataSchema,
    *,
    config_overrides: Optional[FraudDetectorClientConfig] = None,
    external_events_detail: Optional[ExternalEventsDetail] = None,
    ingested_events_detail: Optional[IngestedEventsDetail] = None,
    tags: Optional[tagList] = None,
) -> CreateModelVersionResult

Creates a version of the model using the specified model type and model id.

Parameters:

  • model_id (modelIdentifier) –

    The model ID.

  • model_type (ModelTypeEnum) –

    The model type.

  • training_data_source (TrainingDataSourceEnum) –

    The training data source location in Amazon S3.

  • training_data_schema (TrainingDataSchema) –

    The training data schema.

  • external_events_detail (Optional[ExternalEventsDetail], default: None ) –

    Details of the external events data used for model version training. Required if trainingDataSource is EXTERNAL_EVENTS.

  • ingested_events_detail (Optional[IngestedEventsDetail], default: None ) –

    Details of the ingested events data used for model version training. Required if trainingDataSource is INGESTED_EVENTS.

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

    A collection of key and value pairs.

Raises:

  • AccessDeniedException –

    An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

  • InternalServerException –

    An exception indicating an internal server error.

  • ResourceNotFoundException –

    An exception indicating the specified resource was not found.

  • ThrottlingException –

    An exception indicating a throttling error.

  • ValidationException –

    An exception indicating a specified value is not allowed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_frauddetector/_services/fraud_detector.py
def create_model_version(
    self,
    model_id: "capo_frauddetector.types.model_identifier.modelIdentifier",
    model_type: "capo_frauddetector.types.model_type_enum.ModelTypeEnum",
    training_data_source: "capo_frauddetector.types.training_data_source_enum.TrainingDataSourceEnum",
    training_data_schema: "capo_frauddetector.types.training_data_schema.TrainingDataSchema",
    *,
    config_overrides: Optional[FraudDetectorClientConfig] = None,
    external_events_detail: Optional[
        "capo_frauddetector.types.external_events_detail.ExternalEventsDetail"
    ] = None,
    ingested_events_detail: Optional[
        "capo_frauddetector.types.ingested_events_detail.IngestedEventsDetail"
    ] = None,
    tags: Optional["capo_frauddetector.types.tag_list.tagList"] = None,
) -> (
    "capo_frauddetector.types.create_model_version_result.CreateModelVersionResult"
):
    """<p>Creates a version of the model using the specified model type and model id. </p>

    Args:
        model_id: <p>The model ID. </p>
        model_type: <p>The model type.</p>
        training_data_source: <p>The training data source location in Amazon S3. </p>
        training_data_schema: <p>The training data schema.</p>
        external_events_detail: <p>Details of the external events data used for model version training. Required if <code>trainingDataSource</code> is <code>EXTERNAL_EVENTS</code>.</p>
        ingested_events_detail: <p>Details of the ingested events data used for model version training. Required if <code>trainingDataSource</code> is <code>INGESTED_EVENTS</code>.</p>
        tags: <p>A collection of key and value pairs.</p>

    Raises:
        capo_frauddetector.errors.access_denied_exception.AccessDeniedException: <p>An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as <code>PutExternalModel</code>, that specifies a role that is not in your account.</p>
        capo_frauddetector.errors.internal_server_exception.InternalServerException: <p>An exception indicating an internal server error.</p>
        capo_frauddetector.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception indicating the specified resource was not found.</p>
        capo_frauddetector.errors.throttling_exception.ThrottlingException: <p>An exception indicating a throttling error.</p>
        capo_frauddetector.errors.validation_exception.ValidationException: <p>An exception indicating a specified value is not allowed.</p>
        capo_frauddetector.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_frauddetector.types.create_model_version_request.CreateModelVersionRequest]",
    ) -> OperationResponse[
        "capo_frauddetector.types.create_model_version_result.CreateModelVersionResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.create_model_version

        output, http_response = (
            capo_frauddetector._operations.aws_hawks_nest_service_facade.create_model_version.create_model_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateModelVersion")
    )
    input_: capo_frauddetector.types.create_model_version_request.CreateModelVersionRequest = {
        "model_id": model_id,
        "model_type": model_type,
        "training_data_source": training_data_source,
        "training_data_schema": training_data_schema,
    }
    if external_events_detail is not None:
        input_["external_events_detail"] = external_events_detail
    if ingested_events_detail is not None:
        input_["ingested_events_detail"] = ingested_events_detail
    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