Skip to main content

document_classifiers

Creates, updates, deletes, gets or lists a document_classifiers resource.

Overview

Namedocument_classifiers
TypeResource
Idaws.comprehend.document_classifiers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
classifier_metadataobjectInformation about the document classifier, including the number of documents used for training the classifier, the number of documents used for test the classifier, and an accuracy rating.
data_access_role_arnstringThe Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data. (pattern: <code>arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+</code>)
document_classifier_arnstringThe Amazon Resource Name (ARN) that identifies the document classifier. (pattern: <code>arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]:[0-9]{12}:document-classifier/[a-zA-Z0-9](-[a-zA-Z0-9])(/version/[a-zA-Z0-9](-[a-zA-Z0-9])*)?</code>)
end_timestring (date-time)The time that training the document classifier completed.
flywheel_arnstringThe Amazon Resource Number (ARN) of the flywheel (pattern: <code>arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]:[0-9]{12}:flywheel/[a-zA-Z0-9](-[a-zA-Z0-9])*</code>)
input_data_configobjectThe input data configuration that you supplied when you created the document classifier for training.
language_codestringThe language code for the language of the documents that the classifier was trained on. (en, es, fr, de, it, pt, ar, hi, ja, ko, zh, zh-TW)
messagestringAdditional information about the status of the classifier.
modestringIndicates the mode in which the specific classifier was trained. This also indicates the format of input documents and the format of the confusion matrix. Each classifier can only be trained in one mode and this cannot be changed once the classifier is trained. (MULTI_CLASS, MULTI_LABEL)
model_kms_key_idstringID for the KMS key that Amazon Comprehend uses to encrypt trained custom models. The ModelKmsKeyId can be either of the following formats: KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab" Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" (pattern: <code>^\p{ASCII}+$</code>)
output_data_configobjectProvides output results configuration parameters for custom classifier jobs.
source_model_arnstringThe Amazon Resource Name (ARN) of the source model. This model was imported from a different Amazon Web Services account to create the document classifier model in your Amazon Web Services account. (pattern: <code>arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]:[0-9]{12}:document-classifier/[a-zA-Z0-9](-[a-zA-Z0-9])(/version/[a-zA-Z0-9](-[a-zA-Z0-9])*)?</code>)
statusstringThe status of the document classifier. If the status is TRAINED the classifier is ready to use. If the status is TRAINED_WITH_WARNINGS the classifier training succeeded, but you should review the warnings returned in the CreateDocumentClassifier response. If the status is FAILED you can see additional information about why the classifier wasn't trained in the Message field. (SUBMITTED, TRAINING, DELETING, STOP_REQUESTED, STOPPED, IN_ERROR, TRAINED, TRAINED_WITH_WARNING)
submit_timestring (date-time)The time that the document classifier was submitted for training.
training_end_timestring (date-time)The time that training of the document classifier was completed. Indicates the time when the training completes on documentation classifiers. You are billed for the time interval between this time and the value of TrainingStartTime.
training_start_timestring (date-time)Indicates the time when the training starts on documentation classifiers. You are billed for the time interval between this time and the value of TrainingEndTime.
version_namestringThe version name that you assigned to the document classifier. (pattern: <code>^[a-zA-Z0-9](-[a-zA-Z0-9])$</code>)
volume_kms_key_idstringID for the Amazon Web Services Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats: KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab" Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" (pattern: <code>^\p{ASCII}+$</code>)
vpc_configobjectConfiguration parameters for an optional private Virtual Private Cloud (VPC) containing the resources you are using for the job. For more information, see Amazon VPC.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_document_classifierselectregionGets the properties associated with a document classifier.
list_document_classifiersselectregionGets a list of the document classifiers that you have created.
create_document_classifierinsertregion, DocumentClassifierName, DataAccessRoleArn, InputDataConfig, LanguageCodeCreates a new document classifier that you can use to categorize documents. To create a classifier, you provide a set of training documents that are labeled with the categories that you want to use. For more information, see Training classifier models in the Comprehend Developer Guide.
delete_document_classifierdeleteregionDeletes a previously created document classifier Only those classifiers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference job is using the model, a ResourceInUseException will be returned. This is an asynchronous action that puts the classifier into a DELETING state, and it is then removed by a background job. Once removed, the classifier disappears from your account and is no longer available for use.
stop_training_document_classifierexecregion, DocumentClassifierArnStops a document classifier training job while in progress. If the training job state is TRAINING, the job is marked for termination and put into the STOP_REQUESTED state. If the training job completes before it can be stopped, it is put into the TRAINED; otherwise the training job is stopped and put into the STOPPED state and the service sends back an HTTP 200 response with an empty HTTP body.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Gets the properties associated with a document classifier.

SELECT
classifier_metadata,
data_access_role_arn,
document_classifier_arn,
end_time,
flywheel_arn,
input_data_config,
language_code,
message,
mode,
model_kms_key_id,
output_data_config,
source_model_arn,
status,
submit_time,
training_end_time,
training_start_time,
version_name,
volume_kms_key_id,
vpc_config
FROM aws.comprehend.document_classifiers
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new document classifier that you can use to categorize documents. To create a classifier, you provide a set of training documents that are labeled with the categories that you want to use. For more information, see Training classifier models in the Comprehend Developer Guide.

INSERT INTO aws.comprehend.document_classifiers (
DocumentClassifierName,
VersionName,
DataAccessRoleArn,
Tags,
InputDataConfig,
OutputDataConfig,
ClientRequestToken,
LanguageCode,
VolumeKmsKeyId,
VpcConfig,
Mode,
ModelKmsKeyId,
ModelPolicy,
region
)
SELECT
'{{ DocumentClassifierName }}' /* required */,
'{{ VersionName }}',
'{{ DataAccessRoleArn }}' /* required */,
'{{ Tags }}',
'{{ InputDataConfig }}' /* required */,
'{{ OutputDataConfig }}',
'{{ ClientRequestToken }}',
'{{ LanguageCode }}' /* required */,
'{{ VolumeKmsKeyId }}',
'{{ VpcConfig }}',
'{{ Mode }}',
'{{ ModelKmsKeyId }}',
'{{ ModelPolicy }}',
'{{ region }}'
RETURNING
document_classifier_arn
;

DELETE examples

Deletes a previously created document classifier Only those classifiers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference job is using the model, a ResourceInUseException will be returned. This is an asynchronous action that puts the classifier into a DELETING state, and it is then removed by a background job. Once removed, the classifier disappears from your account and is no longer available for use.

DELETE FROM aws.comprehend.document_classifiers
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Stops a document classifier training job while in progress. If the training job state is TRAINING, the job is marked for termination and put into the STOP_REQUESTED state. If the training job completes before it can be stopped, it is put into the TRAINED; otherwise the training job is stopped and put into the STOPPED state and the service sends back an HTTP 200 response with an empty HTTP body.

EXEC aws.comprehend.document_classifiers.stop_training_document_classifier
@region='{{ region }}' --required
@@json=
'{
"DocumentClassifierArn": "{{ DocumentClassifierArn }}"
}'
;