Perform an online explanation.
If deployedModelId
is specified, the corresponding endpoints.deployModel must have explanationSpec
populated. If deployedModelId
is not specified, all DeployedModels must have explanationSpec
populated.
HTTP request
POST https://{service-endpoint}/v1/{endpoint}:explain
Where {service-endpoint}
is one of the supported service endpoints.
Path parameters
Parameters | |
---|---|
endpoint |
Required. The name of the Endpoint requested to serve the explanation. Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"instances": [
value
],
"parameters": value,
"explanationSpecOverride": {
object ( |
Fields | |
---|---|
instances[] |
Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' |
parameters |
The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' |
explanationSpecOverride |
If specified, overrides the |
deployedModelId |
If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding |
Response body
Response message for PredictionService.Explain
.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"explanations": [
{
object ( |
Fields | |
---|---|
explanations[] |
The explanations of the Model's It has the same number of elements as |
deployedModelId |
id of the Endpoint's DeployedModel that served this explanation. |
predictions[] |
The predictions that are the output of the predictions call. Same as |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/cloud-vertex-ai.firstparty.predict
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the endpoint
resource:
aiplatform.endpoints.explain
For more information, see the IAM documentation.
ExplanationSpecOverride
The ExplanationSpec
entries that can be overridden at online explanation
time.
JSON representation |
---|
{ "parameters": { object ( |
Fields | |
---|---|
parameters |
The parameters to be overridden. Note that the attribution method cannot be changed. If not specified, no parameter is overridden. |
metadata |
The metadata to be overridden. If not specified, no metadata is overridden. |
examplesOverride |
The example-based explanations parameter overrides. |
ExplanationMetadataOverride
The ExplanationMetadata
entries that can be overridden at online explanation
time.
JSON representation |
---|
{
"inputs": {
string: {
object ( |
Fields | |
---|---|
inputs |
Required. Overrides the |
InputMetadataOverride
The input metadata
entries to be overridden.
JSON representation |
---|
{ "inputBaselines": [ value ] } |
Fields | |
---|---|
inputBaselines[] |
baseline inputs for this feature. This overrides the |
ExamplesOverride
Overrides for example-based explanations.
JSON representation |
---|
{ "neighborCount": integer, "crowdingCount": integer, "restrictions": [ { object ( |
Fields | |
---|---|
neighborCount |
The number of neighbors to return. |
crowdingCount |
The number of neighbors to return that have the same crowding tag. |
restrictions[] |
Restrict the resulting nearest neighbors to respect these constraints. |
returnEmbeddings |
If true, return the embeddings instead of neighbors. |
dataFormat |
The format of the data being provided with each call. |
ExamplesRestrictionsNamespace
Restrictions namespace for example-based explanations overrides.
JSON representation |
---|
{ "namespaceName": string, "allow": [ string ], "deny": [ string ] } |
Fields | |
---|---|
namespaceName |
The namespace name. |
allow[] |
The list of allowed tags. |
deny[] |
The list of deny tags. |
DataFormat
data format enum.
Enums | |
---|---|
DATA_FORMAT_UNSPECIFIED |
Unspecified format. Must not be used. |
INSTANCES |
Provided data is a set of model inputs. |
EMBEDDINGS |
Provided data is a set of embeddings. |