# Explainability REST API Guide

## Fetch slice query

> Parse slice query data

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"ParseSliceQueryRequestBody":{"type":"object","required":["model_id","query"],"properties":{"model_id":{"type":"string","format":"uuid"},"query":{"type":"string"}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"ParseSliceQueryResponseBody":{"type":"object","required":["environment_name","is_prod","is_slice","model_name","table_name"],"properties":{"environment_name":{"type":"string"},"is_prod":{"type":"boolean"},"is_slice":{"type":"boolean"},"model_name":{"type":"string"},"table_name":{"type":"string"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/slice-query/parse":{"post":{"tags":["explainability-v3"],"summary":"Fetch slice query","description":"Parse slice query data","operationId":"parseSliceQueryV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseSliceQueryRequestBody"}}}},"responses":{"200":{"description":"Successfully parsed slice query","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ParseSliceQueryResponseBody"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Fetch slice query

> Fetch slice query data

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"FetchSliceQueryRequestBody":{"type":"object","required":["model_id","query"],"properties":{"model_id":{"type":"string","format":"uuid"},"query":{"type":"string"},"sample":{"type":"boolean"},"max_rows":{"type":"integer","minimum":1,"maximum":10000},"columns":{"type":"array","items":{"type":"string"}}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"FetchSliceQueryResponse":{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/FetchSliceQueryResponseMetadata"},"rows":{"type":"array","items":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"object"},{"type":"number"}]}}}}},"FetchSliceQueryResponseMetadata":{"type":"object","properties":{"is_slice":{"type":"boolean"},"columns":{"type":"array","items":{"type":"string"}},"dtypes":{"type":"array","items":{"type":"string"}},"env":{"$ref":"#/components/schemas/EnvironmentCompact"},"model":{"$ref":"#/components/schemas/ModelCompact"}}},"EnvironmentCompact":{"type":"object","title":"EnvironmentCompact","description":"Compact version of an environment which can be included in the response of relevant APIs.\n","required":["id","type","name"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier of the environment.\n"},"type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"],"description":"Type of the environment (e.g., pre-production, production).\n"},"name":{"type":"string","description":"Name of the environment.\n"}}},"ModelCompact":{"type":"object","title":"ModelCompact","description":"Compact version of a model which can be included in the response of relevant APIs.\n","required":["id","name","version"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the model.\n"},"name":{"type":"string","description":"Name of the model.\n"},"version":{"type":"string","description":"Version of the model.\n"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/slice-query/fetch":{"post":{"tags":["explainability-v3"],"summary":"Fetch slice query","description":"Fetch slice query data","operationId":"fetchSliceQueryV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FetchSliceQueryRequestBody"}}}},"responses":{"200":{"description":"Slice query data fetch successful","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FetchSliceQueryResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Get feature impact

> Get feature impact for the given environment or a slice query

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"FeatureImpactRequestBody":{"type":"object","description":"Feature Impact api request body","required":["data_source","model_id"],"properties":{"data_source":{"$ref":"#/components/schemas/FeatureImpactDataSource"},"model_id":{"type":"string","format":"uuid","description":"Unique ID of model."},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations. Only for non text inputs","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*. Only for non text inputs","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed. Only for non text inputs","minimum":0,"maximum":1},"min_support":{"type":"integer","description":"Specify a minimum support to retrieve top words. Only for Text data (NLP models)","minimum":1},"output_columns":{"type":"array","items":{"type":"string"},"description":"Only used for NLP (TEXT inputs) models. Output column names to compute feature impact on. If None, use all."},"ref_env_id":{"type":"string","format":"uuid","description":"environment to use for the reference dataset."}}},"FeatureImpactDataSource":{"description":"Feature Impact api data sources","oneOf":[{"$ref":"#/components/schemas/FeatureImpactEnvDataSource"},{"$ref":"#/components/schemas/FeatureImpactSliceQueryDataSource"},{"$ref":"#/components/schemas/FeatureImpactFqlDataSource"}]},"FeatureImpactEnvDataSource":{"type":"object","description":"Feature Impact api dataset data source","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["ENVIRONMENT"],"description":"Environment data source type."},"env_id":{"type":"string","format":"uuid","description":"Unique identifier of environment."},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"],"description":"Type of environment. Either PRE_PRODUCTION or PRODUCTION."},"num_samples":{"type":"integer","description":"Number of input points explained.","minimum":1,"maximum":1000000}}},"FeatureImpactSliceQueryDataSource":{"type":"object","description":"Feature Impact api SQL slice query data source","required":["source_type","query"],"properties":{"source_type":{"type":"string","enum":["SQL_SLICE_QUERY"],"description":"Sql query data source type."},"query":{"type":"string","description":"SQL query"},"num_samples":{"type":"integer","description":"Number of input points explained.","minimum":1,"maximum":1000000}}},"FeatureImpactFqlDataSource":{"type":"object","description":"Feature Impact api FQL data source","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["FQL"],"description":"FQL data source type."},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"],"description":"Type of environment. Either PRE_PRODUCTION or PRODUCTION."},"env_id":{"type":"string","format":"uuid","description":"Unique identifier of environment."},"slice_definition":{"type":"string","description":"FQL definition."},"time_filter":{"$ref":"#/components/schemas/TimeFilter"},"num_samples":{"type":"integer","description":"Number of input points explained","minimum":1,"maximum":1000000}}},"TimeFilter":{"type":"object","properties":{"start_time":{"type":"string","description":"Start time string."},"end_time":{"type":"string","description":"End time string."},"time_zone":{"type":"string","description":"Time zone."}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"FeatureImpactResponse":{"description":"Feature Impact api response (text or tabular).","oneOf":[{"$ref":"#/components/schemas/FeatureImpactTextResponse"},{"$ref":"#/components/schemas/FeatureImpactTabularResponse"},{"$ref":"#/components/schemas/UploadFeatureImpactTabularResponse"}]},"FeatureImpactTextResponse":{"type":"object","description":"Feature Impact Text api response","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TEXT"]},"model_task":{"type":"string","description":"Task the model is designed to address."},"model_input_type":{"type":"string","description":"Input type of model."},"output_name":{"type":"string","description":"Name of the output."},"tokens":{"type":"object","description":"Table of delta-prob, support and Word"},"min_support":{"type":"integer","description":"Min support to retrieve top words."},"num_inputs":{"type":"integer","description":"Number of input points explained."},"env_name":{"type":"string","description":"Name of the environment."},"env_uuid":{"type":"string","description":"Unique identifier of environment."},"created_at":{"type":"string","description":"Created at time stamp."}}},"FeatureImpactTabularResponse":{"type":"object","description":"Feature Impact Tabular api response.","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TABULAR"]},"model_task":{"type":"string","description":"Task the model is designed to address."},"model_input_type":{"type":"string","description":"Input type of model."},"ci_level":{"type":"number","description":"The confidence level (between 0 and 1)."},"feature_names":{"type":"array","items":{"type":"string"},"description":"Names of the features as inferred from the points used in explanation."},"fixed_sample_ci":{"type":"array","items":{"type":"number"},"description":"Confidence interval when we consider our points fixed and only the ablation as random. If n_cycles == 1, this is None. This is a tuple with the ith entry corresponding to the feature impact fixed sample CI of the ith feature."},"num_inputs":{"type":"integer","description":"Number of input points explained."},"num_refs":{"type":"integer","description":"The number of points used as the reference sample."},"random_sample_ci":{"type":"array","items":{"type":"number"},"description":"Confidence interval when we consider our feature importance measure as an estimate of a single point sampled randomly. This is a tuple with the ith entry corresponding to the feature impact random sample CI of the ith feature."},"mean_abs_prediction_change_impact":{"type":"array","items":{"type":"number"},"description":"Feature impact as  measured by average absolute change in prediction when a given feature is randomly ablated. This is a tuple with the ith entry corresponding to the feature impact value of the ith feature."},"mean_prediction_ci":{"type":"number","description":"Random-sample CI for the mean prediction."},"mean_prediction":{"type":"number","description":"The mean prediction over the explained points."},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*."},"env_name":{"type":"string","description":"Name of the environment."},"env_uuid":{"type":"string","description":"Unique identifier of environment."},"created_at":{"type":"string","description":"Created at time stamp."},"feature_impact_scores":{"type":"array","items":{"type":"number"},"description":"A copy of mean_abs_prediction_change_impact. To maintain parity in keys for UI in precomputed endpoint."}}},"UploadFeatureImpactTabularResponse":{"type":"object","description":"Response for customer generated feature impacts for the given model.","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TABULAR_UPLOADED"]},"feature_names":{"type":"array","items":{"type":"string"},"description":"Names of the features as inferred from the points used in explanation."},"feature_impact_scores":{"type":"array","items":{"type":"number"},"description":"Directional(+ve or -ve) feature impact score as input by user."},"system_generated":{"type":"boolean","description":"Boolean flag identifier indicating that the feature impact was computed or user uploaded."}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/feature-impact":{"post":{"tags":["explainability-v3"],"summary":"Get feature impact","description":"Get feature impact for the given environment or a slice query","operationId":"featureImpactV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeatureImpactRequestBody"}}}},"responses":{"200":{"description":"Feature Impact ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeatureImpactResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Get feature importance

> Get feature importance for the given environment or a slice query

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"FeatureImportanceRequestBody":{"type":"object","required":["data_source","model_id"],"properties":{"data_source":{"$ref":"#/components/schemas/FeatureImportanceDataSource"},"model_id":{"type":"string","format":"uuid"},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed","minimum":0,"maximum":1},"ref_env_id":{"type":"string","format":"uuid","description":"environment to use for the reference dataset."}}},"FeatureImportanceDataSource":{"oneOf":[{"$ref":"#/components/schemas/FeatureImportanceEnvDataSource"},{"$ref":"#/components/schemas/FeatureImportanceSliceQueryDataSource"},{"$ref":"#/components/schemas/FeatureImpactFqlDataSource"}]},"FeatureImportanceEnvDataSource":{"type":"object","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["ENVIRONMENT"]},"env_id":{"type":"string","format":"uuid","description":"Env uuid"},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"]},"num_samples":{"type":"integer","description":"Number of input points explained","minimum":1,"maximum":1000000}}},"FeatureImportanceSliceQueryDataSource":{"type":"object","required":["source_type","query"],"properties":{"source_type":{"type":"string","enum":["SQL_SLICE_QUERY"]},"query":{"type":"string","description":"SQL query"},"num_samples":{"type":"integer","description":"Number of input points explained","minimum":1,"maximum":1000000}}},"FeatureImpactFqlDataSource":{"type":"object","description":"Feature Impact api FQL data source","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["FQL"],"description":"FQL data source type."},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"],"description":"Type of environment. Either PRE_PRODUCTION or PRODUCTION."},"env_id":{"type":"string","format":"uuid","description":"Unique identifier of environment."},"slice_definition":{"type":"string","description":"FQL definition."},"time_filter":{"$ref":"#/components/schemas/TimeFilter"},"num_samples":{"type":"integer","description":"Number of input points explained","minimum":1,"maximum":1000000}}},"TimeFilter":{"type":"object","properties":{"start_time":{"type":"string","description":"Start time string."},"end_time":{"type":"string","description":"End time string."},"time_zone":{"type":"string","description":"Time zone."}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"FeatureImportanceResponse":{"type":"object","properties":{"model_task":{"type":"string"},"model_input_type":{"type":"string"},"total_input_samples":{"type":"integer"},"valid_input_samples":{"type":"integer"},"ci_level":{"type":"number"},"feature_names":{"type":"array","items":{"type":"string"}},"fixed_sample_ci":{"type":"array","items":{"type":"number"}},"loss":{"type":"string"},"mean_loss":{"type":"number"},"mean_loss_ci":{"type":"number"},"mean_loss_increase_importance":{"type":"array","items":{"type":"number"}},"num_refs":{"type":"integer"},"random_sample_ci":{"type":"array","items":{"type":"number"}},"num_inputs":{"type":"integer"},"num_iterations":{"type":"integer"},"env_name":{"type":"string"},"env_uuid":{"type":"string"},"created_at":{"type":"string"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/feature-importance":{"post":{"tags":["explainability-v3"],"summary":"Get feature importance","description":"Get feature importance for the given environment or a slice query","operationId":"featureImportanceV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeatureImportanceRequestBody"}}}},"responses":{"200":{"description":"Feature Importance ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeatureImportanceResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Get model scores

> Get model scores for the given environment or a slice query

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"ScoreRequestBody":{"type":"object","required":["data_source","model_id"],"properties":{"data_source":{"$ref":"#/components/schemas/ScoresDataSource"},"model_id":{"type":"string","format":"uuid","description":"Model uuid"},"binary_threshold":{"type":"number","description":"Threshold for binary classification models","minimum":0,"maximum":1},"top_k":{"type":"integer","description":"Top K for ranking models","minimum":1,"maximum":500},"metrics":{"type":"array","items":{"type":"string","enum":["AUC","LOG_LOSS","F1_SCORE","ACCURACY","PRECISION","RECALL","CONFUSION_MATRIX","ROC_CURVE","PRECISION_RECALL_CURVE","CALIBRATION_CURVE","R2","RMSE","MAE","ERROR_DISTRIBUTION","PREDICTION_SCATTERPLOT","MAP","NDCG","TOP_K_MEAN_SCORE"]}}}},"ScoresDataSource":{"oneOf":[{"$ref":"#/components/schemas/ScoresEnvDataSource"},{"$ref":"#/components/schemas/ScoresSqlSliceQueryDataSource"},{"$ref":"#/components/schemas/ScoresFqlDataSource"}]},"ScoresEnvDataSource":{"type":"object","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["ENVIRONMENT"]},"env_id":{"type":"string","format":"uuid","description":"Env uuid"},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"]},"num_samples":{"type":"integer","description":"Max records to fetch for scoring","minimum":1,"maximum":500000}}},"ScoresSqlSliceQueryDataSource":{"type":"object","required":["source_type","query"],"properties":{"source_type":{"type":"string","enum":["SQL_SLICE_QUERY"]},"query":{"type":"string","description":"SQL query"},"num_samples":{"type":"integer","description":"Max records to fetch for scoring","minimum":1,"maximum":500000}}},"ScoresFqlDataSource":{"type":"object","required":["source_type","env_type"],"properties":{"source_type":{"type":"string","enum":["FQL"]},"env_type":{"type":"string","enum":["PRE_PRODUCTION","PRODUCTION"]},"env_id":{"nullable":true,"type":"string","format":"uuid","description":"Env uuid"},"slice_definition":{"type":"string","description":"Segment definition"},"segment_id":{"nullable":true,"type":"string","format":"uuid","description":"Segment uuid"},"time_filter":{"$ref":"#/components/schemas/TimeFilter"},"num_samples":{"type":"integer","description":"Max records to fetch for scoring","minimum":1,"maximum":500000}}},"TimeFilter":{"type":"object","properties":{"start_time":{"type":"string","description":"Start time string."},"end_time":{"type":"string","description":"End time string."},"time_zone":{"type":"string","description":"Time zone."}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"ScoresResponse":{"oneOf":[{"$ref":"#/components/schemas/ScoresRegressionResponse"},{"$ref":"#/components/schemas/ScoresBinaryClassificationResponse"},{"$ref":"#/components/schemas/ScoresMultiClassClassificationResponse"},{"$ref":"#/components/schemas/ScoresRankingResponse"}]},"ScoresRegressionResponse":{"type":"object","required":["model_task","total_samples","valid_samples","targets","predictions","error_distribution"],"properties":{"model_task":{"type":"string","enum":["REGRESSION"]},"total_samples":{"type":"integer"},"valid_samples":{"type":"integer"},"r_squared":{"type":"number"},"root_mean_squared_error":{"type":"number"},"mean_absolute_error":{"type":"number"},"predictions":{"type":"array","items":{"type":"number"}},"targets":{"type":"array","items":{"type":"number"}},"error_distribution":{"$ref":"#/components/schemas/ErrorDistribution"}}},"ErrorDistribution":{"type":"object","properties":{"count":{"type":"array","items":{"type":"integer"}},"bins":{"type":"array","items":{"type":"number"}}}},"ScoresBinaryClassificationResponse":{"type":"object","required":["model_task","total_samples","valid_samples"],"properties":{"model_task":{"type":"string","enum":["BINARY_CLASSIFICATION"]},"total_samples":{"type":"integer"},"valid_samples":{"type":"integer"},"auc":{"type":"number"},"log_loss":{"type":"number"},"f1_score":{"type":"number"},"accuracy":{"type":"number"},"precision":{"type":"number"},"recall":{"type":"number"},"confusion_matrix":{"$ref":"#/components/schemas/ConfusionMatrix"},"calibration_curve":{"$ref":"#/components/schemas/CalibrationCurve"},"precision_recall_curve":{"$ref":"#/components/schemas/PrecisionRecallCurve"},"roc_curve":{"$ref":"#/components/schemas/RocCurve"}}},"ConfusionMatrix":{"type":"object","properties":{"tp":{"type":"integer"},"tn":{"type":"integer"},"fp":{"type":"integer"},"fn":{"type":"integer"}}},"CalibrationCurve":{"type":"object","properties":{"fraction_of_positives":{"type":"array","items":{"type":"number"}},"mean_predicted_value":{"type":"array","items":{"type":"number"}}}},"PrecisionRecallCurve":{"type":"object","properties":{"precisions":{"type":"array","items":{"type":"number"}},"recalls":{"type":"array","items":{"type":"number"}},"thresholds":{"type":"array","items":{"type":"number"}}}},"RocCurve":{"type":"object","properties":{"fpr":{"type":"array","items":{"type":"number"}},"tpr":{"type":"array","items":{"type":"number"}},"thresholds":{"type":"array","items":{"type":"number"}}}},"ScoresMultiClassClassificationResponse":{"type":"object","required":["model_task","total_samples","valid_samples"],"properties":{"model_task":{"type":"string","enum":["MULTICLASS_CLASSIFICATION"]},"total_samples":{"type":"integer"},"valid_samples":{"type":"integer"},"accuracy":{"type":"number"},"f1_score":{"type":"number"},"log_loss":{"type":"number"},"confusion_matrix":{"$ref":"#/components/schemas/ConfusionMatrixMulticlass"}}},"ConfusionMatrixMulticlass":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"integer"}}},"ScoresRankingResponse":{"type":"object","required":["model_task","is_binary_ranking_model","total_samples","valid_samples"],"properties":{"model_task":{"type":"string","enum":["RANKING"]},"is_binary_ranking_model":{"type":"boolean"},"total_samples":{"type":"integer"},"valid_samples":{"type":"integer"},"map":{"type":"number"},"ndcg":{"type":"number"},"top_k_mean_score":{"$ref":"#/components/schemas/TopKMeanScore"}}},"TopKMeanScore":{"type":"object","properties":{"mean_scores":{"type":"array","items":{"type":"number"}},"targets":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"description":"Targets can be an array of strings or integers"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/scores":{"post":{"tags":["explainability-v3"],"summary":"Get model scores","description":"Get model scores for the given environment or a slice query","operationId":"scoresV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScoreRequestBody"}}}},"responses":{"200":{"description":"Scoring ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScoresResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Update precomputed feature impact

> Compute and update cached feature impact on an environment

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PrecomputeFeatureImpactRequestBody":{"type":"object","description":"Request body for precompute feature impact","required":["model_id","env_id","env_type"],"properties":{"model_id":{"type":"string","format":"uuid","description":"Unique identifier for model."},"env_id":{"type":"string","format":"uuid","description":"Unique identifier for environment."},"env_type":{"type":"string","description":"Type of environment. Either PRE_PRODUCTION or PRODUCTION."},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed","minimum":0,"maximum":1},"min_support":{"type":"integer","minimum":1,"description":"Used for TEXT models to specify a minimum support (number of times a specific work was present in the sample data) to retrieve top words. Default to 15."}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"JobCompact":{"type":"object","title":"JobCompact","description":"Compact version of a job which can be included in the response of relevant APIs.\n","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier of the job.\n"},"name":{"type":"string","description":"Name of the job.\n"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/precompute-feature-impact":{"put":{"tags":["explainability-v3"],"summary":"Update precomputed feature impact","description":"Compute and update cached feature impact on an environment","operationId":"updatePrecomputeFeatureImpactV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrecomputeFeatureImpactRequestBody"}}}},"responses":{"200":{"description":"Feature impact pre-computation update ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/JobCompact"}}}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Precompute feature impact

> Compute and cache feature impact on an environment

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PrecomputeFeatureImpactRequestBody":{"type":"object","description":"Request body for precompute feature impact","required":["model_id","env_id","env_type"],"properties":{"model_id":{"type":"string","format":"uuid","description":"Unique identifier for model."},"env_id":{"type":"string","format":"uuid","description":"Unique identifier for environment."},"env_type":{"type":"string","description":"Type of environment. Either PRE_PRODUCTION or PRODUCTION."},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed","minimum":0,"maximum":1},"min_support":{"type":"integer","minimum":1,"description":"Used for TEXT models to specify a minimum support (number of times a specific work was present in the sample data) to retrieve top words. Default to 15."}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"JobCompact":{"type":"object","title":"JobCompact","description":"Compact version of a job which can be included in the response of relevant APIs.\n","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier of the job.\n"},"name":{"type":"string","description":"Name of the job.\n"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/precompute-feature-impact":{"post":{"tags":["explainability-v3"],"summary":"Precompute feature impact","description":"Compute and cache feature impact on an environment","operationId":"precomputeFeatureImpactV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrecomputeFeatureImpactRequestBody"}}}},"responses":{"200":{"description":"Feature impact pre-computation ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/JobCompact"}}}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Get precomputed feature impact

> Get precomputed feature impact for a model

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"FeatureImpactResponse":{"description":"Feature Impact api response (text or tabular).","oneOf":[{"$ref":"#/components/schemas/FeatureImpactTextResponse"},{"$ref":"#/components/schemas/FeatureImpactTabularResponse"},{"$ref":"#/components/schemas/UploadFeatureImpactTabularResponse"}]},"FeatureImpactTextResponse":{"type":"object","description":"Feature Impact Text api response","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TEXT"]},"model_task":{"type":"string","description":"Task the model is designed to address."},"model_input_type":{"type":"string","description":"Input type of model."},"output_name":{"type":"string","description":"Name of the output."},"tokens":{"type":"object","description":"Table of delta-prob, support and Word"},"min_support":{"type":"integer","description":"Min support to retrieve top words."},"num_inputs":{"type":"integer","description":"Number of input points explained."},"env_name":{"type":"string","description":"Name of the environment."},"env_uuid":{"type":"string","description":"Unique identifier of environment."},"created_at":{"type":"string","description":"Created at time stamp."}}},"FeatureImpactTabularResponse":{"type":"object","description":"Feature Impact Tabular api response.","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TABULAR"]},"model_task":{"type":"string","description":"Task the model is designed to address."},"model_input_type":{"type":"string","description":"Input type of model."},"ci_level":{"type":"number","description":"The confidence level (between 0 and 1)."},"feature_names":{"type":"array","items":{"type":"string"},"description":"Names of the features as inferred from the points used in explanation."},"fixed_sample_ci":{"type":"array","items":{"type":"number"},"description":"Confidence interval when we consider our points fixed and only the ablation as random. If n_cycles == 1, this is None. This is a tuple with the ith entry corresponding to the feature impact fixed sample CI of the ith feature."},"num_inputs":{"type":"integer","description":"Number of input points explained."},"num_refs":{"type":"integer","description":"The number of points used as the reference sample."},"random_sample_ci":{"type":"array","items":{"type":"number"},"description":"Confidence interval when we consider our feature importance measure as an estimate of a single point sampled randomly. This is a tuple with the ith entry corresponding to the feature impact random sample CI of the ith feature."},"mean_abs_prediction_change_impact":{"type":"array","items":{"type":"number"},"description":"Feature impact as  measured by average absolute change in prediction when a given feature is randomly ablated. This is a tuple with the ith entry corresponding to the feature impact value of the ith feature."},"mean_prediction_ci":{"type":"number","description":"Random-sample CI for the mean prediction."},"mean_prediction":{"type":"number","description":"The mean prediction over the explained points."},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*."},"env_name":{"type":"string","description":"Name of the environment."},"env_uuid":{"type":"string","description":"Unique identifier of environment."},"created_at":{"type":"string","description":"Created at time stamp."},"feature_impact_scores":{"type":"array","items":{"type":"number"},"description":"A copy of mean_abs_prediction_change_impact. To maintain parity in keys for UI in precomputed endpoint."}}},"UploadFeatureImpactTabularResponse":{"type":"object","description":"Response for customer generated feature impacts for the given model.","properties":{"response_type":{"type":"string","enum":["FEATURE_IMPACT_TABULAR_UPLOADED"]},"feature_names":{"type":"array","items":{"type":"string"},"description":"Names of the features as inferred from the points used in explanation."},"feature_impact_scores":{"type":"array","items":{"type":"number"},"description":"Directional(+ve or -ve) feature impact score as input by user."},"system_generated":{"type":"boolean","description":"Boolean flag identifier indicating that the feature impact was computed or user uploaded."}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/feature-impact/precomputed":{"post":{"tags":["explainability-v3"],"summary":"Get precomputed feature impact","description":"Get precomputed feature impact for a model","operationId":"getPrecomputedFeatureImpactV3","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model_id":{"type":"string","format":"uuid","description":"Unique identifier for the model."}},"required":["model_id"]}}}},"responses":{"200":{"description":"Precomputed Feature impact retrieval ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeatureImpactResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Update precomputed feature importance

> Compute and update cached feature importance on an environment

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PrecomputeFeatureImportanceRequestBody":{"type":"object","required":["model_id","env_id","env_type"],"properties":{"model_id":{"type":"string","format":"uuid"},"env_id":{"type":"string","format":"uuid"},"env_type":{"type":"string"},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed","minimum":0,"maximum":1}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"JobCompact":{"type":"object","title":"JobCompact","description":"Compact version of a job which can be included in the response of relevant APIs.\n","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier of the job.\n"},"name":{"type":"string","description":"Name of the job.\n"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/precompute-feature-importance":{"put":{"tags":["explainability-v3"],"summary":"Update precomputed feature importance","description":"Compute and update cached feature importance on an environment","operationId":"updatePrecomputeFeatureImportanceV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrecomputeFeatureImportanceRequestBody"}}}},"responses":{"200":{"description":"Feature importance pre-computation update ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/JobCompact"}}}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Precompute feature importance

> Compute and cache feature importance on an environment

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PrecomputeFeatureImportanceRequestBody":{"type":"object","required":["model_id","env_id","env_type"],"properties":{"model_id":{"type":"string","format":"uuid"},"env_id":{"type":"string","format":"uuid"},"env_type":{"type":"string"},"num_refs":{"type":"integer","description":"Number of reference points used in the explanations","minimum":1,"maximum":1000000},"num_iterations":{"type":"integer","description":"The maximum number of ablated model inferences *per feature*","minimum":1,"maximum":100000},"ci_level":{"type":"number","description":"The confidence interval level (between 0 and 1) to use for all confidence intervals computed","minimum":0,"maximum":1}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"JobCompact":{"type":"object","title":"JobCompact","description":"Compact version of a job which can be included in the response of relevant APIs.\n","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier of the job.\n"},"name":{"type":"string","description":"Name of the job.\n"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/precompute-feature-importance":{"post":{"tags":["explainability-v3"],"summary":"Precompute feature importance","description":"Compute and cache feature importance on an environment","operationId":"precomputeFeatureImportanceV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrecomputeFeatureImportanceRequestBody"}}}},"responses":{"200":{"description":"Feature importance pre-computation ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/JobCompact"}}}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## Get precomputed feature importance

> Get precomputed feature importance for a model

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"FeatureImportanceResponse":{"type":"object","properties":{"model_task":{"type":"string"},"model_input_type":{"type":"string"},"total_input_samples":{"type":"integer"},"valid_input_samples":{"type":"integer"},"ci_level":{"type":"number"},"feature_names":{"type":"array","items":{"type":"string"}},"fixed_sample_ci":{"type":"array","items":{"type":"number"}},"loss":{"type":"string"},"mean_loss":{"type":"number"},"mean_loss_ci":{"type":"number"},"mean_loss_increase_importance":{"type":"array","items":{"type":"number"}},"num_refs":{"type":"integer"},"random_sample_ci":{"type":"array","items":{"type":"number"}},"num_inputs":{"type":"integer"},"num_iterations":{"type":"integer"},"env_name":{"type":"string"},"env_uuid":{"type":"string"},"created_at":{"type":"string"}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Server does not support this action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/analytics/feature-importance/precomputed":{"post":{"tags":["explainability-v3"],"summary":"Get precomputed feature importance","description":"Get precomputed feature importance for a model","operationId":"getPrecomputedFeatureImportanceV3","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model_id":{"type":"string","format":"uuid","description":"Unique identifier for model."}},"required":["model_id"]}}}},"responses":{"200":{"description":"Precomputed Feature importance retrieval ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeatureImportanceResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"},"501":{"$ref":"#/components/responses/501"}}}}}}
```

## POST /v3/predict

> Get predictions from a model

```json
{"openapi":"3.0.3","info":{"title":"Fiddler API - 2.0","version":"2.0"},"tags":[{"name":"explainability-v3"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PredictRequestBody":{"type":"object","required":["model_id","data"],"properties":{"model_id":{"type":"string","format":"uuid"},"chunk_size":{"type":"integer"},"data":{"type":"array","items":{"type":"object"}}}},"ApiResponse":{"type":"object","description":"Response object for standard API responses.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version.\n"},"kind":{"type":"string","default":"NORMAL","enum":["NORMAL"],"description":"Type of response, indicating a normal response.\n"}}},"PredictResponse":{"type":"object","properties":{"predictions":{"type":"array","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","description":"Response object for errors returned by the API.\n","properties":{"api_version":{"type":"string","default":"3.0","enum":["2.0","3.0"],"description":"API version of the response.\n"},"kind":{"type":"string","default":"ERROR","enum":["ERROR"],"description":"Type of response, usually indicating an error.\n"},"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Represents the code for this error, typically an HTTP response code.\n","default":400,"enum":[400,403,404,500]},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there are multiple errors, it will be the message for the first error.\n"},"errors":{"type":"array","description":"Container for additional information regarding the error, especially for multiple errors.\n","items":{"type":"object","properties":{"reason":{"type":"string","description":"Unique identifier for this error, different from the error code.\n"},"message":{"type":"string","description":"A human-readable message providing more details about the error. If there is only one error, this field will match error.message.\n"},"help":{"type":"string","description":"Link to support or documentation providing more information on the error.\n"}}}}}}}}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v3/predict":{"post":{"tags":["explainability-v3"],"description":"Get predictions from a model","operationId":"predictV3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictRequestBody"}}}},"responses":{"200":{"description":"Predictions ran successfully on the given data","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PredictResponse"}}}]}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fiddler.ai/api/rest-api/rest-api/explainability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
