---
title: "POST /v1/{+endpoint}:explain"
method: POST
path: "/v1/{+endpoint}:explain"
tags: ["projects"]
---

# POST /v1/{+endpoint}:explain

`POST /v1/{+endpoint}:explain`

Perform an online explanation. If deployed_model_id is specified, the corresponding DeployModel must have explanation_spec populated. If deployed_model_id is not specified, all DeployedModels must have explanation_spec populated.

## Path parameters

- `endpoint` string, required

## Request body

- GoogleCloudAiplatformV1ExplainRequest — Request message for PredictionService.Explain.
  - `instances` unknown[] — 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' Model's PredictSchemata's instance_schema_uri.
    - unknown
  - `deployedModelId` string — If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding Endpoint.traffic_split.
  - `parameters` unknown
  - `explanationSpecOverride` GoogleCloudAiplatformV1ExplanationSpecOverride — The ExplanationSpec entries that can be overridden at online explanation time.
    - `metadata` GoogleCloudAiplatformV1ExplanationMetadataOverride — The ExplanationMetadata entries that can be overridden at online explanation time.
      - `inputs` object — Required. Overrides the input metadata of the features. The key is the name of the feature to be overridden. The keys specified here must exist in the input metadata to be overridden. If a feature is not specified here, the corresponding feature's input metadata is not overridden.
    - `examplesOverride` GoogleCloudAiplatformV1ExamplesOverride — Overrides for example-based explanations.
      - `crowdingCount` integer — The number of neighbors to return that have the same crowding tag.
      - `restrictions` GoogleCloudAiplatformV1ExamplesRestrictionsNamespace[] — Restrict the resulting nearest neighbors to respect these constraints.
        - `namespaceName` string — The namespace name.
        - `allow` string[] — The list of allowed tags.
        - `deny` string[] — The list of deny tags.
      - `returnEmbeddings` boolean — If true, return the embeddings instead of neighbors.
      - `dataFormat` 'DATA_FORMAT_UNSPECIFIED' | 'INSTANCES' | 'EMBEDDINGS' — The format of the data being provided with each call.
      - `neighborCount` integer — The number of neighbors to return.
    - `parameters` GoogleCloudAiplatformV1ExplanationParameters — Parameters to configure explaining for Model's predictions.
      - `outputIndices` unknown[] — If populated, only returns attributions that have output_index contained in output_indices. It must be an ndarray of integers, with the same shape of the output it's explaining. If not populated, returns attributions for top_k indices of outputs. If neither top_k nor output_indices is populated, returns the argmax index of the outputs. Only applicable to Models that predict multiple outputs (e,g, multi-class Models that predict multiple classes).
        - unknown
      - `xraiAttribution` GoogleCloudAiplatformV1XraiAttribution — An explanation method that redistributes Integrated Gradients attributions to segmented regions, taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1906.02825 Supported only by image Models.
        - `stepCount` integer — Required. The number of steps for approximating the path integral. A good value to start is 50 and gradually increase until the sum to diff property is met within the desired error range. Valid range of its value is [1, 100], inclusively.
        - `blurBaselineConfig` GoogleCloudAiplatformV1BlurBaselineConfig — Config for blur baseline. When enabled, a linear path from the maximally blurred image to the input image is created. Using a blurred baseline instead of zero (black image) is motivated by the BlurIG approach explained here: https://arxiv.org/abs/2004.03383
          - `maxBlurSigma` number, float — The standard deviation of the blur kernel for the blurred baseline. The same blurring parameter is used for both the height and the width dimension. If not set, the method defaults to the zero (i.e. black for images) baseline.
        - `smoothGradConfig` GoogleCloudAiplatformV1SmoothGradConfig — Config for SmoothGrad approximation of gradients. When enabled, the gradients are approximated by averaging the gradients from noisy samples in the vicinity of the inputs. Adding noise can help improve the computed gradients. Refer to this paper for more details: https://arxiv.org/pdf/1706.03825.pdf
          - `featureNoiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigma — Noise sigma by features. Noise sigma represents the standard deviation of the gaussian kernel that will be used to add noise to interpolated inputs prior to computing gradients.
            - `noiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature[] — Noise sigma per feature. No noise is added to features that are not set.
              - …
          - `noiseSigma` number, float — This is a single float value and will be used to add noise to all the features. Use this field when all features are normalized to have the same distribution: scale to range [0, 1], [-1, 1] or z-scoring, where features are normalized to have 0-mean and 1-variance. Learn more about [normalization](https://developers.google.com/machine-learning/data-prep/transform/normalization). For best results the recommended value is about 10% - 20% of the standard deviation of the input feature. Refer to section 3.2 of the SmoothGrad paper: https://arxiv.org/pdf/1706.03825.pdf. Defaults to 0.1. If the distribution is different per feature, set feature_noise_sigma instead for each feature.
          - `noisySampleCount` integer — The number of gradient samples to use for approximation. The higher this number, the more accurate the gradient is, but the runtime complexity increases by this factor as well. Valid range of its value is [1, 50]. Defaults to 3.
      - `examples` GoogleCloudAiplatformV1Examples — Example-based explainability that returns the nearest neighbors from the provided dataset.
        - `presets` GoogleCloudAiplatformV1Presets — Preset configuration for example-based explanations
          - `query` 'PRECISE' | 'FAST' — Preset option controlling parameters for speed-precision trade-off when querying for examples. If omitted, defaults to `PRECISE`.
          - `modality` 'MODALITY_UNSPECIFIED' | 'IMAGE' | 'TEXT' | 'TABULAR' — The modality of the uploaded model, which automatically configures the distance measurement and feature normalization for the underlying example index and queries. If your model does not precisely fit one of these types, it is okay to choose the closest type.
        - `neighborCount` integer — The number of neighbors to return when querying for examples.
        - `exampleGcsSource` GoogleCloudAiplatformV1ExamplesExampleGcsSource — The Cloud Storage input instances.
          - `gcsSource` GoogleCloudAiplatformV1GcsSource — The Google Cloud Storage location for the input content.
            - `uris` string[] — Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards.
          - `dataFormat` 'DATA_FORMAT_UNSPECIFIED' | 'JSONL' — The format in which instances are given, if not specified, assume it's JSONL format. Currently only JSONL format is supported.
        - `nearestNeighborSearchConfig` unknown
      - `topK` integer — If populated, returns attributions for top K indices of outputs (defaults to 1). Only applies to Models that predicts more than one outputs (e,g, multi-class Models). When set to -1, returns explanations for all outputs.
      - `sampledShapleyAttribution` GoogleCloudAiplatformV1SampledShapleyAttribution — An attribution method that approximates Shapley values for features that contribute to the label being predicted. A sampling strategy is used to approximate the value rather than considering all subsets of features.
        - `pathCount` integer — Required. The number of feature permutations to consider when approximating the Shapley values. Valid range of its value is [1, 50], inclusively.
      - `integratedGradientsAttribution` GoogleCloudAiplatformV1IntegratedGradientsAttribution — An attribution method that computes the Aumann-Shapley value taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1703.01365
        - `smoothGradConfig` GoogleCloudAiplatformV1SmoothGradConfig — Config for SmoothGrad approximation of gradients. When enabled, the gradients are approximated by averaging the gradients from noisy samples in the vicinity of the inputs. Adding noise can help improve the computed gradients. Refer to this paper for more details: https://arxiv.org/pdf/1706.03825.pdf
          - `featureNoiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigma — Noise sigma by features. Noise sigma represents the standard deviation of the gaussian kernel that will be used to add noise to interpolated inputs prior to computing gradients.
            - `noiseSigma` GoogleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature[] — Noise sigma per feature. No noise is added to features that are not set.
              - …
          - `noiseSigma` number, float — This is a single float value and will be used to add noise to all the features. Use this field when all features are normalized to have the same distribution: scale to range [0, 1], [-1, 1] or z-scoring, where features are normalized to have 0-mean and 1-variance. Learn more about [normalization](https://developers.google.com/machine-learning/data-prep/transform/normalization). For best results the recommended value is about 10% - 20% of the standard deviation of the input feature. Refer to section 3.2 of the SmoothGrad paper: https://arxiv.org/pdf/1706.03825.pdf. Defaults to 0.1. If the distribution is different per feature, set feature_noise_sigma instead for each feature.
          - `noisySampleCount` integer — The number of gradient samples to use for approximation. The higher this number, the more accurate the gradient is, but the runtime complexity increases by this factor as well. Valid range of its value is [1, 50]. Defaults to 3.
        - `stepCount` integer — Required. The number of steps for approximating the path integral. A good value to start is 50 and gradually increase until the sum to diff property is within the desired error range. Valid range of its value is [1, 100], inclusively.
        - `blurBaselineConfig` GoogleCloudAiplatformV1BlurBaselineConfig — Config for blur baseline. When enabled, a linear path from the maximally blurred image to the input image is created. Using a blurred baseline instead of zero (black image) is motivated by the BlurIG approach explained here: https://arxiv.org/abs/2004.03383
          - `maxBlurSigma` number, float — The standard deviation of the blur kernel for the blurred baseline. The same blurring parameter is used for both the height and the width dimension. If not set, the method defaults to the zero (i.e. black for images) baseline.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/aiplatform.md) · [All operations](https://skmtc.net/google/apis/aiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/aiplatform/versions/b608d71b91f0/schema)
