compileml.fairness

FairnessAudit

class FairnessAudit(decisions, y, protected, *, labels=None, threshold_int: int | None = None, artifact: dict | None = None, X=None, protected_feature: str | None = None)

from compileml.fairness import FairnessAudit

Three-layer fairness audit over compiled decisions.

Args: decisions: decide() payloads, one per row. Pass include_contributions=True when calling decide or §6 and §8 cannot run. y: Binary outcomes aligned with decisions. protected: Protected attribute, aligned. Any hashable values. labels: Optional {value: display_name}. threshold_int: Cutoff in display-scale latent units; approved below it. Defaults to the median score, which is a reporting convenience and not a policy — set it to the cutoff you actually use. artifact: Needed for §7, §8 and §11, which re-read the compiled model. X: Feature rows, needed for the same three sections. protected_feature: Name of the protected attribute *if it is a model input*. Leave None only when it is not. §11 cannot tell the difference from None alone, so it reports that no input was named and does not run — which is not evidence the model ignores the attribute.

Fields#

NameTypeDefaultKind
decisions—requiredpositional
y—requiredpositional
protected—requiredpositional
labels—Nonekeyword-only
threshold_intint | NoneNonekeyword-only
artifactdict | NoneNonekeyword-only
X—Nonekeyword-only
protected_featurestr | NoneNonekeyword-only

Methods#

  • compute_all()
  • print_summary()
  • section()
  • summary()

Raises#

  • KeyError
  • RuntimeError
  • ValueError

Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.

Worked example: FairnessAudit →