{'fraction_non_alphanumeric': 0.02512562814070352, 'fraction_numerical': 0.0033500837520938024, 'mean_word_length': 5.7897727272727275, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Domain-Specific Risk Minimization

Learning a domain-invariant representation has become one of the most popular approaches for domain adaptation/generalization. In this paper, we show that the invariant representation may not be sufﬁcient to guarantee a good generalization, where the labeling function shift should be taken into consideration. Inspired by this, we ﬁrst derive a new generalization upper bound on the empirical risk that explicitly considers the labeling function shift. We then propose Domain-speciﬁc Risk Minimization (DRM) , which can model the distribution shifts of different domains separately and select the most appropriate one for the target domain. Extensive experiments on four popular domain generalization datasets, CMNIST, PACS, VLCS, and DomainNet, demonstrate the effectiveness of the proposed DRM for domain generalization with the following advantages: 1) it signiﬁcantly outperforms competitive baselines; 2) it enables either comparable or superior accuracies on all training domains comparing to vanilla empirical risk minimization (ERM); 3) it remains very simple and efﬁcient during training, and 4) it is complementary to invariant learning approaches.