fairlearn.reductions.ErrorRateParity#
- class fairlearn.reductions.ErrorRateParity(*, difference_bound=None, ratio_bound=None, ratio_bound_slack=0.0)[source]#
Implementation of error rate parity as a moment.
A classifier
satisfies error rate parity ifThis implementation of
UtilityParity
defines a single event, all. Consequently, the prob_eventpandas.Series
will only have a single entry, which will be equal to 1.The index property will have twice as many entries (corresponding to the Lagrange multipliers for positive and negative constraints) as there are unique values for the sensitive feature.
The
UtilityParity.signed_weights()
method will compute the costs according to Example 3 of Agarwal et al.[#agarwal2018reductions]_. However, in this scenario, g = abs(h(x)-y), rather than g = h(x)This
Moment
also supports control features, which can be used to stratify the data, with the constraint applied within each stratum, but not between strata.Read more in the User Guide.
- bound()[source]#
Return bound vector.
- Return type:
- Returns:
- pandas.Series
a vector of bound values corresponding to all constraints
- gamma(predictor)[source]#
Calculate the degree to which constraints are currently violated by the predictor.
- Return type:
- load_data(X, y, *, sensitive_features, control_features=None)[source]#
Load the specified data into the object.
- Return type:
- project_lambda(lambda_vec)[source]#
Return the projected lambda values.
i.e., returns lambda which is guaranteed to lead to the same or higher value of the Lagrangian compared with lambda_vec for all possible choices of the classifier, h.
- Return type:
- signed_weights(lambda_vec)[source]#
Compute the signed weights.
Uses the equations for
and as defined in Section 3.2 of Agarwal et al.[#agarwal2018reductions]_ in the ‘best response of the Q-player’ subsection to compute the signed weights to be applied to the data by the next call to the underlying estimator.- Return type:
- Parameters:
- lambda_vec
pandas.Series
The vector of Lagrange multipliers indexed by index
- lambda_vec
- property index: MultiIndex#
Return the multi-index listing the constraints.
- short_name = 'ErrorRateParity'#