Segmentation
Segmentation primitives used to divide data into advantaged and disadvantaged groups
for bias analysis. Import from fair_perf_ml.bias.
Enums
fair_perf_ml.bias.segmentation.BiasSegmentationType
Bases: str, Enum
Two segmentation types are supported. Label implies segmentation based on a equality with the segmentation value. Threshold implies segmentation based on the ordering with respect to the segmentation value.
fair_perf_ml.bias.segmentation.BiasSegmentationThresholdType
Bases: str, Enum
When the segmentation type is BiasSegmentationType.Threshold. This enum defines the ordering logic to derive segmentation group.
Segmentation classes
fair_perf_ml.bias.segmentation.LabeledBiasSegmentation
Bases: BiasSegmentationProtocol
Implements the BiasSegmentationProtocol for assigning segmentation values for equality types.
fair_perf_ml.bias.segmentation.ThresholdBiasSegmentation
Bases: BiasSegmentationProtocol
Implements the BiasSegmentationProtocol for assigning segmentation values for ordered types.
Factory
fair_perf_ml.bias.segmentation.bias_segmentation_criteria_factory
bias_segmentation_criteria_factory(value: Any, segmentation_type: BiasSegmentationType | str, segmentation_threshold_type: BiasSegmentationThresholdType | str | None = None) -> BiasSegmentationProtocol
Factory method to define the segmentation class, based on arguments provided. There are two sets of valid states: segmentation_type = BiasSegmentationType.Label segmentation_threshold_type = None
OR
segmentation_type = BiasSegmentationType.Threshold
segmentation_threshold_type = BiasSegmentationThresholdType
Data payload
fair_perf_ml.bias.segmentation.BiasDataPayload
Convience type that groups a dataset and the segmentation criteria as a single unit.
Exceptions
fair_perf_ml.bias.segmentation.BiasPayloadTypeException
Bases: Exception
fair_perf_ml.bias.segmentation.InvalidBiasSegmentationConfig
Bases: Exception