Domain Generalization using Causal Matching
- OOD
Learning invariant representations has been proposed as a key technique for addressing the domain generalization problem. However, the question of identifying the right conditions for invariance remains unanswered. In this work, we propose a causal interpretation of domain generalization that defines domains as interventions under a data-generating process. Based on a general causal model for data from multiple domains, we show that prior methods for learning an invariant representation optimize for an incorrect objective. We highlight an alternative condition: inputs across domains should have the same representation if they are derived from the same base object. Inputs that share the same base object may be available through data augmentation or in some specific contexts, but base object information is not always available. Hence we propose an iterative algorithm called MatchDG that approximates base object similarity by using a contrastive loss formulation adapted for multiple domains. We then match inputs that are similar under the resultant representation to build an invariant classifier. We evaluate our matching-based methods on rotated MNIST, Fashion-MNIST, PACS and Chest X-ray datasets and find that they outperform prior work on out-of-domain accuracy. In particular, top-10 matches from MatchDG have over 50% overlap with ground-truth matches in MNIST and Fashion-MNIST. Code repository can be accessed here: \textit{https://github.com/microsoft/robustdg}
View on arXiv