---
title: Per-Class Bias
description: How to use Per-Class Bias, which helps to identify if a model is biased, and if so, how much and whom it's biased towards or against.

---

# Per-Class Bias {: #per-class-bias }

**Per-Class Bias** helps to identify *if* a model is biased, and if so, *how much* and *who* it's biased towards or against. Click **Per-Class Bias** to view the per-class bias chart.

The **Per-Class Bias** tab uses the fairness threshold and fairness score of each class to determine if certain classes are experiencing bias in the model's predictive behavior. Any class with a fairness score below the threshold is likely to be experiencing bias. Once these classes have been identified, use the [**Cross-Class Data Disparity**](cross-data) tab to determine where in the training data the model is learning bias.

![](images/bias-fairness-6.png)

##  Per-Class Bias Chart {: #per-class-bias-chart }

The **Per-Class Bias** chart displays individual class values for the selected protected feature on the Y-axis. The class' respective fairness score, calculated using DataRobot's [fairness metrics](bias-ref#fairness-metrics), is displayed on the X-axis. Scores can be viewed as either [absolute](#show-absolute-values) or [relative](#show-relative-values) values.

![](images/bias-fairness-7.png)

The blue bar indicates a class is above the fairness threshold; red indicates a class is below that threshold and is therefore likely to be experiencing model bias. A gray bar indicates that there is not enough data for the class due to one of the following reasons:

* It contains fewer than 100 rows.
* It contains between 100 and 1,000 rows, but fewer than 10% of the rows belong to the majority class (the class with the most rows of data).

Hover over a class to see additional details, including both absolute and relative fairness scores, the number of values for the class, and a summary of the fairness test results.

![](images/bias-and-fairness-13.png)

Use the information in this chart to identify if there is bias in the outcomes between protected classes. Then, from the [**Cross-Class Data Disparity**](cross-data) tab, evaluate which features are having the largest impact on this bias.

### Control the chart display {: #control-the-chart-display }

This chart provides several controls that modify the display, allowing you to focus on information of particular interest.

![](images/bias-fairness-1.png)

#### Prediction threshold {: #prediction-threshold }

The [prediction threshold](threshold)&mdash;as seen in the [**ROC Curve**](roc-curve-tab/index) tab tools &mdash;is the dividing line for interpreting results in binary classification models. The default threshold is 0.5, and every prediction above this dividing line has the positive class label.

For imbalanced datasets, a threshold of 0.5 can result in a validation partition without any positive class predictions, preventing the calculation of fairness scores on the **Per-Class Bias** tab. To recalculate and surface fairness scores, modify the prediction threshold to resolve the dataset imbalance.

![](images/bias-fairness-3.png)

All fairness metrics (except prediction balance) use the model's prediction threshold when calculating fairness scores. Changing this value recalculates the fairness scores and updates the chart to display the new values.

#### Fairness metric {: #fairness-metric }

Use the **Metric** dropdown menu to change which fairness metric DataRobot uses to calculate the fairness score displayed on the X-axis.

![](images/bias-fairness-14.png)

####  Show absolute values {: #show-absolute-values }

Select **Show absolute values** to display the raw score each class received for the selected fairness metric.

![](images/bias-fairness-4.png)

####  Show relative values {: #show-relative-values }

Select **Show relative values** to scale the class with the highest fairness score to 1, and scale all other class fairness scores relative to 1.

![](images/bias-fairness-5.png)

In this view, the fairness threshold is visible on the chart because DataRobot uses relative fairness scores to check against the fairness threshold.

#### Protected feature {: #protected-feature }

All protected features configured during project setup are listed on the left. Select a different protected feature to display its individual class values and fairness scores.

![](images/bias-fairness-2.png)
