arthurai.core.bias.threshold_mitigation.ThresholdMitigation#

class arthurai.core.bias.threshold_mitigation.ThresholdMitigation(arthur_model)#

Bases: object

Methods

enable

Triggers workflow to train curves for all constraints and for all sensitive attributes.

get_curves

Fetch curves for the given sensitive attribute and constraint.

get_thresholds_for_idx

Retrieve the thresholds for each group, given a set of curves and aparticular optimization index.

plot_curves

Simple plot of the tradeoff curve for a single sensitive attribute and constraint.

enable()#

Triggers workflow to train curves for all constraints and for all sensitive attributes. Equivalent to calling arthurmodel.enable_bias_mitigation(); here for convenience.

get_curves(attribute, constraint='equal_opportunity')#

Fetch curves for the given sensitive attribute and constraint.

Parameters
  • attribute (str) – Name of the sensitive attribute to fetch curves for.

  • constraint (str) – which constraint to use. “demographic_parity”, “equal_opportunity”, or “equalized_odds”

Returns

a Curves object which contains information about the attribute, constraint, accuracy-maximizing index, and the actual curves.

get_thresholds_for_idx(curves, idx=None)#

Retrieve the thresholds for each group, given a set of curves and aparticular optimization index.

Parameters
  • curves (Curves) – one Curves object containing a set of curves corresponding to a single sensitive attribute and constraint.

  • idx (Optional[int]) – one integer (between 0 and 1000, inclusive) that represents a specific solution option. Defaults to the curve’s accuracy-maximizing index.

Returns

a dictionary mapping sensitive feature values to the prediction threshold used for that group.

plot_curves(curves=None, attribute=None, constraint=None)#

Simple plot of the tradeoff curve for a single sensitive attribute and constraint.

Parameters

curves (Optional[Curves]) – one Curves object containing a set of curves corresponding to a single sensitive attribute and constraint.