Trains a new processor version. Operation metadata is returned as TrainProcessorVersionMetadata.

Scopes

You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: documentai1 --scope <scope> projects locations-processors-processor-versions-train ...

Required Scalar Argument

  • <parent> (string)
    • Required. The parent (project, location and processor) to create the new version for. Format: projects/{project}/locations/{location}/processors/{processor}.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

GoogleCloudDocumentaiV1TrainProcessorVersionRequest:
  base-processor-version: string
  custom-document-extraction-options:
    training-method: string
  document-schema:
    description: string
    display-name: string
    metadata:
      document-allow-multiple-labels: boolean
      document-splitter: boolean
      prefixed-naming-on-properties: boolean
      skip-naming-validation: boolean
  input-data:
    test-documents:
      gcs-prefix:
        gcs-uri-prefix: string
    training-documents:
      gcs-prefix:
        gcs-uri-prefix: string
  processor-version:
    create-time: string
    deprecation-info:
      deprecation-time: string
      replacement-processor-version: string
    display-name: string
    document-schema:
      description: string
      display-name: string
      metadata:
        document-allow-multiple-labels: boolean
        document-splitter: boolean
        prefixed-naming-on-properties: boolean
        skip-naming-validation: boolean
    google-managed: boolean
    kms-key-name: string
    kms-key-version-name: string
    latest-evaluation:
      aggregate-metrics:
        f1-score: number
        false-negatives-count: integer
        false-positives-count: integer
        ground-truth-document-count: integer
        ground-truth-occurrences-count: integer
        precision: number
        predicted-document-count: integer
        predicted-occurrences-count: integer
        recall: number
        total-documents-count: integer
        true-positives-count: integer
      aggregate-metrics-exact:
        f1-score: number
        false-negatives-count: integer
        false-positives-count: integer
        ground-truth-document-count: integer
        ground-truth-occurrences-count: integer
        precision: number
        predicted-document-count: integer
        predicted-occurrences-count: integer
        recall: number
        total-documents-count: integer
        true-positives-count: integer
      evaluation: string
      operation: string
    model-type: string
    name: string
    state: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . base-processor-version=magna
    • Optional. The processor version to use as a base for training. This processor version must be a child of parent. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}.
  • custom-document-extraction-options training-method=et

    • Training method to use for CDE training.
  • ..document-schema description=rebum.

    • Description of the schema.
  • display-name=dolor
    • Display name to show to users.
  • metadata document-allow-multiple-labels=false
    • If true, on a given page, there can be multiple document annotations covering it.
  • document-splitter=true
    • If true, a document entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).
  • prefixed-naming-on-properties=false
    • If set, all the nested entities must be prefixed with the parents.
  • skip-naming-validation=true

    • If set, we will skip the naming format validation in the schema. So the string values in DocumentSchema.EntityType.name and DocumentSchema.EntityType.Property.name will not be checked.
  • ...input-data.test-documents.gcs-prefix gcs-uri-prefix=kasd

    • The URI prefix.
  • ...training-documents.gcs-prefix gcs-uri-prefix=lorem

    • The URI prefix.
  • ....processor-version create-time=sanctus

    • The time the processor version was created.
  • deprecation-info deprecation-time=nonumy
    • The time at which this processor version will be deprecated.
  • replacement-processor-version=rebum.

    • If set, the processor version that will be used as a replacement.
  • .. display-name=tempor

    • The display name of the processor version.
  • document-schema description=dolore
    • Description of the schema.
  • display-name=eos
    • Display name to show to users.
  • metadata document-allow-multiple-labels=true
    • If true, on a given page, there can be multiple document annotations covering it.
  • document-splitter=false
    • If true, a document entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).
  • prefixed-naming-on-properties=false
    • If set, all the nested entities must be prefixed with the parents.
  • skip-naming-validation=true

    • If set, we will skip the naming format validation in the schema. So the string values in DocumentSchema.EntityType.name and DocumentSchema.EntityType.Property.name will not be checked.
  • ... google-managed=false

    • Output only. Denotes that this ProcessorVersion is managed by Google.
  • kms-key-name=duo
    • The KMS key name used for encryption.
  • kms-key-version-name=sadipscing
    • The KMS key version with which data is encrypted.
  • latest-evaluation.aggregate-metrics f1-score=0.11368392159787388
    • The calculated f1 score.
  • false-negatives-count=31
    • The amount of false negatives.
  • false-positives-count=38
    • The amount of false positives.
  • ground-truth-document-count=6
    • The amount of documents with a ground truth occurrence.
  • ground-truth-occurrences-count=62
    • The amount of occurrences in ground truth documents.
  • precision=0.790807870901993
    • The calculated precision.
  • predicted-document-count=27
    • The amount of documents with a predicted occurrence.
  • predicted-occurrences-count=45
    • The amount of occurrences in predicted documents.
  • recall=0.5349682891994094
    • The calculated recall.
  • total-documents-count=35
    • The amount of documents that had an occurrence of this label.
  • true-positives-count=74

    • The amount of true positives.
  • ..aggregate-metrics-exact f1-score=0.9692756317776717

    • The calculated f1 score.
  • false-negatives-count=87
    • The amount of false negatives.
  • false-positives-count=86
    • The amount of false positives.
  • ground-truth-document-count=19
    • The amount of documents with a ground truth occurrence.
  • ground-truth-occurrences-count=64
    • The amount of occurrences in ground truth documents.
  • precision=0.7703270434659568
    • The calculated precision.
  • predicted-document-count=85
    • The amount of documents with a predicted occurrence.
  • predicted-occurrences-count=82
    • The amount of occurrences in predicted documents.
  • recall=0.04322352738011259
    • The calculated recall.
  • total-documents-count=71
    • The amount of documents that had an occurrence of this label.
  • true-positives-count=63

    • The amount of true positives.
  • .. evaluation=clita

    • The resource name of the evaluation.
  • operation=dolor

    • The resource name of the Long Running Operation for the evaluation.
  • .. model-type=aliquyam

    • Output only. The model type of this processor version.
  • name=magna
    • The resource name of the processor version. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}
  • state=diam
    • The state of the processor version.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").