---
sourceDocument: Brazil Enable AI
sourceDocumentLink: https://www.servicenow.com/docs/r/intelligent-experiences

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Enable AI

ft:clusterId :

    - platai

bundleId :

    - platai

workflow :

    - Platform


---

# Test time explainability

# Test time explainability {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Test time explainability

Test time explainability (TTE) is a feature for classification machine learning solutions in ServiceNow that provides transparency into why a specific prediction was made.
When enabled, every prediction is accompanied by an explanation that lists each input feature along with a contribution score, highlighting the strongest drivers behind that individual prediction.
Show full answer Show less  

## Key Features

* **Transparency:** Converts prediction scores into clear, confident decisions by showing feature impacts.
* **Accountability:** Each prediction includes a detailed record of factors influencing the result.
* **Faster troubleshooting:** Enables easier investigation of unexpected predictions by analyzing feature contributions.
* **Supported Models:** Works only with workflow classification solutions using the XGBoost classifier method.
* **Data Type Support:** Applies to nominal (categorical) and numeric input features. Text columns are excluded or can cause training failure if used exclusively.
* **API Integration:** TTE must be enabled both during training and prediction API calls by setting the relevant flags to true.

## Using Test time explainability

To enable TTE, set the `test-time-explainability` parameter to true during model training and set `testtimeexplainability` to true in prediction requests. When enabled, prediction responses include an explanation object showing:

* Model output values before and after feature contributions (`basevalue` and `prediction`).
* A list of input features (`allcontributors`) with their original values, encoded values, and SHAP contribution scores.

The SHAP values indicate the direction and strength of each feature's influence on the prediction, facilitating clear interpretation of model decisions.

## Practical Benefits for ServiceNow Customers

* Gain actionable insights by understanding which input features drive predictions in your classification models.
* Improve trust and compliance by providing transparent, explainable AI results for decision-making processes.
* Accelerate issue resolution by quickly identifying unexpected prediction causes through feature contribution scores.  
Understand the reasons your machine learning solution made a specific
prediction with Test time explainability, which returns a list of input features that influenced the prediction.

## Overview of Test time explainability {#predictive-intel-test-time-explain__section_sfm_swm_hkc}

When Test time explainability (TTE) is enabled on a classification solution, every prediction is accompanied by an explanation that lists each input feature along with a contribution score. Features with the largest contribution
scores are the strongest drivers of that individual prediction.

## Benefits of Test time explainability {#predictive-intel-test-time-explain__section_gy5_31l_jkc}

* Transparency: Explanations turn scores into confident decisions.
* Accountability: Each prediction comes with a per-decision record of the factors that combined to shape the result.
* Faster troubleshooting: Unexpected predictions are easier to investigate using the list of factors and their influence.
{#predictive-intel-test-time-explain__ul_xgq_l1l_jkc}

## Considerations for using Test time explainability {#predictive-intel-test-time-explain__section_nrp_lgl_jkc}

Be aware of the following considerations when using Test time explainability (TTE).

* TTE supports only workflow Classification solutions.
* TTE supports only the xgboost classifier method. Don't change the classifier_method when the TTE flag is enabled.
* TTE is turned off by default. You must set TTE to true during training and predicting.
* TTE can be applied to nominal (categorical) and numeric columns only, not text columns. If input features consist of a mix of text, nominal, and numeric columns, the text columns are dropped. If the input features consist of text columns only, the solution training fails.
{#predictive-intel-test-time-explain__ul_hy5_lhl_jkc}

## Invoking Test time explainability {#predictive-intel-test-time-explain__section_xzq_twm_hkc}

Test time explainability is set in two API calls: at the training stage, and at the prediction stage. When TTE is enabled, the prediction response includes an `explanation` object.  
The following code snippet shows an example of defining a classification solution for training. The parameter test-time-explainability is set to true (default is false).

    var mySolution = new sn_ml.ClassificationSolution({
        'label': 'telecom_customer_churn_with_tte',
        'dataset': myData,
        'predictedFieldName': 'churn',
        'inputFieldNames': [
            'age',
            'contract',
            'monthly_charge',
            'tenure_in_months',
            'online_security',
            'online_backup'
            // ... additional input fields
        ],
        'test-time-explainability': true
    });

The following code snippet shows an example of requesting explanations at prediction time, after the model has trained successfully. The option test_time_explainability is set to true (default is false).

    var input = new GlideRecord('u_telecom_customer_churn_train');
    input.get('07601c45ff9232107334ffffffffff38'); // record must not be empty

    var options = {};
    options.apply_threshold = "false";
    options.test_time_explainability = "true";
    options.top_n = 100;

    var solutionName = sn_ml.ClassificationSolutionStore.get(
        "ml_sn_global_global_telecom_customer_churn_with_tte"
    );
    var solutionVersion = solutionName.getLatestVersion();
    gs.info(solutionVersion.predict(input, options));

The following snippet shows an example of the explanation in JSON format (trimmed for readability).

    {
      "07601c45ff9232107334ffffffffff38": [
        {
          "confidence": 99.53,
          "threshold": 1.61,
          "predictedValue": "0",
          "explanation": {
            "prediction": 0.0047,
            "base_value": -0.1806,
            "all_contributors": [
              { "feature": "contract",          "raw_value": "Two Year", "encoded_value": 2.0,  "shap_value": -3.4014 },
              { "feature": "monthly_charge",     "raw_value": "58.55",    "encoded_value": 0.212, "shap_value": -0.6699 },
              { "feature": "tenure_in_months",   "raw_value": "29",       "encoded_value": 28.0,  "shap_value": -0.5553 },
              { "feature": "age",                "raw_value": "68",       "encoded_value": 49.0,  "shap_value":  0.3234 }
            ]
          }
        }
      ]
    }

Following are the definitions of the fields in `explanation`.{#predictive-intel-test-time-explain__table_aqk_dpl_jkc__entry__2}

| Field | Definition |
|-|-|
| prediction | The model's output for this record after all feature contributions are applied. |
| base_value | The model's expected result before any feature contributions. |
| all_contributors | The full list of input features and their contribution to this prediction. * feature: The name of the input field. * raw_value: The original value from the record (for example, "Two Year" or "58.55"). * encoded_value: The internal numeric representation of the original value used by the model. * shap_value: The contribution score. A positive value pushes the prediction higher; a negative value pushes it lower. The larger the magnitude, the stronger the influence. {#predictive-intel-test-time-explain__ul_imx_vrl_jkc} |
[Table 1. Fields in the explanation response]

{#predictive-intel-test-time-explain__table_aqk_dpl_jkc}The contributors are ordered by influence, so the features at the top of `all_contributors` are the strongest drivers of the prediction. Starting from the `base_value`, each `shap_value` influences the result up (positive value) or down (negative value).
**Related tasks**   

* [Configure XGBoost for classification or regression solutions](https://www.servicenow.com/docs/8J9l0_Xr2oWxQtLOP4b4fw "Apply XGBoost encoding to optimize the training for your classification or regression solutions.")  
**Related topics**   

* [ClassificationSolution - Global](https://www.servicenow.com/docs/access?context=ClassificationSolutionAPI&version=brazil&pubname=brazil-api-reference&ft:locale=en-US)

