Skip to content

create_model async

create_model(
    model_name: ModelName,
    dataset_name: DatasetIdentifier,
    client_token: IdempotenceToken,
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    dataset_schema: Optional[DatasetSchema] = None,
    labels_input_configuration: Optional[LabelsInputConfiguration] = None,
    training_data_start_time: Optional[Timestamp] = None,
    training_data_end_time: Optional[Timestamp] = None,
    evaluation_data_start_time: Optional[Timestamp] = None,
    evaluation_data_end_time: Optional[Timestamp] = None,
    role_arn: Optional[IamRoleArn] = None,
    data_pre_processing_configuration: Optional[DataPreProcessingConfiguration] = None,
    server_side_kms_key_id: Optional[NameOrArn] = None,
    tags: Optional[TagList] = None,
    off_condition: Optional[OffCondition] = None,
    model_diagnostics_output_configuration: Optional[
        ModelDiagnosticsOutputConfiguration
    ] = None,
) -> CreateModelResponse

Creates a machine learning model for data inference.

A machine-learning (ML) model is a mathematical model that finds patterns in your data. In Amazon Lookout for Equipment, the model learns the patterns of normal behavior and detects abnormal behavior that could be potential equipment failure (or maintenance events). The models are made by analyzing normal data and abnormalities in machine behavior that have already occurred.

Your model is trained using a portion of the data from your dataset and uses that data to learn patterns of normal behavior and abnormal patterns that lead to equipment failure. Another portion of the data is used to evaluate the model's accuracy.

Parameters:

  • model_name (ModelName) –

    The name for the machine learning model to be created.

  • dataset_name (DatasetIdentifier) –

    The name of the dataset for the machine learning model being created.

  • dataset_schema (Optional[DatasetSchema], default: None ) –

    The data schema for the machine learning model being created.

  • labels_input_configuration (Optional[LabelsInputConfiguration], default: None ) –

    The input configuration for the labels being used for the machine learning model that's being created.

  • client_token (IdempotenceToken) –

    A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one.

  • training_data_start_time (Optional[Timestamp], default: None ) –

    Indicates the time reference in the dataset that should be used to begin the subset of training data for the machine learning model.

  • training_data_end_time (Optional[Timestamp], default: None ) –

    Indicates the time reference in the dataset that should be used to end the subset of training data for the machine learning model.

  • evaluation_data_start_time (Optional[Timestamp], default: None ) –

    Indicates the time reference in the dataset that should be used to begin the subset of evaluation data for the machine learning model.

  • evaluation_data_end_time (Optional[Timestamp], default: None ) –

    Indicates the time reference in the dataset that should be used to end the subset of evaluation data for the machine learning model.

  • role_arn (Optional[IamRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of a role with permission to access the data source being used to create the machine learning model.

  • data_pre_processing_configuration (Optional[DataPreProcessingConfiguration], default: None ) –

    The configuration is the TargetSamplingRate, which is the sampling rate of the data after post processing by Amazon Lookout for Equipment. For example, if you provide data that has been collected at a 1 second level and you want the system to resample the data at a 1 minute rate before training, the TargetSamplingRate is 1 minute.

    When providing a value for the TargetSamplingRate, you must attach the prefix "PT" to the rate you want. The value for a 1 second rate is therefore PT1S, the value for a 15 minute rate is PT15M, and the value for a 1 hour rate is PT1H

  • server_side_kms_key_id (Optional[NameOrArn], default: None ) –

    Provides the identifier of the KMS key used to encrypt model data by Amazon Lookout for Equipment.

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

    Any tags associated with the machine learning model being created.

  • off_condition (Optional[OffCondition], default: None ) –

    Indicates that the asset associated with this sensor has been shut off. As long as this condition is met, Lookout for Equipment will not use data from this asset for training, evaluation, or inference.

  • model_diagnostics_output_configuration (Optional[ModelDiagnosticsOutputConfiguration], default: None ) –

    The Amazon S3 location where you want Amazon Lookout for Equipment to save the pointwise model diagnostics. You must also specify the RoleArn request parameter.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have access to the resource.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the target resource.

  • InternalServerException –

    Processing of the request has failed because of an unknown error, exception or failure.

  • ResourceNotFoundException –

    The resource requested could not be found. Verify the resource ID and retry your request.

  • ServiceQuotaExceededException –

    Resource limitations have been exceeded.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized.

  • UnknownServiceError –

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

Source code in docs_src/capo_lookoutequipment/_services/async_lookout_equipment.py
async def create_model(
    self,
    model_name: "capo_lookoutequipment.types.model_name.ModelName",
    dataset_name: "capo_lookoutequipment.types.dataset_identifier.DatasetIdentifier",
    client_token: "capo_lookoutequipment.types.idempotence_token.IdempotenceToken",
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    dataset_schema: Optional[
        "capo_lookoutequipment.types.dataset_schema.DatasetSchema"
    ] = None,
    labels_input_configuration: Optional[
        "capo_lookoutequipment.types.labels_input_configuration.LabelsInputConfiguration"
    ] = None,
    training_data_start_time: Optional[
        "capo_lookoutequipment.types.timestamp.Timestamp"
    ] = None,
    training_data_end_time: Optional[
        "capo_lookoutequipment.types.timestamp.Timestamp"
    ] = None,
    evaluation_data_start_time: Optional[
        "capo_lookoutequipment.types.timestamp.Timestamp"
    ] = None,
    evaluation_data_end_time: Optional[
        "capo_lookoutequipment.types.timestamp.Timestamp"
    ] = None,
    role_arn: Optional[
        "capo_lookoutequipment.types.iam_role_arn.IamRoleArn"
    ] = None,
    data_pre_processing_configuration: Optional[
        "capo_lookoutequipment.types.data_pre_processing_configuration.DataPreProcessingConfiguration"
    ] = None,
    server_side_kms_key_id: Optional[
        "capo_lookoutequipment.types.name_or_arn.NameOrArn"
    ] = None,
    tags: Optional["capo_lookoutequipment.types.tag_list.TagList"] = None,
    off_condition: Optional[
        "capo_lookoutequipment.types.off_condition.OffCondition"
    ] = None,
    model_diagnostics_output_configuration: Optional[
        "capo_lookoutequipment.types.model_diagnostics_output_configuration.ModelDiagnosticsOutputConfiguration"
    ] = None,
) -> "capo_lookoutequipment.types.create_model_response.CreateModelResponse":
    """<p>Creates a machine learning model for data inference. </p> <p>A machine-learning (ML) model is a mathematical model that finds patterns in your data. In Amazon Lookout for Equipment, the model learns the patterns of normal behavior and detects abnormal behavior that could be potential equipment failure (or maintenance events). The models are made by analyzing normal data and abnormalities in machine behavior that have already occurred.</p> <p>Your model is trained using a portion of the data from your dataset and uses that data to learn patterns of normal behavior and abnormal patterns that lead to equipment failure. Another portion of the data is used to evaluate the model's accuracy. </p>

    Args:
        model_name: <p>The name for the machine learning model to be created.</p>
        dataset_name: <p>The name of the dataset for the machine learning model being created. </p>
        dataset_schema: <p>The data schema for the machine learning model being created. </p>
        labels_input_configuration: <p>The input configuration for the labels being used for the machine learning model that's being created. </p>
        client_token: <p>A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one. </p>
        training_data_start_time: <p>Indicates the time reference in the dataset that should be used to begin the subset of training data for the machine learning model. </p>
        training_data_end_time: <p>Indicates the time reference in the dataset that should be used to end the subset of training data for the machine learning model. </p>
        evaluation_data_start_time: <p>Indicates the time reference in the dataset that should be used to begin the subset of evaluation data for the machine learning model. </p>
        evaluation_data_end_time: <p> Indicates the time reference in the dataset that should be used to end the subset of evaluation data for the machine learning model. </p>
        role_arn: <p> The Amazon Resource Name (ARN) of a role with permission to access the data source being used to create the machine learning model. </p>
        data_pre_processing_configuration: <p>The configuration is the <code>TargetSamplingRate</code>, which is the sampling rate of the data after post processing by Amazon Lookout for Equipment. For example, if you provide data that has been collected at a 1 second level and you want the system to resample the data at a 1 minute rate before training, the <code>TargetSamplingRate</code> is 1 minute.</p> <p>When providing a value for the <code>TargetSamplingRate</code>, you must attach the prefix "PT" to the rate you want. The value for a 1 second rate is therefore <i>PT1S</i>, the value for a 15 minute rate is <i>PT15M</i>, and the value for a 1 hour rate is <i>PT1H</i> </p>
        server_side_kms_key_id: <p>Provides the identifier of the KMS key used to encrypt model data by Amazon Lookout for Equipment. </p>
        tags: <p> Any tags associated with the machine learning model being created. </p>
        off_condition: <p>Indicates that the asset associated with this sensor has been shut off. As long as this condition is met, Lookout for Equipment will not use data from this asset for training, evaluation, or inference.</p>
        model_diagnostics_output_configuration: <p>The Amazon S3 location where you want Amazon Lookout for Equipment to save the pointwise model diagnostics. You must also specify the <code>RoleArn</code> request parameter.</p>

    Raises:
        capo_lookoutequipment.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have access to the resource. </p>
        capo_lookoutequipment.errors.conflict_exception.ConflictException: <p> The request could not be completed due to a conflict with the current state of the target resource. </p>
        capo_lookoutequipment.errors.internal_server_exception.InternalServerException: <p> Processing of the request has failed because of an unknown error, exception or failure. </p>
        capo_lookoutequipment.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource requested could not be found. Verify the resource ID and retry your request. </p>
        capo_lookoutequipment.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> Resource limitations have been exceeded. </p>
        capo_lookoutequipment.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_lookoutequipment.errors.validation_exception.ValidationException: <p> The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized. </p>
        capo_lookoutequipment.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lookoutequipment.types.create_model_request.CreateModelRequest]",
    ) -> AsyncOperationResponse[
        "capo_lookoutequipment.types.create_model_response.CreateModelResponse"
    ]:
        import capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_model

        (
            output,
            http_response,
        ) = await capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_model.async_create_model(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateModel")
    )
    input_: capo_lookoutequipment.types.create_model_request.CreateModelRequest = {
        "model_name": model_name,
        "dataset_name": dataset_name,
        "client_token": client_token,
    }
    if dataset_schema is not None:
        input_["dataset_schema"] = dataset_schema
    if labels_input_configuration is not None:
        input_["labels_input_configuration"] = labels_input_configuration
    if training_data_start_time is not None:
        input_["training_data_start_time"] = training_data_start_time
    if training_data_end_time is not None:
        input_["training_data_end_time"] = training_data_end_time
    if evaluation_data_start_time is not None:
        input_["evaluation_data_start_time"] = evaluation_data_start_time
    if evaluation_data_end_time is not None:
        input_["evaluation_data_end_time"] = evaluation_data_end_time
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if data_pre_processing_configuration is not None:
        input_["data_pre_processing_configuration"] = (
            data_pre_processing_configuration
        )
    if server_side_kms_key_id is not None:
        input_["server_side_kms_key_id"] = server_side_kms_key_id
    if tags is not None:
        input_["tags"] = tags
    if off_condition is not None:
        input_["off_condition"] = off_condition
    if model_diagnostics_output_configuration is not None:
        input_["model_diagnostics_output_configuration"] = (
            model_diagnostics_output_configuration
        )

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output