Explainability REST API Guide
Parse slice query data
POST /v3/slice-query/parse HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 66
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"query": "text"
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"environment_name": "text",
"is_prod": true,
"is_slice": true,
"model_name": "text",
"table_name": "text"
}
}
Fetch slice query data
POST /v3/slice-query/fetch HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 112
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"query": "text",
"sample": true,
"max_rows": 1,
"columns": [
"text"
]
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"metadata": {
"is_slice": true,
"columns": [
"text"
],
"dtypes": [
"text"
],
"env": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "PRE_PRODUCTION",
"name": "text"
},
"model": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"version": "text"
}
},
"rows": [
[]
]
}
}
Get feature impact for the given environment or a slice query
Feature Impact api request body
Feature Impact api data sources
Unique ID of model.
Number of reference points used in the explanations. Only for non text inputs
The maximum number of ablated model inferences per feature. Only for non text inputs
The confidence interval level (between 0 and 1) to use for all confidence intervals computed. Only for non text inputs
Specify a minimum support to retrieve top words. Only for Text data (NLP models)
Only used for NLP (TEXT inputs) models. Output column names to compute feature impact on. If None, use all.
environment to use for the reference dataset.
POST /v3/analytics/feature-impact HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 326
{
"data_source": {
"source_type": "ENVIRONMENT",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "PRE_PRODUCTION",
"num_samples": 1
},
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1,
"min_support": 1,
"output_columns": [
"text"
],
"ref_env_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"response_type": "FEATURE_IMPACT_TEXT",
"model_task": "text",
"model_input_type": "text",
"output_name": "sentiment",
"tokens": {},
"min_support": 15,
"num_inputs": 200,
"env_name": "bank_churn",
"env_uuid": "bcb8e333-39d1-4ba5-a485-dec1591f7122",
"created_at": "2023-12-12 18:21:07.616438+00:00"
}
}
Get feature importance for the given environment or a slice query
Number of reference points used in the explanations
The maximum number of ablated model inferences per feature
The confidence interval level (between 0 and 1) to use for all confidence intervals computed
environment to use for the reference dataset.
POST /v3/analytics/feature-importance HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 284
{
"data_source": {
"source_type": "ENVIRONMENT",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "PRE_PRODUCTION",
"num_samples": 1
},
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1,
"ref_env_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"model_task": "text",
"model_input_type": "text",
"total_input_samples": 10000,
"valid_input_samples": 9000,
"ci_level": 0.9,
"feature_names": [
"CreditScore",
"Geography",
"Age"
],
"fixed_sample_ci": [
0.04,
0.002,
0.1
],
"loss": "pointwise_logloss",
"mean_loss": 2.41122,
"mean_loss_ci": 0.0434,
"mean_loss_increase_importance": [
-0.0581,
-0.097,
-0.0707
],
"num_refs": 500,
"random_sample_ci": [
0.024,
0.0204,
0.0246
],
"num_inputs": 250,
"num_iterations": 200,
"env_name": "bank_churn",
"env_uuid": "bcb8e333-39d1-4ba5-a485-dec1591f7122",
"created_at": "2023-12-12 18:21:07.616438+00:00"
}
}
Get model scores for the given environment or a slice query
Model uuid
Threshold for binary classification models
Top K for ranking models
POST /v3/analytics/scores HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 236
{
"data_source": {
"source_type": "ENVIRONMENT",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "PRE_PRODUCTION",
"num_samples": 1
},
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"binary_threshold": 1,
"top_k": 1,
"metrics": [
"AUC"
]
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"model_task": "REGRESSION",
"total_samples": 10000,
"valid_samples": 9500,
"r_squared": 0.6934094625050112,
"root_mean_squared_error": 0.43712324037225403,
"mean_absolute_error": 0.34032740270302,
"predictions": [
6.346766948699951,
5.74676698811151
],
"targets": [
6,
5
],
"error_distribution": {
"count": [
2,
6
],
"bins": [
0,
1,
2
]
}
}
}
Compute and update cached feature impact on an environment
Request body for precompute feature impact
Unique identifier for model.
Unique identifier for environment.
Type of environment. Either PRE_PRODUCTION or PRODUCTION.
Number of reference points used in the explanations
The maximum number of ablated model inferences per feature
The confidence interval level (between 0 and 1) to use for all confidence intervals computed
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.
PUT /v3/analytics/precompute-feature-impact HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 178
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "text",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1,
"min_support": 1
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"job": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
}
}
}
Compute and cache feature impact on an environment
Request body for precompute feature impact
Unique identifier for model.
Unique identifier for environment.
Type of environment. Either PRE_PRODUCTION or PRODUCTION.
Number of reference points used in the explanations
The maximum number of ablated model inferences per feature
The confidence interval level (between 0 and 1) to use for all confidence intervals computed
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.
POST /v3/analytics/precompute-feature-impact HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 178
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "text",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1,
"min_support": 1
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"job": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
}
}
}
Get precomputed feature impact for a model
Unique identifier for the model.
POST /v3/analytics/feature-impact/precomputed HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 51
{
"model_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"response_type": "FEATURE_IMPACT_TEXT",
"model_task": "text",
"model_input_type": "text",
"output_name": "sentiment",
"tokens": {},
"min_support": 15,
"num_inputs": 200,
"env_name": "bank_churn",
"env_uuid": "bcb8e333-39d1-4ba5-a485-dec1591f7122",
"created_at": "2023-12-12 18:21:07.616438+00:00"
}
}
Compute and update cached feature importance on an environment
Number of reference points used in the explanations
The maximum number of ablated model inferences per feature
The confidence interval level (between 0 and 1) to use for all confidence intervals computed
PUT /v3/analytics/precompute-feature-importance HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 162
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "text",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"job": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
}
}
}
Compute and cache feature importance on an environment
Number of reference points used in the explanations
The maximum number of ablated model inferences per feature
The confidence interval level (between 0 and 1) to use for all confidence intervals computed
POST /v3/analytics/precompute-feature-importance HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 162
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"env_id": "123e4567-e89b-12d3-a456-426614174000",
"env_type": "text",
"num_refs": 1,
"num_iterations": 1,
"ci_level": 1
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"job": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
}
}
}
Get precomputed feature importance for a model
Unique identifier for model.
POST /v3/analytics/feature-importance/precomputed HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 51
{
"model_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"model_task": "text",
"model_input_type": "text",
"total_input_samples": 10000,
"valid_input_samples": 9000,
"ci_level": 0.9,
"feature_names": [
"CreditScore",
"Geography",
"Age"
],
"fixed_sample_ci": [
0.04,
0.002,
0.1
],
"loss": "pointwise_logloss",
"mean_loss": 2.41122,
"mean_loss_ci": 0.0434,
"mean_loss_increase_importance": [
-0.0581,
-0.097,
-0.0707
],
"num_refs": 500,
"random_sample_ci": [
0.024,
0.0204,
0.0246
],
"num_inputs": 250,
"num_iterations": 200,
"env_name": "bank_churn",
"env_uuid": "bcb8e333-39d1-4ba5-a485-dec1591f7122",
"created_at": "2023-12-12 18:21:07.616438+00:00"
}
}
Get predictions from a model
{"CreditScore":619,"Geography":"France","Gender":"Female","Age":42,"Tenure":2,"Balance":0,"NumOfProducts":1,"HasCrCard":"Yes","IsActiveMember":"Yes","EstimatedSalary":101348.88}
POST /v3/predict HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 253
{
"model_id": "123e4567-e89b-12d3-a456-426614174000",
"chunk_size": 1,
"data": [
{
"CreditScore": 619,
"Geography": "France",
"Gender": "Female",
"Age": 42,
"Tenure": 2,
"Balance": 0,
"NumOfProducts": 1,
"HasCrCard": "Yes",
"IsActiveMember": "Yes",
"EstimatedSalary": 101348.88
}
]
}
{
"api_version": "3.0",
"kind": "NORMAL",
"data": {
"predictions": [
{
"probability_christian": 0.706
}
]
}
}
Last updated
Was this helpful?