Fairness¶
fairness
¶
Fairness diagnostics and rule-level proxy audit for FlagGAM.
This module is an ORIGINAL ADDITION and is not part of Zhao & Welsch (arXiv:2605.31189); it operationalizes the paper's own Impact-Statement warning that selected rules may encode bias or proxies for protected attributes. Thresholds and binarization notes in docs/DECISIONS.md entry 21.
ProxyAudit
¶
Rank fitted rule bases by association with a protected attribute.
Association is computed on the BINARIZED basis indicator z > 0: exact
for threshold/category/missing_indicator flag bases, and a documented
approximation (fires vs. does-not-fire) for the continuous hinge/trend
bases. See docs/DECISIONS.md entry 21.
Source code in src/flaggam/fairness.py
report
¶
One row per basis: feature, rule, kind, association, method, flagged.
Source code in src/flaggam/fairness.py
drop_proxies
¶
Refit the head without flagged bases; return (new_estimator, trade-off row).
Supports only fitted binary classifiers with representation="full"
and head="additive": compact-score columns don't map 1:1 to bases
and flexible heads can't be refit column-wise; multiclass is out of
PD scope. Estimators fitted with monotonic_constraints are also
rejected, since the head refit would discard the constraints
(see docs/DECISIONS.md entry 21). y must be numeric 0/1, matching
the group_metrics contract used for the before/after trade-off.
Source code in src/flaggam/fairness.py
group_metrics
¶
group_metrics(y_true: Any, y_prob: Any, A: Any, threshold: float = 0.5, n_bins: int = 10) -> dict[str, Any]
Per-group PD metrics and max-minus-min gaps for protected attribute A.