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. Only deployed AutoML tabular Models have explanationSpec.
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
If successful, the response body contains data with the following structure:
Response message for PredictionService.Explain
.
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 the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
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 [method][google.cloud.aiplatform.v1.ExplanationParameters.method] cannot be changed. If not specified, no parameter is overridden. |
metadata |
The metadata to be overridden. If not specified, no metadata is overridden. |
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 |
Explanation
Explanation of a prediction (provided in PredictResponse.predictions
) produced by the Model on a given instance
.
JSON representation |
---|
{
"attributions": [
{
object ( |
Fields | |
---|---|
attributions[] |
Output only. Feature attributions grouped by predicted outputs. For Models that predict only one output, such as regression Models that predict only one score, there is only one attibution that explains the predicted output. For Models that predict multiple outputs, such as multiclass Models that predict multiple classes, each element explains one specific item. If users set |