lale.lib.aif360.gerry_fair_classifier module¶
- class lale.lib.aif360.gerry_fair_classifier.GerryFairClassifier(*, favorable_labels, protected_attributes, unfavorable_labels=None, redact=True, preparation=None, C=10, printflag=False, heatmapflag=False, heatmap_iter=10, heatmap_path='.', max_iters=10, gamma=0.01, fairness_def='FP', predictor=None)¶
Bases:
PlannedIndividualOp
GerryFairClassifier in-estimator fairness mitigator. Attempts to learn classifiers that are fair with respect to rich subgroups (Kearns et al. 2018, Kearns et al. 2019). Rich subgroups are defined by (linear) functions over the sensitive attributes, and fairness notions are statistical: false positive, false negative, and statistical parity rates. This implementation uses a max of two regressions as a cost-sensitive classification oracle, and supports linear regression, support vector machines, decision trees, and kernel regression.
This documentation is auto-generated from JSON schemas.
- Parameters
favorable_labels (array, >=1 items, not for optimizer) –
Label values which are considered favorable (i.e. “positive”).
items : union type
float
Numerical value.
or string
Literal string value.
or boolean
Boolean value.
or array, >=2 items, <=2 items of items : float
Numeric range [a,b] from a to b inclusive.
protected_attributes (array, >=1 items, not for optimizer) –
Features for which fairness is desired.
items : dict
feature : union type
Column name or column index.
string
or integer
reference_group : array, >=1 items
Values or ranges that indicate being a member of the privileged group.
items : union type
string
Literal value.
or float
Numerical value.
or array, >=2 items, <=2 items of items : float
Numeric range [a,b] from a to b inclusive.
monitored_group : union type, default None
Values or ranges that indicate being a member of the unprivileged group.
None
If monitored_group is not explicitly specified, consider any values not captured by reference_group as monitored.
or array, >=1 items
items : union type
string
Literal value.
or float
Numerical value.
or array, >=2 items, <=2 items of items : float
Numeric range [a,b] from a to b inclusive.
unfavorable_labels (union type, not for optimizer, default None) –
Label values which are considered unfavorable (i.e. “negative”).
None
If unfavorable_labels is not explicitly specified, consider any labels not captured by favorable_labels as unfavorable.
or array, >=1 items
items : union type
float
Numerical value.
or string
Literal string value.
or boolean
Boolean value.
or array, >=2 items, <=2 items of items : float
Numeric range [a,b] from a to b inclusive.
redact (boolean, not for optimizer, default True) – Whether to redact protected attributes before data preparation (recommended) or not.
preparation (union type, not for optimizer, default None) –
Transformer, which may be an individual operator or a sub-pipeline.
operator
or None
lale.lib.lale.NoOp
C (float, >=0.03125 for optimizer, <=32768 for optimizer, default 10) – Maximum L1 norm for the dual variables.
printflag (boolean, not for optimizer, default False) – Print output flag.
heatmapflag (boolean, not for optimizer, default False) – Save heatmaps every heatmap_iter flag.
heatmap_iter (integer, >=1, not for optimizer, default 10) – Save heatmaps every heatmap_iter.
heatmap_path (string, not for optimizer, default '.') – Save heatmaps path.
max_iters (integer, >=1, <=1000 for optimizer, loguniform distribution, default 10) – Time horizon for the fictitious play dynamic.
gamma (float, >0.0, >=0.001 for optimizer, <=1.0 for optimizer, loguniform distribution, default 0.01) – Fairness approximation parameter.
fairness_def (‘FP’ or ‘FN’, default ‘FP’) – Fairness notion.
predictor (union type, not for optimizer, default None) –
Hypothesis class for the learner.
operator
Supports LR, SVM, KR, Trees.
or None
sklearn.linear_model.LinearRegression
- fit(X, y=None, **fit_params)¶
Train the operator.
Note: The fit method is not available until this operator is trainable.
Once this method is available, it will have the following signature:
- Parameters
X (array) –
Features; the outer array is over samples.
items : array
items : union type
float
or string
y (union type) –
Target class labels; the array is over samples.
array of items : float
or array of items : string
- predict(X, **predict_params)¶
Make predictions.
Note: The predict method is not available until this operator is trained.
Once this method is available, it will have the following signature:
- Parameters
X (array) –
Features; the outer array is over samples.
items : array
items : union type
float
or string
- Returns
result – Predicted class label per sample.
array of items : float
or array of items : string
- Return type
union type
- predict_proba(X)¶
Probability estimates for all classes.
Note: The predict_proba method is not available until this operator is trained.
Once this method is available, it will have the following signature:
- Parameters
X (array) –
Features; the outer array is over samples.
items : array
items : union type
float
or string
- Returns
result – The class probabilities of the input samples
array of items : Any
or array of items : array of items : Any
- Return type
union type