holisticai.bias.metrics.recommender_bias_metrics#

holisticai.bias.metrics.recommender_bias_metrics(group_a=None, group_b=None, mat_pred=None, mat_true=None, top=None, thresh=0.5, normalize=False, metric_type='equal_outcome')[source]#

Recommender bias metrics batch computation

This function computes all the relevant recommender bias metrics, and displays them as a pandas dataframe.

Parameters

group_aarray-like

Group membership vector.

group_barray-like

Group membership vector.

mat_predmatrix-like

Matrix with shape (num_users, num_items). A recommender score (binary or soft pred) for each user,item interaction.

mat_truematrix-like

Matrix with shape (num_users, num_items). A target score (binary or soft pred) for each user,item pair.

topint, optional

If not None, the number of items that are shown to each user.

threshfloat, optional

Threshold indicating value at which a given item is shown to user (if top is None).

normalizebool, optional

If True, normalises the data matrix to [0,1] range.

metric_typestr, optional

Specifies which metrics we compute: ‘all’, ‘item_based’, ‘equal_outcome’ or ‘equal_opportunity’

Returns

pandas DataFrame

Metrics | Values | Reference