langfair.metrics.classification.classification.ClassificationMetrics#
- class langfair.metrics.classification.classification.ClassificationMetrics(metric_type='all')#
Bases:
object
- __init__(metric_type='all')#
Class for pairwise classification fairness metrics.
- Parameters:
metric_type (str, one of 'assistive', 'punitive', 'representation', or 'all', default='all') – A list containing name or class object of metrics.
Methods
__init__
([metric_type])Class for pairwise classification fairness metrics.
evaluate
(groups, y_pred[, y_true, ratio])Returns values of classification fairness metrics
- evaluate(groups, y_pred, y_true=None, ratio=False)#
Returns values of classification fairness metrics
- Parameters:
groups (Array-like) – Group indicators. Must contain exactly two unique values.
y_pred (Array-like) – Binary model predictions. Positive and negative predictions must be 1 and 0, respectively.
y_true (Array-like, default=None) – Binary labels (ground truth values). Positive and negative labels must be 1 and 0, respectively.
ratio (bool, default=False) – Indicates whether to compute the metric as a difference or a ratio
- Returns:
Dictionary containing specified metric values
- Return type:
dict