---
title: Select data and display threshold
description: Thresholds in the ROC Curve tab in DataRobot set the class boundary for a predicted value. The display threshold updates the visualizations and the prediction threshold changes the threshold for all predictions made using the model.

---

# Select data and display threshold {: #select-data-and-display-threshold }

To use [ROC Curve tab](roc-curve-tab-use) visualizations, you [select a data source](#select-data-for-the-visualizations) and a [display threshold](#set-the-display-threshold). These values drive the ROC Curve visualizations:

* [Confusion matrix](confusion-matrix)
* [Prediction Distribution graph](pred-dist-graph)
* [ROC curve](roc-curve)
* [Profit curve](profit-curve)
* [Cumulative charts](cumulative-charts)
* [Custom charts](custom-charts)
* [Metrics](metrics)


## Select data for visualizations {: #select-data-for-visualizations }

To select the data source reflected in ROC Curve visualizations:

1. Select a model on the Leaderboard and navigate to **Evaluate > ROC Curve**.

2. Click the **Data Selection** dropdown menu above the Prediction Distribution graph and select a data source to view in the visualizations.

    !!! note
        The **Data Selection** list includes only the [partitions that have been enabled](partitioning#partitioning-methods) and run. The list includes all test datasets that have been added to the project; test dataset selections are inactive until they are run. [Time-aware modeling](ts-date-time#lift-roc) allows backtest-based selections.

    | Selection | Description |
    |---|---|
    | Holdout | Visualizations use the [holdout](glossary/index#holdout) partition. **Holdout** does not appear in the selection list if [holdout has not been unlocked](unlocking-holdout) for the model and run. |
    | Cross Validation | Visualizations use the [cross-validation](glossary/index#cross-validation) partition. DataRobot "stacks" the [cross-validation folds](data-partitioning#k-fold-cross-validation-cv) (5 by default) and computes the visualizations on the combined data. |
    | Validation | Visualizations use the [validation](glossary/index#validation) partition. |
    | External test data | Visualizations use the data for an external test you have run. If you've added a test dataset but have not yet run it, that test dataset selection is inactive.  
    | Add external test data | If you select **Add external data**, the  [**Predict > Make Predictions**](predict#make-predictions-on-an-external-dataset) tab displays. Use the tab to add test data and run an external test. Then return to the ROC Curve tab, click **Data Selection**, and select the test data you ran. |

3. View the ROC Curve tab visualizations. Update the [display threshold](#set-the-display-threshold) as necessary to meet your modeling goals.

## Set the display threshold {: #set-the-display-threshold }

The display threshold is the basis for several visualizations on the **ROC Curve** tab. The threshold you set updates the Prediction Distribution graph, as well as the Chart, Matrix, and Metrics panes described in the following sections. Experiment with the threshold to meet your modeling goals.

??? tip "Deep dive: Threshold"

    A threshold for a classification model is the point that sets the class boundary for a predicted value. The model classifies an observation below the threshold as "false," and an observation above the threshold as "true." In other words, DataRobot automatically assigns the positive class label to any prediction exceeding the threshold.

    There are two thresholds you can modify:

    * The [display threshold](#set-the-display-threshold): Updates the visualizations on the **[ROC Curve](roc-curve-tab/index)** tab.
    * The [prediction threshold](#set-the-prediction-threshold): Changes the threshold (and thus, the label) for all predictions made using this model.

    You have a choice of two bases for the display threshold&mdash;a prediction value (0-1) or a prediction percentage. The prediction value represents the numeric value used to determine the class boundary. The percentage option allows you to set the top or bottom *n*% of records that are categorized as one class or another. You may want to do this, for example, to filter top predictions and compute recall using that boundary. Then, you can use the value as a comparison metric or to simply inspect the top percentage of records.

To set the display threshold:

1. On the ROC Curve tab, click the **Display Threshold** dropdown menu.

    ![](images/roc-display-threshold.png)

    |  | Element | Description |
    |---|---|---|
    | ![](images/icon-1.png) | Display Threshold | Displays the threshold value you set. Click to select the threshold settings. Note that you can also update the display threshold by clicking in the [Prediction Distribution](pred-dist-graph) graph. The Display Threshold defaults to maximize F1. <br><br>If you switch to a different model, the Display Threshold updates to maximize F1 for the new model. This allows you to easily compare classification results between models. If you select a different data source (by selecting **Holdout**, **Cross Validation**, or **Validation** in the [**Data Selection** list](roc-curve-tab/index#roc-curve-tab-components)), the Display Threshold updates to maximize F1 for the new data. |
    | ![](images/icon-2.png) | Threshold | Drag the slider or enter a display threshold value; the visualization tools update accordingly. |
    | ![](images/icon-3.png) | Maximize option | Select a threshold that maximizes [metrics](metrics) such as the F1 score, MCC (Matthews Correlation Coefficient), or profit. To maximize for profit, first set a payoff by clicking **+Add payoff** on the **Matrix** pane. <br><br>{% include 'includes/max-metrics-roc.md' %}|
    | ![](images/icon-4.png) | Use as Prediction Threshold | Click to set the **Prediction Threshold** to the current value of the **Display Threshold**. By doing so, at prediction time, the threshold value serves as the boundary between positive and negative classifications&mdash;observations above the threshold receive the positive class's label and those below the threshold receive the negative class's label. The **Prediction Threshold** is used when you generate [profit curves](profit-curve) and when you [make predictions](predictions/index). |
    | ![](images/icon-5.png) | View Prediction Threshold | Click to reset the  visualization components (graphs and charts) to the model's prediction threshold. |
    | ![](images/icon-6.png) | Threshold Type | Select **Top % of highest predictions** or a **Prediction value (0 - 1)**. See [Threshold Type](#threshold-type) for details. |

    In this example, the **Display Threshold** is set to 0.2396, which maximizes the F1 score.

2. View the updated visualizations. Valid input for the Display Threshold changes the following page elements:

    * Updated values are displayed in the [Metrics](metrics) pane and the [confusion matrix](confusion-matrix) (in the Matrix pane).
* The dividing line on the [Prediction Distribution](pred-dist-graph) graph moves to the selected value and is marked with a circle.
* On the current curve displayed in the Charts pane&mdash;for example, a [ROC curve](roc-curve) or a [profit curve](profit-curve)&mdash;the new point is selected (indicated by a circle). Some curves also have line intercepts corresponding to the point.

    !!! note        
        The displays for the visualizations represents the closest data point to the specified threshold (i.e., if you entered 20%, the display might actually be something like 20.7%). The box reports the exact value after you enter return.

### Methods of setting the display threshold {: #methods-of-setting-the-display-threshold }

Click a tab to view alternative methods of setting the display threshold:

=== "Specify the threshold"

    1. On the **ROC Curve** tab, click the **Display Threshold** dropdown menu.

    2. Use the slider or enter a value to set the display threshold.

        ![](images/roc-display-threshold-enter-value.png)

        If the **Threshold Type** is **Top %**, enter a value between 0 and 100 (which will update to the exact point after entry). If the **Threshold Type** is **Prediction value**, enter a number between 0.0 and 1.0. If the input is not valid, a warning appears to the right.

    3. Click outside of the dropdown to view the effects of the display threshold on the visualization tools.

=== "Set to maximized metric"

    1. Select a [metric](metrics) maximum to use for the display threshold. Choose from F1, MCC, or profit. The metrics' maximum values display:

        ![](images/roc-display-threshold-max-metrics.png)

        !!! note
            You must set the **Matrix** pane to a Payoff Matrix to be able to maximize profit. Otherwise, the **Maximize profit** option is grayed out.

    2. Click outside of the dropdown to view the effects of the display threshold on the visualization tools.

=== "Prediction Distribution graph"

    1.  Hover over the Prediction Distribution graph until a "ghost" line appears with the corresponding value above it.

        ![](images/roc-display-threshold-pred-dist.png)

    2. Click to automatically update the display threshold to the new selected value.


## Set the prediction threshold {: #set-the-prediction-threshold }

Prediction requests for binary classification models return both a probability of the positive class and a label. Although DataRobot automatically calculates a threshold (the [display threshold](#set-the-display-threshold)), when applying the label at prediction time, the threshold value defaults to `0.5`. In the resulting predictions, records with values above the threshold will have the positive class's label (in addition to the probability) based on this threshold. If this value causes a need for post-processing predictions to apply the actual threshold label, you can bypass that step by changing the prediction threshold.

To set the prediction threshold:

1. On the **ROC Curve** tab, click the **Display Threshold** dropdown menu.

2. Update the [display threshold](#set-the-display-threshold) if necessary.

3. Select **Use as Prediction Threshold**.

    ![](images/roc-pred-threshold.png)

    Once deployed, all predictions made with this model that fall above the new threshold will return the positive class label.

The **Prediction Threshold** value set here is also saved to the following tabs:

* [**Make Predictions**](predict)
* [**Deploy**](deploy-model)

Changing the value in any of these tabs writes the new value back to all the tabs. Once a model is deployed, the threshold cannot be changed within that deployment.

To return the setting to the default threshold value of `0.5`, click **View Prediction Threshold**.
