Constructor
new PredictionServiceClient(optionsopt, gaxInstanceopt)
Construct an instance of PredictionServiceClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||
gaxInstance |
gax |
<optional> |
loaded instance of |
Members
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
annotationSpecPath(project, location, dataset, annotation_spec) → {string}
Return a fully-qualified annotationSpec resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
dataset |
string | |
annotation_spec |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
(async) checkBatchPredictProgress(name) → {Promise}
Check the status of the long running operation returned by batchPredict()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the model requested to serve the batch prediction.
*/
// const name = 'abc123'
/**
* Required. The input configuration for batch prediction.
*/
// const inputConfig = {}
/**
* Required. The Configuration specifying where output predictions should
* be written.
*/
// const outputConfig = {}
/**
* Required. Additional domain-specific parameters for the predictions, any string must
* be up to 25000 characters long.
* * For Text Classification:
* `score_threshold` - (float) A value from 0.0 to 1.0. When the model
* makes predictions for a text snippet, it will only produce results
* that have at least this confidence score. The default is 0.5.
* * For Image Classification:
* `score_threshold` - (float) A value from 0.0 to 1.0. When the model
* makes predictions for an image, it will only produce results that
* have at least this confidence score. The default is 0.5.
* * For Image Object Detection:
* `score_threshold` - (float) When Model detects objects on the image,
* it will only produce bounding boxes which have at least this
* confidence score. Value in 0 to 1 range, default is 0.5.
* `max_bounding_box_count` - (int64) No more than this number of bounding
* boxes will be produced per image. Default is 100, the
* requested value may be limited by server.
* * For Video Classification :
* `score_threshold` - (float) A value from 0.0 to 1.0. When the model
* makes predictions for a video, it will only produce results that
* have at least this confidence score. The default is 0.5.
* `segment_classification` - (boolean) Set to true to request
* segment-level classification. AutoML Video Intelligence returns
* labels and their confidence scores for the entire segment of the
* video that user specified in the request configuration.
* The default is "true".
* `shot_classification` - (boolean) Set to true to request shot-level
* classification. AutoML Video Intelligence determines the boundaries
* for each camera shot in the entire segment of the video that user
* specified in the request configuration. AutoML Video Intelligence
* then returns labels and their confidence scores for each detected
* shot, along with the start and end time of the shot.
* WARNING: Model evaluation is not done for this classification type,
* the quality of it depends on training data, but there are no metrics
* provided to describe that quality. The default is "false".
* `1s_interval_classification` - (boolean) Set to true to request
* classification for a video at one-second intervals. AutoML Video
* Intelligence returns labels and their confidence scores for each
* second of the entire segment of the video that user specified in the
* request configuration.
* WARNING: Model evaluation is not done for this classification
* type, the quality of it depends on training data, but there are no
* metrics provided to describe that quality. The default is
* "false".
* * For Tables:
* feature_imp<span>ortan</span>ce - (boolean) Whether feature importance
* should be populated in the returned TablesAnnotations. The
* default is false.
* * For Video Object Tracking:
* `score_threshold` - (float) When Model detects objects on video frames,
* it will only produce bounding boxes which have at least this
* confidence score. Value in 0 to 1 range, default is 0.5.
* `max_bounding_box_count` - (int64) No more than this number of bounding
* boxes will be returned per frame. Default is 100, the requested
* value may be limited by server.
* `min_bounding_box_size` - (float) Only bounding boxes with shortest edge
* at least that long as a relative value of video frame size will be
* returned. Value in 0 to 1 range. Default is 0.
*/
// const params = [1,2,3,4]
// Imports the Automl library
const {PredictionServiceClient} = require('@google-cloud/automl').v1beta1;
// Instantiates a client
const automlClient = new PredictionServiceClient();
async function callBatchPredict() {
// Construct request
const request = {
name,
inputConfig,
outputConfig,
params,
};
// Run request
const [operation] = await automlClient.batchPredict(request);
const [response] = await operation.promise();
console.log(response);
}
callBatchPredict();
close() → {Promise}
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves when the client is closed. |
columnSpecPath(project, location, dataset, table_spec, column_spec) → {string}
Return a fully-qualified columnSpec resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
dataset |
string | |
table_spec |
string | |
column_spec |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
datasetPath(project, location, dataset) → {string}
Return a fully-qualified dataset resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
dataset |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to an authenticated service stub. |
matchAnnotationSpecFromAnnotationSpecName(annotationSpecName) → {string}
Parse the annotation_spec from AnnotationSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
annotationSpecName |
string |
A fully-qualified path representing AnnotationSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the annotation_spec. |
matchColumnSpecFromColumnSpecName(columnSpecName) → {string}
Parse the column_spec from ColumnSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
columnSpecName |
string |
A fully-qualified path representing ColumnSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the column_spec. |
matchDatasetFromAnnotationSpecName(annotationSpecName) → {string}
Parse the dataset from AnnotationSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
annotationSpecName |
string |
A fully-qualified path representing AnnotationSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the dataset. |
matchDatasetFromColumnSpecName(columnSpecName) → {string}
Parse the dataset from ColumnSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
columnSpecName |
string |
A fully-qualified path representing ColumnSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the dataset. |
matchDatasetFromDatasetName(datasetName) → {string}
Parse the dataset from Dataset resource.
Parameters:
Name | Type | Description |
---|---|---|
datasetName |
string |
A fully-qualified path representing Dataset resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the dataset. |
matchDatasetFromTableSpecName(tableSpecName) → {string}
Parse the dataset from TableSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
tableSpecName |
string |
A fully-qualified path representing TableSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the dataset. |
matchLocationFromAnnotationSpecName(annotationSpecName) → {string}
Parse the location from AnnotationSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
annotationSpecName |
string |
A fully-qualified path representing AnnotationSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromColumnSpecName(columnSpecName) → {string}
Parse the location from ColumnSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
columnSpecName |
string |
A fully-qualified path representing ColumnSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromDatasetName(datasetName) → {string}
Parse the location from Dataset resource.
Parameters:
Name | Type | Description |
---|---|---|
datasetName |
string |
A fully-qualified path representing Dataset resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromModelEvaluationName(modelEvaluationName) → {string}
Parse the location from ModelEvaluation resource.
Parameters:
Name | Type | Description |
---|---|---|
modelEvaluationName |
string |
A fully-qualified path representing ModelEvaluation resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromModelName(modelName) → {string}
Parse the location from Model resource.
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string |
A fully-qualified path representing Model resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromTableSpecName(tableSpecName) → {string}
Parse the location from TableSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
tableSpecName |
string |
A fully-qualified path representing TableSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchModelEvaluationFromModelEvaluationName(modelEvaluationName) → {string}
Parse the model_evaluation from ModelEvaluation resource.
Parameters:
Name | Type | Description |
---|---|---|
modelEvaluationName |
string |
A fully-qualified path representing ModelEvaluation resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the model_evaluation. |
matchModelFromModelEvaluationName(modelEvaluationName) → {string}
Parse the model from ModelEvaluation resource.
Parameters:
Name | Type | Description |
---|---|---|
modelEvaluationName |
string |
A fully-qualified path representing ModelEvaluation resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the model. |
matchModelFromModelName(modelName) → {string}
Parse the model from Model resource.
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string |
A fully-qualified path representing Model resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the model. |
matchProjectFromAnnotationSpecName(annotationSpecName) → {string}
Parse the project from AnnotationSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
annotationSpecName |
string |
A fully-qualified path representing AnnotationSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromColumnSpecName(columnSpecName) → {string}
Parse the project from ColumnSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
columnSpecName |
string |
A fully-qualified path representing ColumnSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromDatasetName(datasetName) → {string}
Parse the project from Dataset resource.
Parameters:
Name | Type | Description |
---|---|---|
datasetName |
string |
A fully-qualified path representing Dataset resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromModelEvaluationName(modelEvaluationName) → {string}
Parse the project from ModelEvaluation resource.
Parameters:
Name | Type | Description |
---|---|---|
modelEvaluationName |
string |
A fully-qualified path representing ModelEvaluation resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromModelName(modelName) → {string}
Parse the project from Model resource.
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string |
A fully-qualified path representing Model resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromTableSpecName(tableSpecName) → {string}
Parse the project from TableSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
tableSpecName |
string |
A fully-qualified path representing TableSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchTableSpecFromColumnSpecName(columnSpecName) → {string}
Parse the table_spec from ColumnSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
columnSpecName |
string |
A fully-qualified path representing ColumnSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the table_spec. |
matchTableSpecFromTableSpecName(tableSpecName) → {string}
Parse the table_spec from TableSpec resource.
Parameters:
Name | Type | Description |
---|---|---|
tableSpecName |
string |
A fully-qualified path representing TableSpec resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the table_spec. |
modelEvaluationPath(project, location, model, model_evaluation) → {string}
Return a fully-qualified modelEvaluation resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
model |
string | |
model_evaluation |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
modelPath(project, location, model) → {string}
Return a fully-qualified model resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
model |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
tableSpecPath(project, location, dataset, table_spec) → {string}
Return a fully-qualified tableSpec resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
dataset |
string | |
table_spec |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |