Identify Bias - What-if Tool
1. Identify Bias - What-if Tool
The what-if tool can be used to visually analyze the interaction of datasets and ML models. With the what-if tool, you can do many explorations by using the data point editor and the performance and fairness tabs. Let's look at each. After loading a model and dataset, the first view you see allows you to visualize inference results using Facets Dive. In this example, each data point is colored by the category that the model predicted for it. Points are laid out top to bottom following the inference score. This means that points at the bottom have a prediction close to zero and very likely belong to the negative label. Points at the very bottom have a prediction close to one and very likely belong to the positive label. With this view, you can easily say that the model is often very confident since most points are close to zero or one and that the model predicts more points belong to the red label. From the facets dye view, you can investigate any data point. In this case, you would probably select difficult use cases such as data points near the decision boundary. To see data point details, click on the data point and a panel appears to the left of the visualization. You can then modify a new value and see if the prediction changes. Example. What if you change the age or the gender group of this data point? You can change a specific feature to see if the prediction is affected by that. For example, by changing the sex feature from male to female, the model prediction was flipped from positive to negative. This what-if analysis is called counterfactual analysis. It helps us understand the model behavior and identify bias problems. You can also apply this method to the entire dataset and quantify the ratio of the flip result when changing a sensitive feature value. This fairness metric is called flip ratio and helps you understand the model's vulnerability. You can also explore the effects of single features for a prediction result through partial dependence plots. This technique can also help us find bias problems, which we will explain how to do with the next interpretability module. The top example shows a partial dependence plot for a numerical value. The second example shows a plot for a categorical value. You can easily see that the model has learned a positive correlation between age and positive prediction. That higher degree is correlated to higher positive prediction. In the data point editor tab, you can find the most similar example to a data point either using L1 or L2 distance. The tool compares the two points side by side, and the green text represents features where the two data points differ. Let's now look at the performance and fairness tab for the last two points. Here, you can view confusion matrices and other metrics overall or per group. You can also slide the classification threshold around and the metrics will be updated accordingly. You also have the ability to automatically calculate the optimal classification threshold given a desired cost ratio. For example, the relative cost of a false positive versus a false negative. The default cost ratio in the tool is one, which means that false negatives and false positives are equally undesirable. Finally, you can test algorithmic fairness constraints by using the slicing capability in the performance and fairness tab. Here, you can analyze model performance for any sensitive feature. For example, if you use sex, you can see that the model is more accurate on females than males in the sense that it has less false positives and false negatives. You can also automatically calculate the optimal classification threshold given a fairness goal, such as demographic parity, which we will discuss in the next section.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.