holisticai.bias.plots.abroca_plot#
- holisticai.bias.plots.abroca_plot(group_a, group_b, y_pred, y_true, ax=None, size=None, title=None)[source]#
Abroca plot
Description
This function plots the roc curve for both groups revealing the area between them (abroca).
Parameters
- group_aarray-like
Group membership vector (binary)
- group_barray-like
Group membership vector (binary)
- y_predarray-like
Probability estimates (regression)
- y_truearray-like
Target vector (binary)
- ax (optional)matplotlib axes
Pre-existing axes for the plot
- size (optional)(int, int)
Size of the figure
- title (optional)str
Title of the figure
Returns
matplotlib ax
Example
>>> from sklearn.linear_model import LogisticRegression >>> from holisticai.datasets import load_dataset >>> from holisticai.bias.plots import abroca_plot >>> X, y = make_classification(n_samples=1000, n_features=20, n_classes=2) >>> group_a = np.random.randint(0, 2, 1000) >>> group_b = np.random.randint(0, 2, 1000) >>> y_pred = LogisticRegression().fit(X, y).predict_proba(X)[:, 1] >>> abroca_plot(group_a, group_b, y_pred, y)