holisticai.bias.mitigation.DebiasingExposure#

class holisticai.bias.mitigation.DebiasingExposure(group_col: str, query_col='query_id', doc_col='doc_id', score_col='judgment', feature_cols=None, gamma: float = 1.0, number_of_iterations=3000, learning_rate=0.001, lambdaa=0.001, init_var=0.01, standardize=False, verbose=0)[source]#

Disparate Exposure Learning to Rank (DELTR) [1] incorporates a measure of performance and a measure of disparate exposure into its loss function. Trains a linear model based on performance and fairness for a protected group.

Parameters

group_colstr

Name of the column in data that contains protected attribute.

query_colstr

Name of the column in data that contains query ids (optional).

doc_colstr

List of name of the column in data that contains document ids (optional).

score_colstr

Name of the column in data that contains judgment values (optional).

feature_cols :

Name of the columns in data that contains feature values (optional).

gammafloat

Gamma parameter for the cost calculation in the training phase (recommended to be around 1).

number_of_iterationsint

Number of iteration in gradient descent (optional).

learning_ratefloat

Learning rate in gradient descent (optional).

lambdaafloat

Regularization constant (optional).

init_varfloat

Range of values for initialization of weights (optional).

standardizebool

Boolean indicating whether the data should be standardized or not (optional).

verboseint

If > 0, print progress.

References

fit(rankings: DataFrame)[source]#

Trains a Disparate Exposure model on a given training set.

Parameters

rankings: DataFrame

Returns

Self

transform(rankings: DataFrame)[source]#

Train a Disparate Exposure model to rank the prediction set.

Parameters

rankings: DataFrame

Returns

DataFrame

Transformed data