Class: Google::Cloud::AutoML::V1beta1::BatchPredictInputConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb

Overview

Input configuration for BatchPredict Action.

The format of input depends on the ML problem of the model used for prediction. As input source the gcs_source is expected, unless specified otherwise.

The formats are represented in EBNF with commas being literal and with non-terminal symbols defined near the end of this comment. The formats are:

  • For Video Classification: CSV file(s) with each line in format: GCS_FILE_PATH,TIME_SEGMENT_START,TIME_SEGMENT_END GCS_FILE_PATH leads to video of up to 50GB in size and up to 3h duration. Supported extensions: .MOV, .MPEG4, .MP4, .AVI. TIME_SEGMENT_START and TIME_SEGMENT_END must be within the length of the video, and end has to be after the start. Three sample rows: gs://folder/video1.mp4,10,40 gs://folder/video1.mp4,20,60 gs://folder/vid2.mov,0,inf

  • For Video Object Tracking: CSV file(s) with each line in format: GCS_FILE_PATH,TIME_SEGMENT_START,TIME_SEGMENT_END GCS_FILE_PATH leads to video of up to 50GB in size and up to 3h duration. Supported extensions: .MOV, .MPEG4, .MP4, .AVI. TIME_SEGMENT_START and TIME_SEGMENT_END must be within the length of the video, and end has to be after the start. Three sample rows: gs://folder/video1.mp4,10,240 gs://folder/video1.mp4,300,360 gs://folder/vid2.mov,0,inf

  • For Text Extraction .JSONL (i.e. JSON Lines) file(s) which either provide text in-line or as documents (for a single BatchPredict call only one of the these formats may be used). The in-line .JSONL file(s) contain per line a proto that wraps a temporary user-assigned TextSnippet ID (string up to 2000 characters long) called "id", a TextSnippet proto (in json representation) and zero or more TextFeature protos. Any given text snippet content must have 30,000 characters or less, and also be UTF-8 NFC encoded (ASCII already is). The IDs provided should be unique. The document .JSONL file(s) contain, per line, a proto that wraps a Document proto with input_config set. Only PDF documents are supported now, and each document must be up to 2MB large. Any given .JSONL file must be 100MB or smaller, and no more than 20 files may be given. Sample in-line JSON Lines file (presented here with artificial line breaks, but the only actual line break is denoted by \n): { "id": "my_first_id", "text_snippet": { "content": "dog car cat"}, "text_features": [ { "text_segment": 4, "end_offset": 6, "structural_type": PARAGRAPH, "bounding_poly": { "normalized_vertices": [ 0.1, "y": 0.1, 0.1, "y": 0.3, 0.3, "y": 0.3, 0.3, "y": 0.1, ] }, } ], }\n { "id": "2", "text_snippet": { "content": "An elaborate content", "mime_type": "text/plain" } } Sample document JSON Lines file (presented here with artificial line breaks, but the only actual line break is denoted by \n).: { "document": { "input_config": { "gcs_source": { "input_uris": [ "gs://folder/document1.pdf" ] } } } }\n { "document": { "input_config": { "gcs_source": { "input_uris": [ "gs://folder/document2.pdf" ] } } } }

  • For Tables: Either gcs_source or

bigquery_source. GCS case: CSV file(s), each by itself 10GB or smaller and total size must be 100GB or smaller, where first file must have a header containing column names. If the first row of a subsequent file is the same as the header, then it is also treated as a header. All other rows contain values for the corresponding columns. For all CLASSIFICATION and REGRESSION

prediction_type-s: The column names must contain the model's

input_feature_column_specs'

display_name-s (order doesn't matter). The columns corresponding to the model's input feature column specs must contain values compatible with the column spec's data types. Prediction on all the rows, i.e. the CSV lines, will be attempted. First three sample rows of a CSV file: "First Name","Last Name","Dob","Addresses"

"John","Doe","1968-01-22","["status":"current","address":"123_First_Avenue","city":"Seattle","state":"WA","zip":"11111","numberOfYears":"1","status":"previous","address":"456_Main_Street","city":"Portland","state":"OR","zip":"22222","numberOfYears":"5"]"

"Jane","Doe","1980-10-16","["status":"current","address":"789_Any_Avenue","city":"Albany","state":"NY","zip":"33333","numberOfYears":"2","status":"previous","address":"321_Main_Street","city":"Hoboken","state":"NJ","zip":"44444","numberOfYears":"3"]} For FORECASTING

prediction_type: The column names must contain the union of the model's

input_feature_column_specs'

display_name-s and

target_column_specs'

display_name (order doesn't matter), with values compatible with these column specs data types, except as specified below. The input rows must contain not only the to-be-predicted rows but also the historical data rows, even if they would be identical as the ones on which the model has been trained. The historical rows must have non-NULL target column values. The to-be-predicted rows must have NULL values in the target column and all columns having

TIME_SERIES_AVAILABLE_PAST_ONLY type, regardless if these columns are nullable. Prediction only on the to-be-predicted rows will be attempted. First four sample rows of a CSV file:

"Year","City","OlympicsThatYear","Population","WaterUsedGigaGallons" "2000","NYC","true","8008278","452.7" "2001","NYC","false","8024963","432.2" "2002","NYC","true","","" BigQuery case: An URI of a BigQuery table. The user data size of the BigQuery table must be 100GB or smaller. For all CLASSIFICATION and REGRESSION

prediction_type-s: The column names must contain the model's

input_feature_column_specs'

display_name-s (order doesn't matter). The columns corresponding to the model's input feature column specs must contain values compatible with the column spec's data types. Prediction on all the rows of the table will be attempted. For FORECASTING

prediction_type: The column names must contain the union of the model's

input_feature_column_specs'

display_name-s and

target_column_specs'

display_name (order doesn't matter), with values compatible with these column specs data types, except as specified below. The table's rows must contain not only the to-be-predicted rows but also the historical data rows, even if they would be identical as the ones on which the model has been trained. The historical rows must have non-NULL target column values. The to-be-predicted rows must have NULL values in the target column and all columns having

TIME_SERIES_AVAILABLE_PAST_ONLY type, regardless if these columns are nullable. Prediction only on the to-be-predicted rows will be attempted.

Definitions: GCS_FILE_PATH = A path to file on GCS, e.g. "gs://folder/video.avi". TIME_SEGMENT_START = TIME_OFFSET Expresses a beginning, inclusive, of a time segment within an example that has a time dimension (e.g. video). TIME_SEGMENT_END = TIME_OFFSET Expresses an end, exclusive, of a time segment within an example that has a time dimension (e.g. video). TIME_OFFSET = A number of seconds as measured from the start of an example (e.g. video). Fractions are allowed, up to a microsecond precision. "inf" is allowed and it means the end of the example.

Errors: If any of the provided CSV files can't be parsed or if more than certain percent of CSV rows cannot be processed then the operation fails and prediction does not happen. Regardless of overall success or failure the per-row failures, up to a certain count cap, will be listed in Operation.metadata.partial_failures.

Instance Attribute Summary collapse

Instance Attribute Details

#bigquery_sourceGoogle::Cloud::AutoML::V1beta1::BigQuerySource

Returns The BigQuery location for the input content.

Returns:



580
# File 'lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb', line 580

class BatchPredictInputConfig; end

#gcs_sourceGoogle::Cloud::AutoML::V1beta1::GcsSource

Returns The Google Cloud Storage location for the input content.

Returns:



580
# File 'lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb', line 580

class BatchPredictInputConfig; end