Method: projects.locations.models.predict

Perform an online prediction. The prediction result will be directly returned in the response.

You can call the predict method on a row with column values that match the columns of your model. The data for your row can be up to 5MB.

See Making a prediction for more details.

HTTP request

POST https://automl.googleapis.com/v1beta1/{name}:predict

Path parameters

Parameters
name

string

Name of the model requested to serve the prediction.

Authorization requires the following Google IAM permission on the specified resource name:

  • automl.models.predict

Request body

The request body contains data with the following structure:

JSON representation
{
  "payload": {
    object (ExamplePayload)
  },
  "params": {
    string: string,
    ...
  }
}
Fields
payload

object (ExamplePayload)

Required. Payload to perform a prediction on. The payload must match the problem type that the model was trained to solve.

params

map (key: string, value: string)

Additional domain-specific parameters, any string must be up to 25000 characters long.

You can set the following fields:

See Making a prediction for more details.

Response body

If successful, the response body contains data with the following structure:

Response message for PredictionService.Predict.

JSON representation
{
  "payload": [
    {
      object (AnnotationPayload)
    }
  ],
  "metadata": {
    string: string,
    ...
  }
}
Fields
payload[]

object (AnnotationPayload)

Prediction result.

metadata

map (key: string, value: string)

Additional domain-specific prediction response metadata.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ExamplePayload

Example data used for training or prediction.

JSON representation
{

  // Union field payload can be only one of the following:
  "row": {
    object (Row)
  },
  "timeSeries": {
    object (TimeSeries)
  }
  // End of list of possible types for union field payload.
}
Fields
Union field payload. Required. Input only. The example data. payload can be only one of the following:
row

object (Row)

Example relational table row.

timeSeries

object (TimeSeries)

Time series example.

Row

A representation of a row in a relational table.

JSON representation
{
  "columnSpecIds": [
    string
  ],
  "values": [
    value
  ],
  "cells": {
    string: value,
    ...
  }
}
Fields
columnSpecIds[]
(deprecated)

string

Input Only. The resource IDs of the column specs describing the columns of the row. If set must contain, but possibly in a different order, all input feature

columnSpecIds of the Model this row is being passed to. Note: The below values field must match order of this field, if this field is set.

values[]
(deprecated)

value (Value format)

Input Only. The values of the row cells, given in the same order as the columnSpecIds, or, if not set, then in the same order as input feature

columnSpecs of the Model this row is being passed to.

cells

map (key: string, value: value (Value format))

Works for input and is always populated in output. A map from columnSpecId to the values of the corresponding cell in the row. It must contain all columnSpecId in Model's

inputFeatureColumnSpecs. Should be empty if columnSpecIds or values are not empty.

TimeSeries

Represents a time series.

JSON representation
{
  "row": {
    object (Row)
  },
  "historicalRows": [
    {
      object (Row)
    }
  ]
}
Fields
row

object (Row)

Required. To be predicted row in the time series.

historicalRows[]

object (Row)

Required in predict. Historical data in the time series.

AnnotationPayload

Contains annotation information that is relevant to AutoML.

JSON representation
{
  "annotationSpecId": string,
  "displayName": string,

  // Union field detail can be only one of the following:
  "classification": {
    object (ClassificationAnnotation)
  },
  "tables": {
    object (TablesAnnotation)
  }
  // End of list of possible types for union field detail.
}
Fields
annotationSpecId

string

Output only . The resource ID of the annotation spec that this annotation pertains to. The annotation spec comes from either an ancestor dataset, or the dataset that was used to train the model in use.

displayName

string

Output only. The value of displayName when the model was trained. Because this field returns a value at model training time, for different models trained using the same dataset, the returned value could be different as model owner could update the displayName between any two model training.

Union field detail. Output only . Additional information about the annotation specific to the AutoML domain. detail can be only one of the following:
classification

object (ClassificationAnnotation)

Annotation details for classification predictions.

tables

object (TablesAnnotation)

Annotation details for Tables.

ClassificationAnnotation

Contains annotation details specific to classification.

JSON representation
{
  "score": number
}
Fields
score

number

Output only. A confidence estimate between 0.0 and 1.0. A higher value means greater confidence that the annotation is positive. If a user approves an annotation as negative or positive, the score value remains unchanged. If a user creates an annotation, the score is 0 for negative or 1 for positive.

TablesAnnotation

Contains annotation details specific to Tables.

JSON representation
{
  "score": number,
  "predictionInterval": {
    object (DoubleRange)
  },
  "value": value,
  "tablesModelColumnInfo": [
    {
      object (TablesModelColumnInfo)
    }
  ]
}
Fields
score

number

Output only. A confidence estimate between 0.0 and 1.0, inclusive. A higher value means greater confidence in the returned value. For

targetColumnSpec of FLOAT64 data type the score is not populated.

predictionInterval

object (DoubleRange)

Output only. Only populated when

targetColumnSpec has FLOAT64 data type. An interval in which the exactly correct target value has 95% chance to be in.

value

value (Value format)

The predicted value of the row's

target_column. The value depends on the column's DataType:

  • CATEGORY - the predicted (with the above confidence score) CATEGORY value.

  • FLOAT64 - the predicted (with above predictionInterval) FLOAT64 value.

tablesModelColumnInfo[]

object (TablesModelColumnInfo)

Output only. Auxiliary information for each of the model's

inputFeatureColumnSpecs with respect to this particular prediction. If no other fields than

columnSpecName and

columnDisplayName would be populated, then this whole field is not.

DoubleRange

A range between two double numbers.

JSON representation
{
  "start": number,
  "end": number
}
Fields
start

number

Start of the range, inclusive.

end

number

End of the range, exclusive.

هل كانت هذه الصفحة مفيدة؟ يرجى تقييم أدائنا:

إرسال تعليقات حول...