MAPPING CONDITIONAL DISTRIBUTIONS FOR DOMAIN ADAPTATION UNDER GENERALIZED TARGET SHIFT
Year: 2021

Abstract:
We consider the problem of unsupervised domain adaptation (UDA) between a source and a target domain under conditional and label shift a.k.a Generalized Target Shift (GeTarS). Unlike simpler UDA settings, few works have addressed this challenging problem. Recent approaches learn domain-invariant representations, yet they have practical limitations and rely on strong assumptions that may not hold in practice. In this paper, we explore a novel and general approach to align pretrained representations, which circumvents existing drawbacks. Instead of constraining representation invariance, it learns an optimal transport map, implemented as a NN, which maps source representations onto target ones. Our approach is flexible and scalable, it preserves the problem’s structure and it has strong theoretical guarantees under mild assumptions. In particular, our solution is unique, matches conditional distributions across domains, recovers target proportions and explicitly controls the target generalization risk. Through an exhaustive comparison on several datasets, we challenge the state-of-the-art in GeTarS.

heading: 1 INTRODUCTION
text: Unsupervised Domain Adaptation (UDA) methods (Pan & Yang, 2010) train a classifier with labelled samples from a source domain S such that its risk on an unlabelled target domain T is low. This problem is ill-posed and simplifying assumptions have been considered. Initial contributions focused on two settings which decompose differently the joint distribution over X × Y : covariate shift (CoS), when input marginals differ across domains while class-posteriors are unchanged i.e. pS(Y |X) = pT (Y |X), pS(X) 6= pT (X) and target shift (TarS) when label distributions differ while conditionals are unchanged i.e. pS(Y ) 6= pT (Y ), pS(X|Y ) = pT (X|Y ). These restrictive assumptions were recently extended into model shift i.e. pS(Y |X) 6= pT (Y |X), pS(X) 6= pT (X) (Wang & Schneider, 2014; 2015) and generalized target shift (GeTarS) i.e. pS(X|Y ) 6= pT (X|Y ), pS(Y ) 6= pT (Y ), which are more realistic in real-world applications. Our work addresses GeTarS for which a key challenge is to learn how to map the source domain onto the target one to minimize both conditional and label shifts, without using target labels. The current state-of-the-art in Gong et al. (2016); Combes et al. (2020); Rakotomamonjy et al. (2020); Shui et al. (2021) learns domain-invariant representations and uses, as importance weights in the training objectives, the estimated class-ratios between domains. However, this approach has several limitations. First, to transfer representations, the domain-invariance constraint breaks the original problem structure and it was shown that this may degrade the discriminativity of target representations (Liu et al., 2019). Some approaches proposed to better enforce target discriminativity when learning invariant representations e.g. Xiao et al. (2019); Li et al. (2020); Chen et al. (2019), yet they were not applied to the GeTarS setting. Second, generalization guarantees are derived under strong assumptions, detailed in Section 2.3, which may not hold in practice.
In this paper, we address these limitations with a new general approach, named Optimal Sample Transformation and Reweight (OSTAR), which maps pretrained representations using Optimal Transport (OT). OSTAR proposes an alternative to constraining representation invariance and performs jointly three operations: given a pretrained encoder, (i) it learns an OT map, implemented as a neural network (NN), between encoded source and target conditionals, (ii) it estimates target proportions for sample reweighting and (iii) it learns a classifier for the target domain using source labels. OSTAR has several benefits: (i) it is flexible, scalable and preserves target discriminativity and (ii) it provides strong theoretical guarantees under mild assumptions. In summary, our contributions are:
• We propose an approach, OSTAR, to align pretrained representations under GeTarS. Without constraining representation-invariance, OSTAR jointly learns a classifier for inference on the target domain and an OT map, which maps representations of source conditionals to those of target ones under class-reweighting. OSTAR preserves target discriminativity and experimentally challenges the state-of-the-art for GeTarS.
• OSTAR implements its OT map as a NN shared across classes. Our approach is thus flexible and has native regularization biases for stability. Moreover it is scalable and generalizes beyond training samples unlike standard linear programming based OT approaches.
• OSTAR has strong theoretical guarantees under mild assumptions: its solution is unique, recovers target proportions and correctly matches source and target conditionals at the optimum. It also explicitly controls the target risk with a new Wasserstein-based bound.
Our paper is organized as follows. In Section 2, we define our problem, approach and assumptions. In Section 3, we derive theoretical results. In Section 4, we describe our implementation. We report in Section 5 experimental results and ablation studies. In Section 6, we present related work.

heading: 2 PROPOSED APPROACH
text: In this section, we successively define our problem, present our method, OSTAR and its main ideas and introduce our assumptions, used to provide theoretical guarantees for our method.

heading: 2.1 PROBLEM DEFINITION
text: Denoting X the input space and Y = {1, . . . ,K} the label space, we consider UDA between a source S = (XS ,YS , pS(X,Y )) with labelled samples Ŝ = {(x(i)S , y (i) S )}ni=1 ∈ (XS × YS)n and a target T = (XT ,YT , pT (X,Y )) with unlabelled samples T̂ = {x(i)T }mi=1 ∈ XmT . We denote Z ⊂ Rd a latent space and g : X → Z an encoder from X to Z . ZS and ZT are the encoded source and target input domains, ZŜ and ZT̂ the corresponding training sets and Z a random variable in this space. The latent marginal probability induced by g on D ∈ {S, T} is defined as ∀A ⊂ Z, pgD(A) , g#(pD(A))1. For convenience, pYD ∈ RK denotes the label marginal pD(Y ) and pD(Z) , p g D(Z). In all generality, conditional distributions in this latent space and label marginals differ across domains; this is the GeTarS assumption (Definition 1) illustrated in Figure 1a. This assumption, made in feature space Z rather than input space X , states that latent representations for both domains from a given class are different with different label proportions. Operating in the latent space has several practical advantages such as improved discriminativity and dimension reduction. Definition 1 (GeTarS). GeTarS is characterized by conditional mismatch across domains i.e. ∃j ∈ {1, . . . ,K}, pS(Z|Y = j) 6= pT (Z|Y = j) and label shift i.e. pYS 6= pYT .
Our goal is to learn a classifier in Z with low target risk, using source labels. This is challenging as (i) target labels are unknown and (ii) there are two shifts to handle. We will show that this can be achieved with pretrained representations if we recover two key properties: (i) a map which matches source and target conditional distributions and (ii) target proportions to reweight samples by classratios and thus account for label shift. Our approach, OSTAR, achieves this objective.

heading: 2.2 MAPPING CONDITIONAL DISTRIBUTIONS UNDER LABEL SHIFT
text: We now present the components in OSTAR, their objective and the various training steps. Components The main components of OSTAR, illustrated in Figure 1b, are detailed below. These components are learned and estimated using the algorithm detailed in Section 4. They include:
• a fixed encoder g : X → Z , defined in Section 2.1. • a mapping φ : Z → Z , acting on source samples encoded by g. • a label proportion vector pYN on the simplex ∆K . • a classifier fN : Z → {1, . . . ,K} for the target domain in a hypothesis classH over Z .
1f#ρ is the push-forward measure f#ρ(B) = ρ ( f−1(B) ) , for all measurable set B.
Objective g encodes source and target samples in a latent space such that it preserves rich information about the target task and such that the risk on the source domain is small. g is fixed throughout training to preserve target discriminativity. φ should map encoded source conditionals in ZS onto corresponding encoded target ones in ZT to account for conditional shift; ZN denotes the mapped space. pYN should estimate the target proportions p Y T to account for label shift. Components (φ,p Y N ) define a new labelled domain in latent space N = (ZN ,YN , pN (Z, Y )) through a Sample Transformation And Reweight operation of the encoded S domain, as illustrated in Figure 1b. Indeed, the pushforward by φ of encoded source conditionals defines conditionals in domain N , pφN (Z|Y ):
∀k, pφN (Z|Y = k) , φ# ( pS(Z|Y = k) ) 1
Then, pYN weights each conditional in N . This yields a marginal distribution in N , p φ N (Z):
pφN (Z) , K∑ k=1 pY=kN p φ N (Z|Y = k) (1)
Finally, classifier fN is trained on labelled samples from domain N . This is possible as each sample in N is a projection of a labelled sample from S. fN can then be used for inference on T . We will show that it has low target risk when components φ and pYN achieve their objectives detailed above.
Training We train OSTAR’s components in two stages. First, we train g along a source classifier fS from scratch by minimizing source classification loss; alternatively, g can be tailored to specific problems with pretraining. Second, we jointly learn (fN , φ,pYN ) to minimize a classification loss in domain N and to match target conditionals and proportions with those in domain N . As target conditionals and proportions are unknown, we propose a proxy problem for (φ,pYN ) to match instead latent marginals pT (Z) and p φ N (Z) (1). We solve this proxy problem under least action principle measured by a Monge transport cost (Santambrogio, 2015), denoted C(φ), as in problem (OT):
min φ,pYN∈∆K C(φ) , K∑ k=1 ∫ z∈Z ||φ(z)− z||22 pS(z|Y = k)dz
subject to pφN (Z) = pT (Z)
(OT)
For any function φ e.g. parametrized by a NN, C(φ) is the transport cost of encoded source conditionals by φ. It uses a cost function, c(x,y) = ‖x − y‖p2, where without loss of generality p = 2. The optimal C(φ) is the sum of Wasserstein-2 distances between source conditionals and their mappings. Problem (OT) seeks to minimize C(φ) under marginal matching. We provide some further background on optimal transport in Appendix C and discuss there the differences between our OT problem (OT) and the standard Monge OT problem between pS(Z) and pT (Z).
Our OT formulation is key to the approach. First, it is at the basis of our theoretical analysis. Under Assumption 2 later defined, the optimal transport cost is the sum of the Wasserstein-2 distance between source and matched target conditionals. We can then provide conditions on these distances in Assumption 3 to formally define when the solution to problem (OT) correctly matches conditionals. Second, it allows us to learn the OT map with a NN. This NN approach: (i) generalizes beyond training samples and scales up with the number of samples unlike linear programming based OT approaches (Courty et al., 2017b) and (ii) introduces useful stability biases which make learning less prone to numerical instabilities as highlighted in de Bézenac et al. (2021); Karkar et al. (2020).

heading: 2.3 ASSUMPTIONS
text: In Section 3 we will introduce the theoretical properties of our method which offers several guarantees. As always, this requires some assumptions which are introduced below. We discuss their relations with assumptions used in related work and detail why they are less restrictive. We provide some additional discussion on their motivation and validity in Appendix D. Assumption 1 (Cluster Assumption on S). ∀k,pY=kS > 0 and there is a partition of the source domain ZS such that ZS = ∪Kk=1Z (k) S and ∀k pS(Z ∈ Z (k) S |Y = k) = 1.
Assumption 1, inspired from Chapelle et al. (2010), states that source representations with the same label are within the same cluster. It helps guarantee that only one map is required to match source and target conditionals. Assumption 1 is for instance satisfied when the classification loss on the source domain is zero which corresponds to the training criterion of our encoder g. Interestingly other approaches e.g. Combes et al. (2020); Rakotomamonjy et al. (2020) assume that it also holds for target representations; this is harder to induce as target labels are unknown. Assumption 2 (Conditional matching). A mapping φ solution to our matching problem in problem (OT) maps a source conditional to a target one i.e. ∀k ∃j φ#(pS(Z|Y = k)) = pT (Z|Y = j). Assumption 2 guarantees that mass of a source conditional will be entirely transferred to a target conditional; φ solution to problem (OT) will then perform optimal assignment between conditionals. It is less restrictive than alternatives: the ACons assumption in Zhang et al. (2013); Gong et al. (2016) states the existence of a map matching the right conditional pairs i.e. j = k in Assumption 2, while the GLS assumption of Combes et al. (2020) imposes that pS(Z|Y ) = pT (Z|Y ). GLS is thus included in Assumption 2 when j = k and φ = Id and is more restrictive. Assumption 3 (Cyclical monotonicity between S and T). For all K elements permutation σ, conditional probabilities in the source and target domains satisfy ∑K k=1W2(pS(Z|Y = k), pT (Z|Y =
k)) ≤ ∑K k=1W2(pS(Z|Y = k), pT (Z|Y = σ(k)) withW2, the Wasserstein-2 distance.
Assumption 3, introduced in Rakotomamonjy et al. (2020), formally defines settings where conditionals are guaranteed to be correctly matched with an optimal assignment in the latent space under Assumption 2. One sufficient condition for yielding this assumption is when ∀k, j, W2(pS(Z|Y = k), pT (Z|Y = k)) ≤ W2(pS(Z|Y = k), pT (Z|Y = j)). This last condition is typically achieved when conditionals between source and target of the same class are “sufficiently near” to each other. Assumption 4 (Conditional linear independence on T). {pT (Z|Y = k)}Kk=1 are linearly independent implying ∀k, 6∃ α ∈ { ∆K | pT (Z|Y = k) = ∑K j=1,j 6=k αjpT (Z|Y = j) } .
Assumption 4 is standard and seen in TarS to guarantee correctly estimating target proportions (Redko et al., 2019; Garg et al., 2020). It discards pathological cases like when ∃(i, j, k)∃(a, b) s.t. a + b = 1, pT (Z|Y = i) = a × pT (Z|Y = j) + b × pT (Z|Y = k). It is milder than its alternative A2Cons in Zhang et al. (2013); Gong et al. (2016) which states linear independence of linear combinations of source and target conditionals, in X respectively Z .

heading: 3 THEORETICAL RESULTS
text: We present our theoretical results, with proofs in Appendix E, for OSTAR under our mild assumptions in Section 2.3. We first analyze in Section 3.1 the properties of the solution to our problem in (OT). Then, we show in Section 3.2 that given the learned components g, φ and pYN , the target generalization error of a classifier in the hypothesis space H can be upper-bounded by different terms including its risk on domain N and the Wasserstein-1 distance between marginals in N and T .

heading: 3.1 PROPERTIES OF THE SOLUTION TO THE OT ALIGNMENT PROBLEM
text: Proposition 1 (Unicity and match). For any encoder g which defines Z satisfying Assumption 1, 2, 3, 4, there is a unique solution (φ,pYN ) to (OT) and φ#(pS(Z|Y )) = pT (Z|Y ) and pYN = pYT .
Given an encoder g satisfying our assumptions, Proposition 1 shows two strong results. First, the solution to problem (OT) exists and is unique. Second, we prove that this solution defines a domain N , via the sample transformation and reweight operation defined in (1), where encoded conditionals and label proportions are equal to target ones. For comparison, Combes et al. (2020); Shui et al. (2021) recover target proportions only under GLS i.e. when conditionals are already matched, while we match both conditional and label proportions under the more general GeTarS.

heading: 3.2 CONTROLLED TARGET GENERALIZATION RISK
text: We now characterize the generalization properties of a classifier fN trained on this domainN with a new general upper-bound. First, we introduce some notations; given an encoder g onto a latent space Z , we define the risk of a classifier f as gD(f) , Ez∼pD(Z,Y )[f(z) 6= y] with D ∈ {S, T,N}. Theorem 1 (Target risk upper-bound). Given a fixed encoder g defining a latent space Z , two domains N and T satisfying cyclical monotonicity in Z , assuming that we have ∀k,pY=kN > 0, then ∀fN ∈ H whereH is a set of M -Lipschitz continuous functions over Z , we have
gT (fN ) ≤ g N (fN )︸ ︷︷ ︸
Classification (C)
+ 2M
minKk=1 p Y=k N
W1 ( pN (Z), pT (Z) ) ︸ ︷︷ ︸
Alignment (A)
+
2M(1 + 1
minKk=1 p Y=k N )W1 ( K∑ k=1 pY=kT pT (Z|Y = k), K∑ k=1 pY=kN pT (Z|Y = k) )
︸ ︷︷ ︸ Label (L)
(2)
We first analyze our upper-bound in (2). The target risk of fN is controlled by three main terms: the first (C) is the risk of fN on domain N , the second (A) is the Wasserstein-1 distance between latent marginals of domain N and T , the third term (L) measures a divergence between label distributions using, as a proxy, two ad-hoc marginal distributions. There are two other terms in (2): first, a Lipschitz-constant M that can be made small by implementing fN as a NN with piece-wise linear activations and regularized weights; second the minimum of pYN , which says that generalization is harder when a target class is less represented. We learn OSTAR’s components to minimize the r.h.s of (2). Terms (C) and (A) can be explicitly minimized, respectively by training a classifier fN on domain N and by learning (φ,pYN ) to match marginals of domains N and T . Term (L) is not computable, yet its minimization is naturally handled by OSTAR. Indeed, term (L) is minimal when pYN = p Y T under Assumption 4 per Redko et al. (2019). With OSTAR, this sufficient condition is guaranteed in Proposition 1 by the solution to problem (OT) under our mild assumptions in Section 2.3. This solution defines a domain N for which pYN = p Y T and term (A) equals zero.
We now detail the originality of this result over existing Wasserstein-based generalization bounds. First, our upper-bound is general and can be explicitly minimized even when target labels are unknown unlike Shui et al. (2021) or Combes et al. (2020) which require knowledge of pYT or its perfect estimation. Combes et al. (2020) claims that correct estimation of pYT i.e. (L) close to zero, is achieved under GLS i.e. pS(Z|Y ) = pT (Z|Y ). However, GLS is hardly guaranteed when the latent space is learned: a sufficient condition in Combes et al. (2020) requires knowing pYT , which is unrealistic in UDA. Second, our bound is simpler than the one in Rakotomamonjy et al. (2020): in particular, it removes several redundant terms which are unmeasurable due to unknown target labels.

heading: 4 IMPLEMENTATION
text: Our solution, detailed below, minimizes the generalization bound in (2) with OSTAR. It implements components fN , g with NNs and the map φ with a residual NN. Our solution jointly solves with pretrained representations (i) a classification problem to account for term (C) in (2) and (ii) an alignment problem (OT) to account for terms (A) and (L) in (2). Our pseudo-code and runtime / complexity analysis are presented in Appendix F.
Encoder initialization Prior to learning φ,pYN , fN , we first learn the encoder g jointly with a source classifier fS to yield a zero source classification loss via (3). With Lce the cross-entropy loss,
min fS ,g Lgc(fS , S) , min fS ,g
1
n n∑ i=1 Lce(fS ◦ g(x(i)S ), y (i) S ) (3)
g is then fixed to preserve the original problem structure. This initialization step helps enforce Assumption 1 and could alternatively be replaced by directly using a pretrained encoder if available.
Joint alignment and classification We then solve alternatively (i) a classification problem on domainN w.r.t. fN to account for term (C) in (2) and (ii) the problem (OT) w.r.t. (φ,pYN ) to account for term (A). Term (L) in (2) is handled by matching pYN and p Y T through the minimization of problem (OT). pYN is estimated with the confusion-based approach in Lipton et al. (2018), while φminimizes the Lagrangian relaxation, with hyperparameter λOT , of the constrained optimization problem (OT). The equality constraint in (OT) is measured through a Wasserstein distance as our bound in (2) is tailored to this distance, however, we are not restricted by this choice as other discrepancy measures are also possible. The objective based on (2) corresponds to the following optimization problem:
min φ,fN Lgc(fN , N) + λOT L g OT (φ) + L g wd(φ,p Y N )
subject to pYN = arg min p≥0,p∈∆K
1 2 ‖p̂YT − Ĉ p pYS ‖22 [Label proportion estimation]
(CAL)
where Lgc(fN , N) , 1
n n∑ i=1 p y (i) S N p y (i) S
S
Lce(fN ◦ φ ◦ g(x(i)S ), y (i) S ) [Classification loss inZN̂ ] (4)
and LgOT (φ) , K∑ k=1
1
#{y(i)S = k}i∈{1...n} ∑ y (i) S =k
i∈{1...n}
||φ(z(i)S )− z (i) S || 2 2 [Objective function of (OT)] (5)
and Lgwd(φ,p Y N ) , sup
‖v‖L≤1
1
n n∑ i=1 p y (i) S N p y (i) S
S
v ◦ φ(z(i)S )− 1
m m∑ j=1 v(z (j) T ) [Relaxed equality constraint in (OT)] (6)
Ĉ is the confusion matrix of fN on domain N , p̂YT ∈ ∆K is the target label proportions estimated with fN . Lgc(fN , N) (4) is the classification loss of fN on ZN̂ , derived in Appendix E, which minimizes term (C) in (2). Note that samples in domain N are obtained by mapping source samples with φ; they are reweighted to account for label shift. LgOT (5) defines the transport cost of φ on ZŜ . Implementing φ with a ResNet performed better than standard MLPs, thus we minimize in practise the dynamical transport cost, better tailored to residual maps and used in de Bézenac et al. (2021); Karkar et al. (2020). Lgwd (6) is the empirical form of the dual Wasserstein-1 distance between pφN (Z) and pT (Z) and seeks at enforcing the equality constraint in problem (OT) i.e. minimizing term (A). OSTAR’s assumptions also guarantee that term (L) is small at the optimum.
Improve target discriminativity OSTAR solves a transfer problem with pretrained representations, but cannot change their discriminativity in the target. This may harm performance when the encoder g is not well suited for the target. Domain-invariant methods are less prone to this issue as they handle jointly these two problems. In our upper-bound in (2), target discriminativity is assessed by the smallest value of term (C) at optimum of the alignment problem (OT) when terms (A) and (L) are equal to zero. This value depends on g and may be high since g has been trained with only source labels. Nevertheless, it can be reduced by updating g using target outputs such that class separability for target representations is better enforced. To achieve this goal, we propose an extension of (CAL) using Information Maximization (IM), not considered in existing domain-invariant GeTarS methods. IM was originally introduced for source-free adaptation without alignment (Liang et al., 2020). In this context, target predictions are prone to errors and there is no principled way to mitigate this problem. In our case, we have access to source samples and OSTAR minimizes an upper-bound to its target error, which avoids performance degradation. IM refines the decision boundaries of fN with two terms on target samples. Lgent(fN , T ) (7) is the conditional entropy of fN which favors
low-density separation between classes. Denoting δk(·) the k-th component of the softmax function,
Lgent(fN , T ) = m∑ i=1 K∑ k=1 δk(fN ◦ g(x(i)T )) log(δk(fN ◦ g(x (i) T ))) (7)
Lgdiv(fN , T ) (8) promotes diversity by regularizing the average output of fN ◦g to be uniform on T . It avoids predictions from collapsing to the same class thus softens the effect of conditional entropy.
Lgdiv(fN , T ) = K∑ k=1 p̂k log p̂k = DKL(p̂, 1 K 1K)− logK; p̂ = ExT∈XT [δ (fN ◦ g(xT))] (8)
Our variant introduces two additional steps in the learning process. First, the latent space is fixed and we optimize fN with IM in (SS). Then, we optimize the representations in (SSg) while avoiding modifying source representations by including Lgc(fS , S) (3) with a fixed source classifier fS .
min fN Lgc(fN , N) + L g ent(fN , T ) + L g div(fN , T ) (SS)
min fN ,g Lgc(fN , N) + L g ent(fN , T ) + L g div(fN , T ) + L g c(fS , S) (SSg)

heading: 5 EXPERIMENTAL RESULTS
text: We now present our experimental results on several UDA problems under GeTarS and show that OSTAR outperforms recent SOTA baselines. The GeTarS assumption is particularly relevant on our datasets as encoded conditional distributions do not initially match as seen in Appendix Figure 3.
Experimental setup We consider: (i) an academic benchmark Digitswith two adaptation problems between USPS (Hull, 1994) and MNIST (LeCun et al., 1998), (ii) a synthetic to real images adaptation benchmark VisDA12 (Peng et al., 2017) and (iii) two object categorizations problems Office31 (Saenko et al., 2010), OfficeHome (Venkateswara et al., 2017) with respectively six and twelve adaptation problems. The original datasets have fairly balanced classes, thus source and target label distributions are similar. This is why we subsample our datasets to make label proportions dissimilar across domains as detailed in Appendix Table 8. For Digits, we subsample the target domain and investigate three settings - balanced, mild and high as Rakotomamonjy et al. (2020). For other datasets, we modify the source domain by considering 30% of the samples coming from the first half of their classes as Combes et al. (2020). We compare OSTAR against a Source baseline trained using only source samples without adaptation and to various UDA methods: two CoS methods and three recent SOTA GeTarS models. Chosen UDA methods learn invariant representations with reweighting in GeTarS models or without reweighting in other baselines. The two CoS baselines are DANN (Ganin et al., 2016) which approachesH-divergence and WDβ=0 (Shen et al., 2018) which computes Wasserstein distance. The GeTarS baselines are Wu et al. (2019); Rakotomamonjy et al. (2020); Combes et al. (2020). We use Wasserstein distance to learn invariant representations such that differences lie mostly on the strategy to account for label shift. Wu et al. (2019), denoted WDβ , performs assymetric alignment with parameter β, for which we test different values (β ∈ {1, 2}). The remaining models, MARSc, MARSg (Rakotomamonjy et al., 2020) and IW-WD (Combes et al., 2020), estimate target proportions respectively with optimal assignment or with the estimator in Lipton et al. (2018) also used in OSTAR. We report DI-Oracle, an oracle which learns invariant representations with Wasserstein distance and makes use of true class-ratios. Finally, we report the performance of OSTAR with and without IM. All baselines are reimplemented for a fair comparison with the same NN architectures detailed in Appendix G.
Results We report in Table 1 mean and standard deviations for balanced accuracy over 10 runs. It corresponds to the average recall obtained on each class and is suited for imbalanced problems (Brodersen et al., 2010). For better visibility, results are aggregated over each dataset and over all imbalance settings (”aver. subsampled” in Table 1). Full results are provided in Appendix Table 3. Additionally, due to space limits, we report in Figure 4 in the Appendix the `1 error between true and estimated target proportions for GeTarS baselines and OSTAR+IM. First, we note that low estimation error of pYT is correlated to high accuracy for all models and that DI-Oracle, which uses true class-ratios, upper-bounds domain-invariant approaches. This shows the importance of
correctly estimating pYT . Second, we note that without IM OSTAR improves the Source baseline (column 2) and is competitive w.r.t. IW-WD (column 9) on VisDA, Office31 and OfficeHome and MARSg (column 7) on Digits although it keeps target representations fixed unlike these two methods. OSTAR+IM (column 11) is less prone to initial target discriminativity and clearly outperforms or equals the baselines on both balanced accuracy and proportion estimation. It even improves DI-Oracle (column 12) for balanced accuracy despite not using true class-ratios. This (i) shows the benefits of not constraining domain-invariance which may degrade target discriminativity especially under label estimation errors; (ii) validates our theoretical results which show that OSTAR controls the target risk and recovers target proportions. Finally, we visualize how OSTAR aligns source and target representations in Appendix Figure 3.
Ablation studies We perform two studies. We first measure the role of IM in our model. In Appendix Table 4, we show the contribution of (SS) (column 3) and (SSg) (column 4) to (CAL) (column 2). We also evaluated the effect of adding IM to our baselines in Appendix Table 5, even if this is not part of their original work. IM improves performance on VisDA and Office while there are some degradations on Digits. However, the performance remains below the ones of OSTAR+IM. Finally, we measure the impact of IM on our upper-bound in (2) in Appendix Table 6, assuming target conditionals are known to compute term (L). We observe that term (C), related to target discriminativity at optimum of alignment and the alignment terms (A) and (L) are reduced. This explains the improvements due to IM and shows empirically that IM helps better optimize the three functions φ, g, fN involved in our upper-bound. The second study measures the effect of the OT transport cost in our objective (CAL). Proposition 1 shows that the OT formulation guarantees recovering target proportions and matching conditionals. In Table 2, we consider MNIST→USPS under various shifts (Table 2a) and initialization gains i.e. the standard deviation of the weights of the NN (Table 2b). In Table 2a, we note that λOT 6= 0 in problem (CAL) improves balanced accuracy (left) and `1 estimation error (middle) over λOT = 0 over all shifts, especially high ones. This improvement is correlated with lower mean and standard deviation of the normalized transport cost per sample (right). We observe the same trends when changing initialization gains in Table 2b. This confirms our theoretical results and shows the advantages of OT regularization biases for performance and stability. In Appendix Table 7, we test more values of λOT and show that OSTAR recovers the Source model under high λOT as the induced transport cost constrains φ ≈ Id.

heading: 6 RELATED WORK
text: UDA Existing approaches train a classifier using source labels while handling distribution shifts. We review two main approaches: the first learns invariant representations and the second learns a map between fixed samples from source and target domains. While domain-invariant approaches are SOTA, mapping-based approaches avoid structure issues posed by the invariance constraint which may degrade target discriminativity (Liu et al., 2019; Chen et al., 2019). For CoS, domain-invariant methods directly match marginal distributions in latent space (Ganin et al., 2016; Shen et al., 2018; Long et al., 2015), while mapping-based approaches learn a mapping in input space (Courty et al., 2017b; Hoffman et al., 2018). For TarS and GeTarS, label shift requires estimating pYT to reweight source samples by estimated class-ratios (Zhao et al., 2019). An alternative is to use a fixed weight (Wu et al., 2019). When conditionals are unchanged i.e. TarS, pYT can be recovered without needs for alignment (Lipton et al., 2018; Redko et al., 2019). Under GeTarS, there is the additional difficulty of matching conditionals. The SOTA methods for GeTarS are domain-invariant with
sample reweighting (Rakotomamonjy et al., 2020; Combes et al., 2020; Gong et al., 2016). An earlier mapping-based approach was proposed in Zhang et al. (2013) to align conditionals, also under reweighting. Yet, it is not flexible, operates on high dimensional input spaces and does not scale up to large label spaces as it considers a linear map for each pair of conditionals. Estimators used in GeTarS are confusion-based in Combes et al. (2020); Shui et al. (2021); derived from optimal assignment in Rakotomamonjy et al. (2020) or from the minimization of a reweighted MMD between marginals in Zhang et al. (2013); Gong et al. (2016). OSTAR is a new mapping-based approach for GeTarS with improvements over these approaches as detailed in this paper. The improvements are both practical (flexibility, scalability, stability) and theoretical. CTC (Gong et al., 2016) also operates on representations, yet OSTAR simplifies learning by clearly separating alignment and encoding operations, intertwined in CTC as both encoder and maps are trained to align.
OT approaches for UDA They usually apply linear programming (LP) to compute a transport plan between empirical distributions. LP is used in CoS to align source and target joint distributions (Courty et al., 2017a; Damodaran et al., 2018) or to compute a barycentric mapping in input space (Courty et al., 2017b); and in TarS to compute a reweighted Wasserstein distance between source and target marginals whose minimum yields target proportions estimates (Redko et al., 2019). An alternative to LP is to learn invariant representation by minimizing a dual Wasserstein-1 distance with adversarial training; this is done for CoS in Shen et al. (2018) and, more recently, for GeTarS in Rakotomamonjy et al. (2020); Shui et al. (2021). Rakotomamonjy et al. (2020) formulates two separate OT problems for class-ratio estimation and conditional alignment and Shui et al. (2021) is the OT extension of Combes et al. (2020) to multi-source UDA. OSTAR is the first OT approach which does not learn invariant representations for GeTarS and has several benefits: (i) OSTAR keeps representation separate which avoids deteriorating target discriminativity, (ii) it solves a single OT problem unlike Rakotomamonjy et al. (2020), (iii) it implements the OT map with a NN which generalizes beyond training samples and scales up with the number of samples unlike barycentric OT maps; (iv) it adds encoding which improves efficiency of matching by improving discriminativity and reducing dimensionality, unlike Courty et al. (2017b).

heading: 7 CONCLUSION
text: We introduce OSTAR, a new general approach to align pretrained representations under GeTarS, which does not constrain representation invariance. OSTAR learns a flexible and scalable map between conditional distributions in the latent space. This map, implemented as a ResNet, solves an OT matching problem with native regularization biases. Our approach provides strong generalization guarantees under mild assumptions as it explicitly minimizes a new upper-bound to the target risk. Experimentally, it challenges recent invariant GeTarS methods on several UDA benchmarks.
Reproducibility Statement For theoretical results, we provide explanations of our assumptions in Section 2.3 and provide our proofs in Appendix E. The datasets used in our experiments are public benchmarks and we provide a complete description of the data processing steps and NN architectures in Appendix G. We provide a link to a downloadable source code https://www. dropbox.com/sh/y418sskov5vdec4/AADCnxWXgXQCpIHZFcRogCj_a?dl=0.

heading: A ADDITIONAL VISUALISATION
text: We visualize how OSTAR maps source representations onto target ones under GeTarS. In these visualizations, IM is used to improve target discriminativity. We note that OSTAR (i) maps source conditionals to target ones (blue and green points are matched c.f. left), (ii) matches conditionals of the same class (”v” and ”o” of the same colour are matched c.f. right).
(a) MNIST→USPS balanced
(b) MNIST→USPS subsampled high imbalance
(c) USPS→MNIST balanced

heading: B ADDITIONAL RESULTS
text: We report our full results below. Aggregated results for balanced accuracy over a dataset and imbalance scenarios are reported in Table 1. Prefix ”s” corresponds to subsampled datasets defined in Table 8.
Additional ablation studies We detail the full results for our ablation studies.

heading: C DETAILS ON OPTIMAL TRANSPORT
text: Background OT was introduced to find a transportation map minimizing the cost of displacing mass from one configuration to another (Villani, 2008). For a comprehensive introduction, we refer to Peyré & Cuturi (2019). Formally, let α and β be absolutely continuous distributions compactly supported in Rd and c : Rd × Rd → R a cost function. Consider a map φ : Rd → Rd that satisfies φ#α = β, i.e. that pushes α to β. We remind that for a function f , f#ρ is the push-forward measure f#ρ(B) = ρ ( f−1(B) ) , for all measurable set B. The total transportation cost depends on the contributions of costs for transporting each point x to φ(x) and the Monge OT problem is:
min φ Cmonge(φ) = ∫ Rd c(x, φ(x))dα(x)
s.t. φ#α = β (9)
c(x,y) = ||x − y||p2 induces the p-Wasserstein distance, Wp(α, β) = minφ#α=β Cmonge(φ)1/p. When p = 1,W1 can be expressed in the dual formW1(α, β) = sup‖v‖L≤1 Ex∼αv(x)−Ey∼βv(y) where ||v||L is the Lipschitz constant of function v.
Relationship between (OT) and the Monge OT problem (9) (OT) is the extension of (9) to the setting where pYS 6= pYT with pYT unknown. This extension aims at matching conditional distributions regardless of how their mass differ and learns a weighting term pYN for source conditional distributions which addresses label shift settings. When pYS = p Y T , these two formulations are equivalent under Assumption 1 if we fix pYN = p Y S = p Y T .

heading: D DISCUSSION
text: Our four assumptions are required for deriving our theoretical guarantees. All GeTarS papers that propose theoretical guarantees also rely on a set of assumptions, either explicit or implicit. Assumptions 1 and 4 are common to several papers. Assumption 1 is easily met in practice since it could be forced by training a classifier on the source labels. Assumption 4 is said to be met in high dimensions (Redko et al., 2019; Garg et al., 2020). Assumption 3 says that source and target clusters from the same class are globally (there is a sum in the condition) closer one another than clusters from two different classes. This assumption is required to cope with the absence of target labels. Because of the sum, it could be considered as a reasonable hypothesis. It is milder than the hypotheses made in papers offering guarantees similar to ours (Zhang et al., 2013; Gong et al., 2016). Assumption 2 is new to this paper. It states that φ maps a j source conditional to a unique k target conditional i.e. it guarantees that mass of a source conditional will be entirely transferred to a target conditional and will not be split across several target conditionals. This property is key to show that OSTAR matches source conditionals and their corresponding target conditionals, which is otherwise very difficult to guarantee under GeTarS as both target conditionals and proportions are unknown. This assumption has some restrictions, despite being milder than existing assumptions in GeTarS. First, mass from a source conditional might in practise be split across several target conditionals. In practise, our optimization problem in (CAL) mitigates this problem by learning how to reweight source conditionals to improve alignment. We could additionally apply Laplacian regularization (Ferradans et al., 2013; Carreira-Perpiñán & Wang, 2014) into our OT map φ but this was not developed in the paper. Second, it assumes a closed-set UDA problem i.e. label domains are the same YS = YT . The setting where YS 6= YT is more realistic in large scale image pretraining and is another interesting follow-up. Note that OSTAR can address empirically open-set UDA (YT ⊂ YS) by simply applying L1 regularization on pYN in our objective function (CAL). This forces sparsity and allows ”loosing” mass when mapping a source conditional. It avoids the unwanted negative transfer setting when source clusters, with labels absent on the target, are aligned with target clusters.

heading: E PROOFS
text: Proposition (1). For any encoder g which defines Z satisfying Assumption 1, 2, 3, 4, there is an unique solution (φ,pYN ) to (OT) and φ#(pS(Z|Y )) = pT (Z|Y ) and pYN = pYT .
Proof. Fixing Z satisfying Assumption 1, 3 and 4, we first show that there exists a solution (φ,pYN ) to (OT). Following Brenier (1991) as Z ⊂ Rd, we can find K unique Monge maps {φ̂(k)}Kk=1 s.t. ∀k φ̂(k)# (pS(Z|Y = k)) = pT (Z|Y = k) with respective transport costs W1(pS(Z|Y = k), pT (Z|Y = k)). Let’s define φ̂ as ∀k φ̂|Z(k)S = φ̂ (k) where ∪Kk=1Z (k) S is the partition of ZS in Assumption 1. (φ̂,pYT ) satisfies the equality constraint to (OT), thus we easily deduce existence.
Now, let (φ,pYN ) be a solution to (OT), let’s show unicity. We first show that φ = φ̂. Under Assumption 2, (OT) is the Monge formulation of the optimal assignment problem between {pS(Z|Y = k)}Kk=1 and {pT (Z|Y = k)}Kk=1 with C the cost matrix defined by Cij = W2(pS(Z|Y = i), pT (Z|Y = j)). At the optimum, the transport cost is related to the Wasserstein distance between source conditionals and their corresponding target conditionals i.e. C(φ) = ∑K k=1W2(pS(Z|Y = k), φ#(pS(Z|Y = k))). Suppose ∃(i, j), j 6= i s.t. φ#(pS(Z|Y = i)) = pT (Z|Y = j) and φ#(pS(Z|Y = j)) = pT (Z|Y = i) and ∀k 6= i, j, φ#(pS(Z|Y = k)) = pT (Z|Y = k). Assumption 3 implies ∑K k=1W2(pS(Z|Y = k), pT (Z|Y = k)) ≤ ∑ k 6=i,jW2(pS(Z|Y = k), pT (Z|Y = k)) + W2(pS(Z|Y = i), pT (Z|Y = j)) + W2(pS(Z|Y = j), pT (Z|Y = i)). Thus C(φ̂,Z) ≤ C(φ,Z) whereas φ, solution to (OT), has minimal transport cost. Thus φ = φ̂. Now let’s show pYN = p Y T under Assumption 4. We inject φ#(pS(Z|Y )) = pT (Z|Y ) into (OT),
K∑ k=1 pY=kN pT (Z|k) = K∑ k=1 pY=kT pT (Z|k)⇔ K∑ k=1 ( pY=kN − pY=kT ) pT (Z|k) = 0⇔ pYN = pYT
Theorem (1). Given a fixed encoder g defining a latent space Z , two domains N and T satisfying cyclical monotonicity in Z , assuming that we have ∀k,pY=kN > 0, then ∀fN ∈ H where H is a set of M -Lipschitz continuous functions over Z , we have
gT (fN ) ≤ g N (fN )︸ ︷︷ ︸
Classification (C)
+ 2M
minKk=1 p Y=k N
W1 ( pN (Z), pT (Z) ) ︸ ︷︷ ︸
Alignment (A) + 2M ( 1 + 1
minKk=1 p Y=k N ) W1 ( K∑ k=1 pY=kN pT (Z|Y = k), K∑ k=1 pY=kT pT (Z|Y = k) )
︸ ︷︷ ︸ Label (L)
(2)
Proof. We first recall that gD(fN ) = E(z,y)∈pD(Z,Y )L(fN (z), y) where L is the 0/1 loss. For conciseness, ∀z ∈ Z , pz|YT ,p z|Y N ,Lz,k will refer to the vector of [pT (z|k)]Kk=1, [pN (z|k)]Kk=1, [L(fN (z), k)]Kk=1 respectively. In the following, denotes the element-wise product operator between two vectors of the same size.
∀fN , gT (fN ) = g N (fN ) + g T (fN )− g N (fN ) ≤ gN (fN ) + ∫ Z K∑ k=1 ( pT (z, k)− pN (z, k) ) × L ( fN (z), k ) dzdy
≤ gN (fN ) + ∫ Z K∑ k=1 [ pY=kT pT (z|k)− pY=kN pN (z|k) ] × L ( fN (z), k ) dz
≤ gN (fN ) + ∫ Z pYT ᵀ ( p z|Y T L z,k ) − pYN ᵀ ( p z|Y N L z,k ) dz
≤ gN (fN ) + ∫ Z pYT ᵀ ( p z|Y T L z,k ) − pYN ᵀ ( p z|Y T L z,k ) + pYN ᵀ ( p z|Y T L z,k ) − pYN ᵀ ( p z|Y N L z,k ) dz
≤ gN (fN ) + ∫ Z ( pYT ᵀ − pYN ᵀ )( p z|Y T L z,k ) + pYN ᵀ ( (p z|Y T − p z|Y N ) L z,k ) dz
≤ gN (fN ) + ∫ Z ( pYT ᵀ − pYN ᵀ )( p z|Y T L z,k ) dz + ∫ Z pYN ᵀ ( (p z|Y T − p z|Y N ) L z,k ) dz
We now introduce a preliminary result from Shen et al. (2018). ∀fN ∈ HM -Lipschitz continuous, gN (fN )− g T (fN ) ≤ 2M · W1(p g N (Z), p g T (Z)) Assuming that h is M -Lipschitz continuous we apply this result in the following∫ Z ( pYT ᵀ − pYN ᵀ )( p z|Y T L z,k ) dz = ∫ Z K∑ k=1 ( pY=kT − pY=kN ) pT (z|k)× L ( fN (z), k ) dz
= gT (fN )− g T̃ (fN ) where pT̃ (Z) = K∑ k=1 pY=kN pT (Z|k)
≤ 2M · W1(pT̃ (Z), pT (Z))∫ Z pYN ᵀ ( (p z|Y T − p z|Y N ) L z,k ) dz = ∫ Z K∑ k=1 pY=kN ( pT (z|k)− pN (z|k) ) × L ( fN (z), k ) dz
≤ K∑ k=1 ∫ Z ( pT (z|k)− pN (z|k) ) × L ( fN (z), k ) dz ∀k pY=kN ≤ 1
≤ 2M K∑ k=1 W1 ( pT (Z|k), pN (Z|k) ) Thus, ∀fN M -Lipschitz continuous
gT (fN ) ≤ g N (fN ) + 2M × K∑ k=1 W1 ( pT (Z|k), pN (Z|k) ) + 2M ×W1 ( pT̃ (Z), pT (Z) ) We rewrite the second term to involve directly latent marginals. Proposition 2 in Rakotomamonjy et al. (2020) shows that under cyclical monotonicity, if ∀k,pY=kN > 0,
W1 ( K∑ k=1 pY=kN pT (Z|k), pN (Z) ) = K∑ k=1 pY=kN W1 ( pN (Z|k), pT (Z|k) ) This allows to write
K min k=1 pY=kN K∑ k=1 W1 ( pN (Z|k), pT (Z|k) ) ≤ K∑ k=1 pY=kN W1 ( pN (Z|k), pT (Z|k) ) =W1
( K∑ k=1 pY=kN pT (Z|k), pN (Z) ) =W1 ( pT̃ (Z), pN (Z) )
We then use the triangle inequality for the Wasserstein distanceW1
gT (fN ) ≤ g N (fN ) +
2M
minKk=1 p Y=k N
W1 ( pT̃ (Z), pN (Z) ) + 2M ×W1 ( pT̃ (Z), pT (Z) ) ≤ gN (fN ) + 2M
minKk=1 p Y=k N
W1 ( pN (Z), pT (Z) ) + 2M(1 +
1
minKk=1 p Y=k N
)W1 ( pT̃ (Z), pT (Z) )
Derivation of the reweighted classification loss (C) gN (fN ) Let Lce be the cross-entropy loss. Given a classifier h, feature extractor g and domain N , the mapping of domain S by (φ,pYN ),
gN (fN ) = ∫ Z,Y pφN (z, y)Lce ( fN (z), y ) dzdy = ∫ Z,Y pY=yN p φ N (z|y)Lce ( fN (z), y ) dzdy
= ∫ Z,Y pY=yN pY=yS pY=yS p φ N (z|y)Lce ( fN (z), y ) dzdy = ∫ Z,Y pY=yN pY=yS pY=yS φ#(pS(z|y))Lce ( fN (z), y ) dzdy

heading: F PSEUDO-CODE AND RUNTIME / COMPLEXITY ANALYSIS
text: We detail in Algorithm 1 our pseudo-code and in Algorithm 2 how we minimize (CAL) with respect to (φ, fN ) using the dual form of Wasserstein-1 distance (6). Our method is based on a standard backpropagation strategy with gradient descent and uses gradient penalty (Gulrajani et al., 2017).
Algorithm 1 Training and inference procedure for OSTAR Training: Ŝ = {x(i)S , y (i) S }ni=1, T̂ = {x (i) T }mi=1, ZN̂ = {φ ◦ g(x (i) S ), y (i) S }ni=1, ZT̂ = {g(x (i) T )}mi=1
fS , fN ∈ H classifiers; g feature extractor; φ latent domain-mapping, v critic. Ne: number of epochs, Nu: epoch to update pYN , Ng: epoch to update g
1: Train fS , g on Ŝ to minimize source classification loss . (3) 2: Initialize pYN = 1
K 1K
3: for nepoch ≤ Ne do 4: if nepoch mod Nu = 0 then 5: Compute pYN with estimator in Lipton et al. (2018) on (ZN̂ , ZT̂ ) . (CAL) w.r.t. p Y N 6: Average pYN with cumulative moving average 7: if nepoch ≤ Ng then Train φ, v, fN with (Ŝ, T̂ ) . (CAL) + (SS) w.r.t. φ, fN 8: else Train φ, v, fN , g with (Ŝ, T̂ ) . (CAL) + (SSg) w.r.t. φ, fN
Inference: Score xT with fN ◦ g(xT)
Algorithm 2 Minimize (CAL) w.r.t. (φ, fN )
Ŝ = {x(i)S , y (i) S }ni=1, T̂ = {x (i) T }mi=1, g feature extractor, φ domain-mapping, v critic, fN classifier. Parameters of φ, v, fN : θφ, θv, θfN and learning rates αφ, αv, αfN . Niter: batches per epoch, Nb: batch size, Nv: critic iterations
1: for niter < Niter do 2: Sample minibatches xBS , y B S = {x (i) S , y (i) S } Nb i=1, x B T = {z (i) T } Nb i=1 from Ŝ, T̂ 3: Compute zBS = g(x B S ), z B N = φ ◦ g(xBS ) and zBT = g(xBT) 4: Compute class ratios: wY = pYN/p Y S 5: for nv < Nv do 6: Sample random points zB′ from the lines between (zBN, z B T) pairs 7: Compute gradient penalty Lgrad with zBN, zBT, zB ′ (Gulrajani et al., 2017)
8: Compute Lgwd = ∑Nb i=1 wy(i)S v(z (i) N )− 1
Nb
∑Nb i=1 v(z (i) T ) (6)
9: θv ← θv − αv∇θv [ Lgwd − Lgrad ] 10: Compute LgOT = ∑K k=1 1
#{y(i)S = k}i∈{1...Nb}
∑ y (i) S =k, i∈{1...Nb} ||φ(z(i)S )− z (i) S ||22
11: θφ ← θφ − αφ∇θφ [ Lgwd + L g OT ] 12: Compute Lgc(fN , N) = 1
Nb
∑Nb i=1 wy(i)S Lce(fN ◦ φ ◦ g(x(i)S ), y (i) S )
13: θfN ← θfN − αfN∇θfNL g c(fN , N)
Complexity / Runtime analysis In practise on USPS → MNIST, the runtimes in seconds on a NVIDIA Tesla V100 GPU machine are the following: DANN: 22.75s, WDβ=0: 59.25s, MARSc: 72.87s, MARSg: 2769.06s, IW-WD: 74.17s, OSTAR+IM: 89.72s. We observe that (i) computing Wasserstein distance (WDβ=0) is slower than computing H-divergence (DANN), (ii) runtimes for domain-invariant GeTarS baselines are slightly higher than for WDβ=0 as proportions are additionally estimated, (iii) domain-invariant GeTarS baselines have similar runtimes apart from MARSg which uses GMM, (iv) our model, OSTAR+IM, has slightly higher runtime than GeTarS baselines
other than MARSg. We now provide some further analysis on computational cost and memory in OSTAR. We denote K the number of classes, d the dimension of latent representations, n and m the number of source and target samples.
• Memory: Proportion estimation is based on the method in Lipton et al. (2018) and requires storing the confusion matrix Ĉ and predictions p̂YT with a memory cost of O(K
2). Encoding is performed by a deep NN g into Rd and classification by a shallow classifier from Rd to RK . Alignment is performed with a ResNet φ : Rd → Rd in the latent space which has an order magnitude less parameters than g. Globally, memory consumption is mostly defined by the number of parameters in the encoder g.
• Computational cost comes from: (i) proportion estimation, which depends onK,n+m and is solved once every 5 epochs with small runtime; (ii) alignment between source and target representations, which depends on d, n+m and Nv (the number of critic iterations). This step updates less parameters than domain-invariant methods which align with g instead of φ; this may lead to speedups for large encoders. The transport cost LgOT depends on n, d and adds small additional runtime; (iii) classification with fN using labelled source samples, which depends on d,K, n. In a second stage, we improve target discriminativity by updating the encoder g with semi-supervised learning; this depends on d,K, n+m.

heading: G EXPERIMENTAL SETUP
text: Datasets We consider the following UDA problems:
• Digits is a synthetic binary adaptation problem. We consider adaptation between MNIST and USPS datasets. We consider a subsampled version of the original datasets with the following number of samples per domain: 10000-2609 for MNIST→USPS, 5700-20000 for USPS→MNIST. The feature extractor is learned from scratch.
• VisDA12 is a 12-class adaptation problem between simulated and real images. We consider a subsampled version of the original problem using 9600 samples per domain and use pre-trained ImageNet ResNet-50 features http://csr.bu.edu/ftp/visda17/clf/.
• Office31 is an object categorization problem with 31 classes. We do not sample the original dataset. There are 3 domains: Amazon (A), DSLR (D) and WebCam (W) and we consider all pairwise source-target domains. We use pre-trained ImageNet ResNet-50 features https://github.com/jindongwang/transferlearning/blob/master/ data/dataset.md.
• OfficeHome is another object categorization problem with 65 classes. We do not sample the original dataset. There are 4 domains: Art (A), Product (P), Clipart (C), Realworld (R) and we consider all pairwise source-target domains. We use pre-trained ImageNet ResNet-50 features https://github.com/jindongwang/ transferlearning/blob/master/data/dataset.md.
Imbalance settings We consider different class-ratios between domains to simulate label-shift and denote with a ”s” prefix, the subsampled datasets. For Digits, we explicitly provide the classratios as Rakotomamonjy et al. (2020) (e.g. for high imbalance, class 2 accounts for the 7% of target samples while class 4 accounts for 22% of target samples). For Visda12, Office31 and OfficeHome, subsampled datasets only consider a small percentage of source samples for the first half classes as Combes et al. (2020) (e.g. Office31 considers 30% of source samples in classes below 15 and uses all source samples from other classes and all target samples).
Hyperparameters Domain-invariant methods weight alignment over classification; we tuned the corresponding hyperparameter for WDβ=0 in the range [10−4, 10−2] and used the one that achieves the best performance on other models. We also tuned λOT in problem (CAL) and fixed it to 10−2 on Digits and 10−5 on VisDA12, Office31 and OfficeHome. Batch size is Nb = 200 and all models are trained using Adam with learning rate tuned in the range [10−4, 10−3]. We initialize NN for classifiers and feature extractors with a normal prior with zero mean and gain 0.02 and φ with orthogonal initialization with gain 0.02.
Training procedure We fix Ne the number of epochs to 50 on Digits, 150 on VisDA12 and 100 on Office31, OfficeHome; OSTAR requires smaller Ne to converge. Critic iterations are fixed to Nv = 5 which worked best for all baseline models; for OSTAR higher values performed better. For all models, we initialize fS , g for 10 epochs with (3). Then, we perform alignment either through domain-invariance or with a domain-mapping until we reach the total number of epochs. GeTarS models IW-WD, MARSc, MARSg, OSTAR perform reweighting with estimates refreshed everyNu = 2 epochs in the first 10 alignment epochs, everyNu = 5 epochs after. OSTAR minimizes (CAL) + (SS) for 10 epochs on Digits, Office31, OfficeHome and 5 epochs on VisDA12, then minimizes (CAL) + (SSg) for remaining epochs.
Architectures For Digits, our feature extractor g is composed of three convolutional layers with respectively 64, 64, 128 filters of size 5 × 5 interleaved with batch norm, max-pooling and ReLU. Our classifiers (fS , fN ) are three-layered fully-connected networks with 100 units interleaved with batch norm, ReLU. Our discriminators are three-layered NN with 100 units and ReLU activation. For VisDA12 and Office31, OfficeHome, we consider pre-trained 2048 features obtained from a ResNet-50 followed by 2 fully-connected networks with ReLU and 100 units for VisDA12, 256 units for Office31, OfficeHome. Discriminators are 2-layer fully-connected networks with respectively 100/1 units on VisDA12, 256/1 units on Office31, OfficeHome interleaved with ReLU. Classifiers are 2-layer fully-connected networks with 100/K units on VisDA12, single layer fully-connected network withK units on Office31, OfficeHome. φ is a ResNet with 10 blocks of two fully-connected layers with ReLU and batch-norm.
Implementation of target proportion estimators OSTAR and IW-WD use the confusion based estimator in Lipton et al. (2018) and solve a convex optimization problem ((4) in Combes et al. (2020) and CAL w.r.t pYN for OSTAR) which has an unique solution if the soft confusion matrix C is of full rank. We implement the same optimization problem using the parallel proximal method from Pustelnik et al. (2011) instead of cvxopt2 used in Combes et al. (2020). MARSc and MARSg (Rakotomamonjy et al., 2020) use linear programming with POT3 to estimate proportions with optimal assignment between conditional distributions. Target conditionals are obtained with hierarchical clustering or with a Gaussian Mixture Model (GMM) using sklearn4. MARSg has some computational overhead due to the GMM.
2http://cvxopt.org/ 3https://pythonot.github.io/ 4https://scikit-learn.org/

Review summaries:
This paper proposes a method for unsupervised domain adaptation under conditional and label shift, one of the most challening versions of DA. At the core of this method is an optimal transport problem that seeks a mapping between source and target domains *and* a class proportion vector that minimize a total transportation cost between the domains. Based on this formulation, and a set of 4 sensible assumptions, the paper provides theoretical results in the form of unicity of the solution and classic generalization bound on the target domain risk. The implemented algorithm is inspired (though not identical) to this objective, which is extended with a few other terms: a constraint on the the label proportions based on a confusion matrix, a classification loss for the mapped source samples, and a relaxed version of the OT's pushforward constraint, and finally, two objectives that seek to improve the discriminativity of target representations. The paper then proceeds to validate the propose method in a wide array of benchmark DA datasets, with various levels of class unbalance, whereby it shows that the method repeatedly and significantly outperforms SOTA UDA alternatives. 

In this paper, the authors unsupervised domain adaptation (UDA) where both the label conditional and marginal distributions are different between the source and target domains (GeTarS). The authors propose an approach, OSTAR, to align pretrained representations under GeTarS. A new theoretical bound under some assumptions is derived. Experimental studies also show the effectiveness of OSTAR. 

The paper proposes an approach for Generalized Target Shift (GeTarS) where both conditional and label shift are present in the target domain. The proposed approach, Optimal Sample Transformation and Reweight (OSTAR), uses optimal transport to transform the latent space and uses information maximization to refine the classifier's decision boundaries. Theoretical analysis shows the proposed approach minimizes the the components in the target risk's upper bound. Empirical studies are carried out on three datasets and ablation studies were carried out to analyze the impact of MI.