class fairlearn.reductions.ExponentiatedGradient(estimator, constraints, *, objective=None, eps=0.01, max_iter=50, nu=None, eta0=2.0, run_linprog_step=True, sample_weight_name='sample_weight')[source]#

An Estimator which implements the exponentiated gradient reduction.

The exponentiated gradient algorithm is described in detail by Agarwal et al.1.

Read more in the User Guide.

Changed in version 0.3.0: Was a function before, not a class

Changed in version 0.4.6: Requires 0-1 labels for classification problems

  • estimator (estimator) – An estimator implementing methods fit(X, y, sample_weight) and predict(X), where X is the matrix of features, y is the vector of labels (binary classification) or continuous values (regression), and sample_weight is a vector of weights. In binary classification labels y and predictions returned by predict(X) are either 0 or 1. In regression values y and predictions are continuous.

  • constraints (fairlearn.reductions.Moment) – The fairness constraints expressed as a Moment.

  • objective (fairlearn.reductions.Moment) – The objective expressed as a Moment. The default is ErrorRate() for binary classification and MeanLoss(...) for regression.

  • eps (float) –

    Allowed fairness constraint violation; the solution is guaranteed to have the error within 2*best_gap of the best error under constraint eps; the constraint violation is at most 2*(eps+best_gap).

    Changed in version 0.5.0: eps is now only responsible for setting the L1 norm bound in the optimization

  • max_iter (int) –

    Maximum number of iterations

    New in version 0.5.0: Used to be T

  • nu (float) – Convergence threshold for the duality gap, corresponding to a conservative automatic setting based on the statistical uncertainty in measuring classification error

  • eta0 (float) –

    Initial setting of the learning rate

    New in version 0.5.0: Used to be eta_mul

  • run_linprog_step (bool) –

    if True each step of exponentiated gradient is followed by the saddle point optimization over the convex hull of classifiers returned so far; default True

    New in version 0.5.0.

  • sample_weight_name (str) –

    Name of the argument to estimator.fit() which supplies the sample weights (defaults to sample_weight)

    New in version 0.5.0.


fit(X, y, **kwargs)

Return a fair classifier under specified fairness constraints.


Get parameters for this estimator.

predict(X[, random_state])

Provide predictions for the given input data.


Set the parameters of this estimator.