peal.adaptors.group_dro_v2¶
Group Distributionally Robust Optimization as a PEAL repair adaptor.
A second, self-contained implementation of GroupDRO (Sagawa et al., 2020)
next to peal.adaptors.group_distributionally_robust_optimization: it
brings its own training loop instead of reusing PEAL’s ModelTrainer, and
it assumes the four groups of a binary-label / binary-confounder setup
(group = 2 * y + has_confounder). Instead of minimising the average loss
it keeps an adversarial distribution over these groups, up-weights whichever
group currently performs worst, and so repairs a classifier that relies on a
confounder. The dataset must support enable_groups() so that every batch
carries has_confounder.
Functions
Count the samples per (label, confounder) group in a dataloader. |
Classes
Adaptor that retrains a classifier with the group-robust objective. |
|
Config for |
|
Group-robust loss plus the running per-group statistics it needs. |