D OMAIN -I NVARIANT R EPRESENTATIONS : A L OOK ON C OMPRESSION AND W EIGHTS
Anonymous authors
Paper under double-blind review
A BSTRACT
Learning Invariant Representations to adapt deep classiﬁers of a source domain to a new target domain has recently attracted much attention.
In this paper, we show that the search for invariance favors the compression of representations.
We point out this may have a bad impact on adaptability of representations expressed as a minimal combined domain error.
By considering the risk of compression, we show that weighting representations can align representation distributions without impacting their adaptability.
This supports the claim that representation invariance is too strict a constraint.
First, we introduce a new bound on the target risk that reveals a trade-off between compression and invariance of learned representations.
More precisely, our results show that the adaptability of a representation can be better controlled when the compression risk is taken into account.
In contrast, preserving adaptability may overestimate the risk of compression that makes the bound impracticable.
We support these statements with a theoretical analysis illustrated on a standard domain adaptation benchmark.
Second, we show that learning weighted representations plays a key role in relaxing the constraint of invariance and then preserving the risk of compression.
Taking advantage of this trade-off may open up promising directions for the design of new adaptation methods.
I NTRODUCTION
In a standard Supervised Learning setup, we consider that training data is representative of testing data.
This ideal framework is often violated in practical applications since the data generative process can be altered during the application phase e.g. different pre-processing, sample rejection, imbalanced classes, condition of data collection, time evolving data...
This so-called Distributional
Shift situation (Quionero-Candela et al.
(2009); Kull & Flach (2014)) is recognized as a major challenge in Machine Learning (Amodei et al.
Domain Adaptation (DA) (Pan & Yang (2009)) is a widely adopted strategy to mitigate its effects.
It consists in leveraging unlabeled testing data (the target domain ) in order to transfer knowledge learned on labeled training data (the source domain ).
A ﬁrst line of study, named Importance Sampling (IS), assumes some stationarity in distributions in order to approximate the risk in the target domain by weighting sample contribution (Shimodaira (2000);
Huang et al.
To be applied, IS needs statistical support sharing across domains limiting its range of application when addressing high dimensional data.
In that challenging context, Ganin & Lempitsky (2015) have shown that deep classiﬁers can be adapted to a new target domain by learning domain Invariant Representations (IR) and ﬁnd theoretical support in the work of Ben-David et al.
It assumes that a classiﬁer trained on representations of labeled data sampled from both domains will achieve a negligible combined error ( adaptability ).
However, enforcing distribution invariance in the representation space can badly impact its adaptability, for instance in the context of Target Shift (Zhao et al.
or when the support of the distributions do not overlap enough (Johansson et al.
In the most general case of DA, it is not clear how
IR helps aligning domains and removing spurious correlations as pointed by Arjovsky et al.
In the present work, we show that the search of invariance favors learning representations with a signiﬁcant loss of information from the original features.
We refer to this phenomenon as the risk of Compression .
In our understanding, this risk is not addressed in the original work from
Ben-David et al.
We demonstrate that taking into account this risk has two major advantages.
First, it provides a better control on (non-trainable) terms involving the labels in the target domain.
Second, it introduces a new trainable term which embodies a risk of Compression and then may open-up the path to new learning methods.
We provide a theoretical analysis illustrated with experiments on a standard Domain Adaptation benchmark.
We underline that a better control on non-trainable terms may lead to an over-pessimistic risk of compression.
This brings to light an inherent trade-off when learning representations for domain adaptation: How much compression risk is acceptable in order to obtain invariance?
As a ﬁrst try to answer to this question, we point that Learning Weighted Representations plays a key role in aligning representation distributions in order to obtain invariance.
More precisely, we show that under a constraint of strong source risk conservation , weighting representations does not impact its adaptability.
B ACKGROUND 2. A DECADE OF D OMAIN A DAPTATION
The classical setup for modelling distributional shift is to introduce two domains: the source domain i.e. dataset where the model is trained with supervision and the target domain i.e. where the model is tested or applied.
Formally, for two random variables ( X, Y ) of a given space X × Y , we introduce two distributions on X × Y : the source distribution P s ( X, Y ) and the target distribution P t ( X, Y ) .
We use the exponent notation s and t to differentiate source and target terms.
We deﬁne the hypothesis space H as a subset of functions from X to Y .
The distributional shift situation is then characterized by the shift: P s ( X, Y ) (cid:54) =
P t ( X, Y ) .
Learning under Distributional Shift (Quionero-Candela et al.
(2009)) consists in minimizing the risk on the target domain ε t ( h ) =
E t [ (cid:96) ( h ( X ) , Y )] for a given loss (cid:96) :
Y × Y → R + and an hypothesis function h ∈ H .
Assuming that w ( X, Y ) =
P t ( X, Y ) / P s ( X, Y ) is tractable, it is straightforward to show that:
[Equation]
Roughly speaking, this equation shows that it is possible to minimize the target risk using data ( x si , y si ) 1 ≤ i ≤ n s sampled from the source domain ( i.e. ( x i , y i ) ∼ P s ( X, Y ) ) while re-weighting their contribution in the source expectation with a factor w ( x i , y i ) ( Importance Sampling ).
The difﬁculty of Learning under distributional shift arises when w ( x i , y i ) is not tractable.
The ﬁrst reason is that data sampled from P t ( X, Y ) is often not easily available.
In order to get a reasonable estimation of w , practitioners are used to reformulate the problem as Unsupervised Domain Adaptation .
Deﬁnition 1 (Unsupervised Domain Adaptation) .
Given a loss (cid:96) , an hypothesis class H , a source domain ( X ×Y , P s ( X, Y )) and a target domain ( X ×Y , P t ( X, Y )) , Unsupervised Domain Adaptation consists in minimizing the target risk (i.e. ﬁnding h (cid:63) =
arg min h ∈H E t [ (cid:96) ( h ( X ) , Y )] ) with ﬁnite labeled sampling of ( x si , y si ) ∼ P s ( X, Y ) of the source domain and a ﬁnite unlabeled sampling ( x tj ) ∼ P t ( X ) of the target domain.
If unlabeled samples in the target domain are available, a ﬁrst idea is then to approximate w ( X, Y ) by w ( X ) =
P t ( X ) / P s ( X ) .
This is equivalent to assuming that conditional distributions are conserved across domains ( i.e. P s ( Y | X ) =
P t ( Y | X ) ), a situation known as Covariate Shift , that has already been the subject of an extensive literature (Sugiyama et al.
; Huang et al.
This formulation becomes ill-posed when feature domains ( X , P s ( X )) and ( X , P t ( X )) suffer from non-overlapping support: w ( X ) is then undeﬁned.
To address this issue, Invariant Representations learning (Long et al. (2015)) performs adaptation by looking for a representation Z
= ϕ ( X ) whose distribution is conserved across domains P s ( Z ) =
P t ( Z ) .
A common strategy consists in extracting features Z to learn labels Y in the source domain while controlling representation invariance.
That is formulated as follows:
Learning Objective 1 (Learning Invariant Representations for Domain Adaptation) . [Equation]
[Equation]
where G is the set of classiﬁers and Φ is the set of representations.
The hypothesis space is then deﬁned as H =
{ g ◦ ϕ : g ∈ G , ϕ ∈ Φ } .
D ( s,t ) ( ϕ ) is a distance between distributions P s ( Z ) and P t ( Z ) and α is a trade-off parameter.
The choice of D ( s,t ) ( ϕ ) has been the object of an extensive literature including f − divergence measures such as domain adversarial learning ( ?
Tzeng et al.
(2014); Long et al.
Integral Probability Measures such as Maximum Mean Discrepancy (Long et al. (2015; 2016)) or Optimal Transport (Shen et al.
See Kouw & Loog (2019) for an extensive review.
Interestingly, learning invariant representations to perform adaptation ﬁnds theoretical support from the work of Ben-David et al.
(2007; 2010) that we recall in the next section.
2. T HEORETICAL GUARANTEES OF D OMAIN A DAPTATION
We consider the set of representations Φ and classiﬁers G .
The hypothesis space is denoted H = { g ◦ ϕ : g ∈ G , ϕ ∈ Φ } .
We introduce the loss (cid:96) :
Y × Y → R + which is assumed symmetric and veriﬁes the triangular inequality.
We note the risk ε ( h ) =
E [ (cid:96) ( Y, h ( X ))] for h ∈ H and ε ( h, h (cid:48) )
=
E [ (cid:96) ( h ( X ) , h (cid:48) ( X ))] for ( h, h (cid:48) )
∈ H 2 .
To emphasize the role of a representation Z = ϕ ( X ) , we introduce ˜ f
( Z ) =
E [ Y | Z ] and ˜ H
= { g ◦ ϕ : g ∈ G} ⊂ H .
We underline that ˜ · quantities depend on ϕ where, for the ease of reading, this dependence is omitted in notations when it is not ambiguous.
Ben-David et al.
(2007; 2010) have derived a theoretical bound of the additional risk when using a representation Z = ϕ
( X ) rather than raw features X :
Inequality 1 (Ben-David et al.
For a given ϕ ∈ Φ and g ∈ G , there is:
[Equation]
[Table]
+
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
The inequality 1 ensures that the target risk is bounded by the sum of the source risk, the disagreement risk between two classiﬁers from representations ( d ( ˜ H ∆ ˜ H ) named ˜ H ∆ ˜ H distance), and a third term ( λ ( ˜ H ) ) which quantiﬁes the ability to perform well in both domains from representations.
In the rest of the paper, we refer to the latter as the adaptability .
Since E t [ Y | X ] is unknown, λ ( ˜ H ) is intractable in practical applications.
By conveniently assuming that λ ( ˜ H ) is negligible, it is possible to derive a Learning Objective 1 which minimizes ˜ ε s ( g ◦ ϕ )
+ 12 d ( ˜ H ∆ ˜ H ) .
Indeed, minimizing D ( s,t ) on ϕ leads to learn representations Z = ϕ ( X ) such that P s ( Z ) =
P t ( Z ) , where such situation is sufﬁcient to ensure that d ( ˜ H ∆ ˜ H ) = 0 .
2. T HE CURSE OF INVARIANCE IN D OMAIN A DAPTATION
Compressing representations is an easy way to achieve invariance.
Assume X s ∼ N (0 , 1) , X t ∼
U ( − 1 , 1) and Y = 1 X> 0 then a trivial way to obtain representations invariance while separating source data is to consider ϕ : x (cid:55)→ 1 x> 0 .
The main drawback is a potential loss of information from the original feature space.
To explain this phenomenon, we ﬁrst introduce formally the notion of
Hypothesis space compression :
Deﬁnition 2 (Hypothesis space compression) .
Let ( ϕ 1 , ϕ 2 ) ∈
Φ 2 , ϕ 1 compresses more H if ˜
H ( ϕ 1 ) ⊂
˜ H ( ϕ 2 ) .
By language abuse, we will say that Z 1 = ϕ 1 ( X ) is more compressed than
Z 2 = ϕ 2 ( X ) .
Second, we build two possible solutions ( g 1 , ϕ 1 ) and ( g 2 , ϕ 2 ) of Learning Objective 1 by considering the following compositions X
→ ϕ Z 1 → ψ Z 2 → g ˆ Y such that ϕ and ψ ◦ ϕ are both in Φ and g and g ◦ ψ are both in G .
We set g 1 = g ◦ ψ , ϕ 1 = ϕ
and g 2 = g , ϕ
=
ψ ◦ ϕ .
These solutions are chosen to ensure that g 1 ◦ ϕ [Equation] = g [-2 ◦ ϕ 2 and Z 
-][Equation]
◦ ϕ 2 and Z 2 = ϕ 2 ( X ) is more compressed than Z
= ϕ 1 ( X ) .
In the case when D ( s,t ) is the Jensen divergence, the data processing inequality (see Lemma 4.6 in
Zhao et al.
(2019)) implies that ( g 2 , ϕ 2 ) is a better optimum than ( g 1 , ϕ 1 ) according to Learning
Objective 1 since ε s ( g 1 ◦ ϕ 1 ) =
ε s ( g 2 ◦ ϕ 2 ) and D ( s,t ) ( ϕ 2 ) ≤ D ( s,t ) ( ϕ 1 ) .
To conclude, learning under objective 1 will favor compressed representations to enforce invariance.
However, as noted in
Johansson et al.
; Zhao et al.
Liu et al.
(2019), more compressed representations will degrade adaptability.
Indeed,
[Equation]
since ˜ H ( ϕ 1 ) ⊂ ˜ H ( ϕ 2 ) .
A question which remains not addressed in the literature (except in Johansson et al.
under the Covariate Shift assumption) is:
How compression may increase the risk of bad adaptability?
Source
Target h
= g  ' h
=
g  '
Positive Negative  ' '
Source
Target
Positive Negative ˜ h
= g  '
˜ H
h = g  ' 0
˜ H s
T HEORETICAL ANALYSIS OF C OMPRESSION 3. W ORKING PLAN
Our strategy aims to compare a representation ϕ with representations ϕ (cid:48) which act similarly on the source domain but differently on the target domain ( source equivalence ).
First, by allowing to compute the minimal combined error on source equivalent representations ϕ (cid:48) , we limit the risk of bad adaptability of a ﬁxed representation.
Through an inequality called Target Compression , we show this new control of adaptability comes at the cost of a new risk which embodies the Compression .
This is done by studying the projection of an hypothesis deﬁned as its best approximation from representations in the target domain among those that conserve the source domain error ( source conservation ).
Second, we rely on the ˜ H ∆ ˜
H inequality (Ben-David et al.
for stating a new bound of the target risk ( Invariant and Compressed Representations inequality).
Finally, we expose the particular interest of this bound: it allows a better control on adaptability by considering compression.
This is formulated by the Invariance - Compression trade-off .
3. N OTATIONS AND D EFINITIONS
In the following, we ﬁx a given ϕ ∈ Φ .
We restrict our analysis to the case of (cid:96) :
( y, y (cid:48) )
∈ Y 2 (cid:55)→ ( y − y (cid:48) )
2 as a convenient choice for manipulating properly ˜ f
( Z ) =
E [ Y | Z ] .
Note that in the binary classiﬁcation case ( Y = { 0 , 1 } ), (cid:96) is the accuracy.
We deﬁne the set of representations which act similarly on the source domain but differently in the target domain:
Deﬁnition 3 (Source equivalence) .
We introduce the set of source equivalent representations ˜Φ s = { ϕ (cid:48) ∈ Φ , ϕ (cid:48)
=
ϕ on D s } (where D s = supp( P s ( X )) ) and the source equivalent hypothesis space ˜
H s = { g ◦ ϕ (cid:48) : g ∈ G , ϕ (
cid:48) ∈ ˜
Φ s } .
Two elements of ˜ Φ s are said source equivalent.
The source equivalent hypothesis space ˜
H s is an extension of ˜ H adding hypothesis built using representations which are source equivalent to ϕ .
For a given h ∈ ˜ H s , we exhibit an interesting subset of ˜ H considering hypothesis with the same source error than h .
Deﬁnition 4 (Source conservation) .
For a given h ∈ ˜ H s , we note ˜
H
h
= { h (cid:
) ∈
˜ H : ε s ( h, h (cid:48) )
= 0 } .
It is worth noting that for all h ∈ ˜ H s ,
˜ H h is not empty (see Appendix A for details).
We are now ready to introduce the projection of an hypothesis h ∈ ˜ H s and to this purpose, we note ϕ (cid:
) ∈
˜Φ s and g (cid:48) ∈ G such that h = g (cid:48) ◦ ϕ (cid:48) .
Intuitively, the projection of h is deﬁned as its best approximation from ϕ in the target domain among those which verify the source conservation i.e. from hypothesis g ◦ ϕ with g ∈ G such that
ε s ( g ◦ ϕ, h ) = 0 .
Deﬁnition 5 (Projection) .
π : ˜ H s → ˜ H is deﬁned as follows:
π ( h ) =
arg min h (cid:48) ∈
˜ H h ε t ( h, h (cid:48) ) for h ∈ ˜ H s .
π ( h ) is called the projected hypothesis.
If there is no uniqueness of the minimum, any solution works.
Illustrations of introduced deﬁnitions are provided in Figure 1.
If h = g ◦ ϕ ∈ ˜ H , the projection aims to map h to g (cid:48) ◦ ϕ with g (cid:48)
=
g both in source and target L 2 norms.
If, h = g (cid:48) ◦ ϕ (cid:48) with ϕ (cid:48) ∈
˜Φ , the projection aims to map h to g ◦ ϕ such that g = g (cid:48) in source L 2 norm while g ◦ ϕ achieves a minimal distance with g (cid:48) ◦ ϕ (cid:48) in target L 2 norm.
We can observe that ∀ h ∈ H s , π ◦ π ( h ) =
π ( h ) in both source and target L 2 norms hence the (abusive) analogy with projection.
For ease of reading, we remind the notations and deﬁnitions in appendix B.
3. O UR CONTRIBUTION
In the following, we ﬁx a given H ◦
such that ˜ H
⊂ H ◦ ⊂ ˜
H s .
We are now ready to state a new bound of the target risk:
Inequality 2 (Target Compression) .
Given g ∈ G and noting ˜ h
= π ( h ) , we have:
[Equation]
Proof.
See Appendix A.
This inequality introduces two interesting terms ˜ γ
( H ◦ ) and ˜ λ t ( H ◦ ) with opposite roles; the former involves a supremum while the latter involves an infremum on H ◦ .
The term ˜ λ t ( H ◦ ) is very similar to the adaptability λ
( ˜ H ) from Inequality 1 and will be further investigated.
Before, we focus on the term ˜ γ
( H ◦ ) which reﬂects the possibility of ﬁnding hypotheses in H ◦ that can not be well approximated from target representations.
The more information is lost from raw features, the higher the risk, hence its name Compression .
This can be formally stated as follows:
Theorem 1 ( γ embodies the risk of compression) .
Let ( ϕ 1 , ϕ 2 ) ∈
Φ 2 two source equivalent source representations.
If ϕ 1 is more compressed than ϕ 2 , then γ ( ϕ 1 , H ◦ ) ≥ γ ( ϕ 2 , H ◦ ) .
Proof.
If ϕ 1 is more compressed than ϕ 2 , there is ˜ H ( ϕ 1 ) ⊂
˜ H ( ϕ 2 ) ⊂ ˜ H s then ∀ h ∈
˜
H s , ˜
H h ( ϕ 1 ) ⊂ ˜
H h ( ϕ 2 ) .
The projection involves an infremum then ε t ( h, ˜ h
( ϕ 2 )) ≤ ε t ( h, ˜ h
( ϕ 1 )) where ˜ h ( ϕ ) =
arg min h (cid:48) ∈
˜
H h ( ϕ )
ε t ( h, h (cid:48) ) .
The supremum on h ∈ H ◦ conserves the inequality.
We now focus our attention on ˜ λ
t ( H ◦ ) .
It differs with λ ( ˜ H ) in two ways.
First, the source labelling function is involved only with the intermediate ˜ f s ( Z ) =
E s [ Y | Z ] .
Second, the risk associated with it ( ε t (˜ h, ˜ f
s ◦ ϕ ) )
involves a target expectation.
In order to obtain a comparable bound with Inequality 1, we state a new bound of the target risk which is our main contribution:
Inequality 3 (Invariant and Compressed Representations) .
Given g ∈ G and noting ˜ h
= π ( h ) , β = 2 inf h ∈ ˜
H ε s ( h ) + ε t ( h, ˜ f s ) , we have:
[Equation]
Proof.
See AppendixA.
The main idea is to bound ε t ( h, ˜ f
s ◦ ϕ ) and ε t (˜ h, ˜ f s ) using ˜ H ∆ ˜ H inequality.
This introduces respectively ε s ( h, ˜ f
s ◦ ϕ ) and ε s (˜ h, ˜ f
s ◦ ϕ ) with residual terms 12 d ( ˜ H ∆ ˜ H )
+ 12 β (two times).
We use the source risk conservation to bound ε s (˜ h, ˜ f
s ◦ ϕ ) ≤ ε s ( h, ˜ f
s ◦ ϕ ) .
Then we bound ε s ( h, ˜ f
s ◦ ϕ ) ≤ ε s ( h ) leveraging the Pythagorean theorem since (cid:96) is the L 2 norm.
We are now ready to show the better control of the adaptability of the representation ϕ :
Theorem 2 (Better control of adaptability) .
˜ λ
( H ◦ ) ≤ λ ( ˜ H ) .
The proof is given by the infremum on H ◦ ⊃ ˜ H .
Compression ˜ γ ( H ◦ ) and adaptability ˜ λ
( H ◦ ) have an opposite behavior.
This reﬂects an interesting trade-off:
Theorem 3 (Invariance and Compression trade-off) .
With H 1 ◦ and H 2 ◦
such that ˜ H ⊂
H 1 ◦ ⊂ H 2 ◦ ⊂ ˜
H s , there is ˜ λ
( H 1 ◦ ) ≥ ˜ λ
( H 2 ◦ ) and ˜ γ ( H 1 ◦ ) ≤ ˜ γ
( H 2 ◦ ) .
The proof is obtained by observing that H 1 ◦ ⊂ H 2 ◦ .
Even if invariance may have a bad impact on adaptability, our bound shows it is possible to have a better control of the adaptability while conserving the same degree of invariance.
This control comes at the cost of an additional term involving compression of representations.
The trade-off between invariance and compression emphasizes than the more control there is over adaptability, the higher the risk associated with compression.
Furthermore, this new bound has a particular interest in providing theoretical support for the construction of new learning objectives.
The difﬁculty in DA comes from in the fact that the adaptability is not trainable since it uses the labelling function in the target domain.
Our study shows that better control of adaptability ( i.e. making the adaptation more reliable) is possible.
The two additional terms β and ˜ γ ( H ◦ ) can indeed be trained in an Unsupervised Domain Adaptation setting 1 .
E XPERIMENTS
We are now conducting an experimental analysis on a widely used DA benchmark of digits recognition (MNIST, USPS).
We study two tasks M
→ U and U
→ M under the Learning Objective 1.
The representation ϕ is a convolutional neural network with a LeNet architecture (LeCun et al.
We set the dimension of representations to 50 and G is the set of linear classiﬁers from the representation space to classes (with a softmax layer on top) and the Domain Adversarial Neural Network (DANN Ganin & Lempitsky (2015)) for D ( s,t ) .
We use the implementation from Long et al.
(2018) for good reproductibility.
Models are trained during 30 epochs and we note ˆ ϕ the learned representation.
In the following, we note CE the cross-entropy.
We suggest to study the trade-off between compression and invariance with the family:
[Equation]
We interpret this choice as a method for testing robustness of the learned representation to adversarial attacks in the target domain.
Enforcing h ∈ H η ◦ . Enforcing h ∈ H η ◦ is challenging in practrice.
We suggest to rely on a penalization L ◦ to promote ϕ ≈ ˆ ϕ (in the sense of P s ) and || ϕ − ˆ ϕ ||
(cid:46) η
· || ˆ ϕ
|| (in the sense of P t ).
We deﬁne the penalization
L ◦ as follows:
[Equation] Source conservation. For a given h , the projected hypothesis is deﬁned as ˜ h = ˜
g ◦ ˆ ϕ where ˜ g is obtained by minimizing on g :
[Equation] with λ π = 0 . 9 for enforcing the source conservation. Estimation of ˜ λ
( H ◦ ) .
We suggest to minimize on ( g, ϕ ) ∈ H the following loss: [Equation]
with λ ◦ = 10 2 . CE t ( g ◦ ϕ
( X ) , Y ) and
CE s ( g ◦ ϕ ( X ) , Y ) are respectively two proxies of ε t ( h ) and ε s ( h ) . L ◦ ( ϕ ) promotes h ∈ H η ◦ .
Estimation of ˜ γ ( H ◦ ) . We follow an adversarial training procedure alternating between 1. maximizing an objective Γ( g, ϕ ) on h =
g ◦ ϕ ∈ H ◦ (sup step) 2. computing the projected hypothesis (inf step)
During experimentation, we have observed that simply setting Γ( g, ϕ ) = − Π(ˆ g ◦ ˆ ϕ, g ◦ ϕ )
+
λ ◦ L ◦ ( ϕ ) (where ˆ g ◦ ˆ ϕ is an estimation of the projected hypothesis) leads to learn noisy labels.
We suggest to prevent such pathological solutions by enforcing a low entropy adding to Γ a regularizer λ ent · CE ( h ( X ) , ˆ Y ) with ( ˆ Y = y )
= 1 ( h ( X ) =
y ) with λ ent = − 1 .
Then, we set:
[Equation] Furthermore, for a fair comparison, we correct γ by comparing it with a baseline.
This baseline is allowed to train representations to ﬁt the adversary.
[-H η ◦ = { g ◦ ϕ (cid:
-]
Analysis We build new target domains modifying the label distribution which is known to badly impact λ ( ˜ H ) (Johansson et al.
; Zhao et al.
For a given target dataset D with classes balanced, we deﬁne D 1 ⊂ ...
⊂ D 6 as follows: for 1 ≤ i ≤ 6 , D i is obtained by removing half of digit < i from
{+D i − 1 and setting D 
+}
= D . Main results are reported in Figure 2. Although estimator are trained using cross-entropy, the results are reported computing the accuracy on a test set in order to be consistent with our theoretical analysis. We can observe that stronger the adversary is ( α → 1 ) (and the more the target shift ( i → 6 for D i )), the more signiﬁcant the difference between λ ( ˜ H ) and ˜ λ
( H ◦ ) . This demonstrates a better control over adaptability especially when IR fails to perform adaptation. By playing with the value of η , we see that the better control on adaptability is paid to the cost of a higher γ . In our example, the risk of compression is estimated to a potential drop of performances from ∼ 12.5% to ∼ 27.5% of accuracy in the target domain while the gain on adaptability is marginal by reducing it of ∼ 4%.
To conclude, a better control on adaptability is obtained with a pessimistic estimation of the risk of compression.
W EIGHTS FOR INVARIANCE RELAXATION
The fact that compression and invariance are conﬂicting objectives supports the point from Wu et al.
(2019) which claims that invariance is too strict a constraint.
In this section, we show that invariance can be relaxed leveraging Weighted Representations .
More speciﬁcally, we show that taking into account the risk of compression leads to introduce an adaptability term which does not depend on learned weights.
Then, weighting representations can reduce the discrepancy between the source and the target distributions without impacting the adaptability.
We introduce the set of weights W , a subset of functions w : X → R + such that E s [ w ( X )]
=
and we note for w ∈ W , P w · s ( X ) :
= w ( X ) P s ( X ) .
The condition E s [ w ( X )]
= 1 ensures that P w · s ( X ) is a distribution.
We state a similar result than Inequality 1.
Inequality 4 (Weighted version of Inequality1) .
For a given ϕ ∈ Φ and g ∈ ˜ H ,
[Equation]
(12) with d w ( ˜ H ∆ ˜ H ) =
sup ( h,h (cid:48) ) ∈
˜ H | ε w · s ( h, h (cid:48) )
− ε t
( h, h (cid:48) )
| and λ w = inf h ∈ ˜
H ε t ( h ) + ε w · s ( h ) .
Interestingly, w and ϕ play similar role in inequality 4 since they are actionable parameters to minimize ε w · s ( g ◦ ϕ ) + 12 d w ( ˜ H ∆ ˜ H ) while we can not quantify their impact on λ w ( ˜ H ) .
We show that taking advantage of compression leads to an adaptability which does not depend on weights.
This needs to introduce some deﬁnitions: source conservation)
[-= { h (cid:
-]
Deﬁnition 7 (Strong projection) .
Π : ˜ H s → ˜ H is deﬁned as follows
[Equation]
for h ∈ ˜ H s .
If there is no uniqueness of the minimum, any solution works.
We are now ready to state the role of weights as a relaxed invariance for a lower compression:
Inequality 5 (Weighting Invariant and Compressed Representations) .
Given g ∈ G and noting h = Π (
[Equation]
[Equation] ∈ [Equation] H ε w · s ( h ) + ε t ( h, ˜ f s ) , we have:
[Equation]
Proof.
This is a straightforward extension of inequality 2 applied to P w · s .
Furthermore,
[Equation] does not depend on w due to strong risk conservation (risk conservation would have been dependent on w through the constraint ε w · s ( h, ˜ h ) = 0 ).
Adding weights exposes to the risk of increasing the variance of estimators when considering ﬁnite sampling analysis (see Cortes et al.
for an extensive theoretical analysis of Importance Sampling).
In inequality 5, this can be controlled with a good choice of W e.g. by considering weights w ≤ M for a given M > 0 .
R ELATED WORK
Generalization bounds for DA have been the object of an extensive literature for both Importance
Sampling Cortes et al.
and Invariant Representations Ben-David et al.
; Mansour et al.
It has attracted a lot of attention in order to understand failure cases observed when using IR (Zhao et al.
; Johansson et al.
The theoretical analysis in Johansson et al.
(2019) is the work closest to ours.
They introduce a loss information metric which quantiﬁes the risk of using non-invertible representations.
The present work differs in three ways.
First, our work follows the formalism introduced in Ben-David et al.
(2007) which is widely adopted in the community.
Second, contrary to the information loss , our theory provides a tractable risk of compressing representations.
Finally, we do not rely on the Covariate Shift assumption which gives our work a broader range of applications.
C ONCLUSION
By addressing domain generalization under the perspective of compression, we have bounded the target risk by a sum of trainable terms ( ε s ( g ◦ ϕ )
+ d ( ˜ H ∆ ˜ H ) + β + ˜ γ
( H ◦ ) ) and a term ˜ λ
( H ◦ ) which embeds a new adaptability criterion of representations.
We have shown that ˜ λ
( H ◦ ) can be better controlled by enriching the hypothesis class H ◦ .
This control comes at a cost of a higher risk of compression underlying a trade-off between invariance and compression when learning IR for
DA.
Through an empirical study on a standard benchmark, we have exhibited the better control of adaptability.
Furthermore, we have shown how our framework can be applied for studying adaptation robustness to adversarial attacks.
Finally, as an attempt to obtain representation distributions invariance with a lower compression, we have emphasized the role of weighted representations for relaxing the constraint of invariance.
Achieving representation invariance can reduce the generalization gap between two domains. However, all invariances will not have the same guarantees for better generalization. Our work shows that we will look for representations which preserve the best the information in the original target features spaces. We leave both the design on new Domain Adaptation methods which incorporate such consideration and relevant design of H ◦ as future works.
Promising directions (1) Our analysis is restricted to the comparison among source equivalent representations of a given representation ϕ ∈ Φ .
Then, for two given representations ϕ 1 and ϕ 2 of Φ which does not verify the source equivalence, our analysis does not allow to state if ϕpresents, or not, better guarantees on the success of the adaptation.
Understanding how the source equivalence can be relaxed can provide to the present work a broader range of applications.
Obtaining a robust estimation of ˜ γ ( H ◦ ) by following an adversarial training procedure appeared to be challenging in practice.
Finding fast and robust estimations of ˜ γ ( H ◦ ) (or a proxy of it) may help to derive new learning objectives or policy for model selection.
For instance, Information
Theory gives better suited devices for modelling the phenomenon of compression.
A strategy may to enforce invariance directly in the target domain by transporting source samples.
Formally, assuming D s ∩ D t = ∅ , we set ϕ
such that ϕ ( X ) =
X on D t and ϕ
( D s )
⊂ D t .
If ϕ is ﬁxed in the source domain ( i.e. ϕ |D s is ﬁxed)
the optimal representation from the compression perspective is ϕ |D t ( X )
=
X .
This consideration is connected with two recent trends which perform adaptation by generating cross domain samples (Sankaranarayanan et al.
; Hoffman et al.
; Bousmalis et al.
(2016)) or by ﬁnding Optimal Transport between the source and the target domains (Courty et al.
(4) The Covariate Shift assumption can be stated as
H ◦ = { h ∈ H , ε s ( h, ˆ h ) = 0 with ˆ h = arg min h ∈H ε s ( h ) } .
Such H ◦ may provide a new frame- work for addressing the case of non-overlapping supports in Covariate Shift adaptation.
A M AIN P ROOFS
Proposition 1 (The source conservation hypothesis is not empty) .
For a given ϕ ∈ Φ and h ∈ ˜ H s , ˜
H h is not empty.
Proof.
If h ∈ ˜ H s , it exists g ∈ G and ϕ (cid:48) ∈
Φ such that h = g ◦ ϕ (cid:48) .
We set h (cid:48)
=
g ◦ ϕ ∈ ˜ H , there is ε s ( h, h (cid:48) )
=
ε s ( g ◦ ϕ (cid:48) , g ◦ ϕ )
=
ε s ( g ◦ ϕ, g ◦ ϕ )
=
since ϕ = ϕ (cid:48) on D s then h (
cid:48) ∈
˜
H h .
Inequality 6 (Target Compression) .
Given ϕ ∈ Φ , g ∈ G and noting ˜ h
= π ( h ) , there is for any H ◦
such that ˜ H
⊂ H ◦ ⊂ ˜
H s :
[Equation]
Proof.
Let ϕ ∈ Φ , g ∈ G and
h ∈ H ◦ :
[Equation]
This is a succession of triangular inequalities which involve respectively ˜
f s ◦ ϕ , h and ˜ h .
The last inequality is a convenient arrangement of terms.
We bound ε t ( h, ˜ h ) by its supremal value for h ∈ H ◦ , then ε t ( g ◦ ϕ ) ≤ ε t ( ˜ f s ◦ ϕ, g ◦ ϕ ) + sup h ∈H ◦ { ε t ( h, ˜ h ) } + ε t ( h ) + ε t (˜ h, ˜ f
s ◦ ϕ ) .
Since this holds for all h ∈ H ◦ , we bound ε t ( g ◦ ϕ ) by the infremum for h ∈ H ◦ .
Inequality 7 (Invariant and Compressed Representations) .
Given ϕ ∈ Φ , g ∈ G and noting ˜ h
= π ( h ) , β = 2 inf h ∈ ˜
H ε s ( h ) + ε t ( h, ˜ f s ) , there is for any H ◦
such that ˜ H
⊂ H ◦ ⊂ ˜
H s :
[Equation] [Equation]
Proof.
First of all, we recall the ˜ H ∆ ˜
H inequality from Ben-David et al.
(2007; 2010), for any f s and f t , there is:
[Equation]
A particular case of that inequality applied to f s = f t = ˜
f
s ◦ ϕ leads to bound:
[Equation]
where bounding ε s ( g ◦ ϕ, ˜ f
s ◦ ϕ ) ≤ ε s ( g ◦ ϕ ) is a direct property of (cid:96) ( y, y (cid:48) )
= ( y − y (cid:48) ) 2 and ˜ f s ( Z ) =
E s [ Y | Z ] : ε s ( g ◦ ϕ )
=
ε s ( g ◦ ϕ, ˜ f
s ◦ ϕ )
+ ε s ( ˜ f
s ◦ ϕ ) .
Note that, it is not possible to do so for ε t ( g ◦ ϕ, ˜ f
s ◦ ϕ ) since the expectation is computed in the target domain.
We deﬁne β = 2 inf h ∈ ˜
H ε s ( h ) + ε t ( h, ˜ f
s ◦ ϕ ) .
We apply a second time ˜
H ∆ ˜
H inequality, there is for any h ∈ H ◦ :
[Equation]
which is licit since ˜ h ∈ ˜ H .
Relying on the projected hypothesis ˜
h allows us to preserve the invariance: even if h ∈ H ◦ , d ( ˜ H ∆ ˜ H ) is involved, not d ( H ◦ ∆ H ◦ ) .
Then, we use the property of source risk conservation h ∈ H which enforces ε s (˜ h, h ) = 0 for noting that ε s (˜ h ) ≤
ε s ( h ) + ε s ( h, ˜ h ) =
ε s ( h ) then:
[Equation]
Finally, taking the infremum:
[Equation]
Combining all inequalities leads to the stated one.
Theorem 4 (Better control on the adaptability) .
˜ λ
( H ◦ ) ≤ λ ( ˜ H ) .
Proof.
We simply use the fact that ˜ H
⊂ H ◦ then using the property of the infremum:
[Equation]
Theorem 5 ( γ embodies the risk of compression) .
Let ( ϕ 1 , ϕ 2 ) ∈
Φ 2 two source equivalent representations.
If ϕ 1 is more compressed than ϕ 2 , then γ ( ϕ 1 , H ◦ ) ≥ γ ( ϕ 2 , H ◦ ) for ˜ H ⊂ H ◦ ⊂ ˜ H s .
Proof.
If ϕ 1 and ϕ 2 are two equivalent representations, there is ˜ H ( ϕ 1 ) ⊂
˜ H ( ϕ 2 ) ⊂ ˜ H s then ∀ h ∈
˜
H s , ( ˜ H ( ϕ 1 ) ∩ { h (cid:48) ∈ H : ε s ( h, h (cid:48) )
= 0 } )
⊂ ( ˜ H ( ϕ 2 ) ∩ { h (cid:48)
∈ H : ε s ( h, h (cid:48) )
= 0 } ) which guarantees ˜
H h ( ϕ 1 ) ⊂ ˜
H h ( ϕ 2 ) .
Finally ε t ( h, ˜ h
( ϕ 2 )) ≤ ε t ( h, ˜ h
( ϕ 1 )) invoking the property of the infremum where ˜ h ( ϕ ) =
arg min h (cid:48) ∈
˜
H h ( ϕ )
ε t ( h, h (cid:48) ) .
The supremum on h ∈ H ◦ conserves the inequality.
Proposition 2 ( β is trainable from the data) .
Let ( g n , ϕ n ) n ∈ N a sequence such that α · ˜ ε s ( g n ◦ ϕ n )+ (1 − α ) · D ( ϕ n ) → 0 then β n → 0 .
Proof.
First of all, since D ( ϕ n ) → 0 then P t ( ϕ n ( X ))
→ P s ( ϕ n ( X )) .
We note that for any n ∈ N , β ≤ 2 · ( ε s ( g n ◦ ϕ n )+ ε t ( g n ◦ ϕ n , ˜ f
sn ◦ ϕ n )) ≤ 2 · (2 · ε s ( g n ◦ ϕ n )+( ε t ( g n ◦ ϕ n , ˜ f sn ◦ ϕ n ) − ε s ( g n ◦ ϕ n )))
Since ε s ( g n ◦ ϕ n ) → and ( ε t ( g n ◦ ϕ n , ˜ f s ) − ε s ( g n ◦ ϕ n ))
→ 0 (because P t ( ϕ n ( X ))
→ P s ( ϕ n ( X )) )
there is β n → 0 .
B N OTATIONS
• Φ is the set of representations.
• G is the set of classiﬁers.
• H is the hypothesis space H =
G ◦ Φ • For a given ϕ ∈ Φ , we note ˜ H ( ϕ )
= { g ◦ ϕ : g ∈ G} =
G ◦ ϕ .
When there is no ambiguity, we note ˜ H ( ϕ ) =
˜ H .
• For a given h ∈ H , we note ε ( h ) =
E [( Y − h ( X )) 2 ] .
For d = s, t , we note a domain risk ε d ( h ) =
E d [( Y − h
( X )) 2 ] .
• For d = s, t and a given ϕ ∈ Φ , we note the conditional expectation ˜ f
d ( Z ) =
E d [ Y | Z ] with Z = ϕ ( X ) .
• Equivalence.
For a given ϕ ∈ Φ , the set of source equivalent representations ˜Φ s ( ϕ ) =
{+{ ϕ (cid:
+}
) ∈
Φ , ϕ (cid:48)
=
ϕ on D s } (where D s = supp( P s ( X )) ) and the source equivalent hypothesis space
˜
H s ( ϕ ) =
{ g ◦ ϕ (cid:48) : g ∈ G , ϕ (
cid:48) ∈
˜Φ s } .
Two elements of ˜Φ s are said source equivalent.
When there is no ambiguity, we note ˜Φ s and ˜ H s .
• Conservation.
– For a given h ∈ ˜ H s , we note ˜
H
h
{+= { h (cid:
+}
) ∈
˜ H : ε s ( h, h (cid:48) )
= 0 } .
– For a given h ∈ ˜ H s , we note ˜
H
h
{+= { h (cid:
+}
) ∈
˜ H : h = h (cid:48) on D s } where D s = supp( P t ( X )) .
• Projection.
– π : ˜ H s → ˜ H is deﬁned as follows:
π ( h ) =
arg min h (cid:48) ∈
˜ H h ε t ( h, h (cid:48) ) for h ∈ ˜ H s .
π ( h ) is called the projected hypothesis.
If there is no uniqueness of the minimum, any solution works.
– Π : ˜ H s → ˜ H is deﬁned as follows π ( h ) =
arg min h (cid:48) ∈
˜ H h ε t ( h, h (cid:48) ) for h ∈ ˜ H s .
If there is no uniqueness of the minimum, any solution works.