fairlearn.reductions.FalsePositiveRateParity#

class fairlearn.reductions.FalsePositiveRateParity(*, difference_bound=None, ratio_bound=None, ratio_bound_slack=0.0)[source]#

Implementation of false positive rate parity as a moment.

Adds conditioning on label Y=0 compared to demographic parity, i.e.,

\[P[h(X) = 1 | A = a, Y = 0] = P[h(X) = 1 | Y = 0] \; \forall a\]

This implementation of UtilityParity defines the event corresponding to Y=0.

The prob_event pandas.DataFrame will record the fraction of the samples corresponding to Y = 0 in the Y array.

The index MultiIndex will have a number of entries equal to the number of unique values of the sensitive feature, multiplied by the number of unique non-NaN values of the constructed event array, whose entries are either NaN or label=0 (so only one unique non-NaN value), multiplied by two (for the Lagrange multipliers for positive and negative constraints).

With these definitions, the UtilityParity.signed_weights() method will calculate the costs for Y=0 as they are calculated in Example 4 of Agarwal et al.[1], but will use the weights equal to zero for Y=1.

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.

Attributes:
total_samples

Return the number of samples in the data.

Methods

bound()

Return bound vector.

default_objective()

Return the default objective for moments of this kind.

gamma(predictor)

Calculate the degree to which constraints are currently violated by the predictor.

load_data(X, y, *, sensitive_features[, ...])

Load the specified data into the object.

project_lambda(lambda_vec)

Return the projected lambda values.

signed_weights(lambda_vec)

Compute the signed weights.

bound()[source]#

Return bound vector.

Returns:

a vector of bound values corresponding to all constraints

Return type:

pandas.Series

default_objective()[source]#

Return the default objective for moments of this kind.

gamma(predictor)[source]#

Calculate the degree to which constraints are currently violated by the predictor.

load_data(X, y, *, sensitive_features, control_features=None)[source]#

Load the specified data into the object.

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.

signed_weights(lambda_vec)[source]#

Compute the signed weights.

Uses the equations for \(C_i^0\) and \(C_i^1\) as defined in Section 3.2 of Agarwal et al.[1] 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.

Parameters:

lambda_vec (pandas.Series) – The vector of Lagrange multipliers indexed by index

short_name = 'FalsePositiveRateParity'#
property total_samples#

Return the number of samples in the data.