P ROVABLE A DAPTATION ACROSS M ULTIWAY D OMAINS VIA R EPRESENTATION L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
This paper studies zero-shot domain adaptation where each domain is indexed on a multi-dimensional array, and we only have data from a small subset of domains.
Our goal is to produce predictors that perform well on unseen domains.
We propose a model which consists of a domain-invariant latent representation layer and a domain-specific linear prediction layer with a low-rank tensor structure.
Theoretically, we present explicit sample complexity bounds to characterize the prediction error on unseen domains in terms of the number of domains with training data and the number of data per domain.
In addition, we provide experiments on two-way MNIST and four-way fiber sensing datasets to demonstrate the effectiveness of our proposed model
I NTRODUCTION
In many applications, collected datasets are cross-classified by a number of categorical factors such as a set of experimental or environmental conditions that are either controllable or known.
These applications can be formalized as a zero-shot domain adaptation (ZSDA) problem with each domain being indexed on a multi-dimensional array.
Domain-shifts often exist among data collected under different conditions, and to minimize the bias, one would like to collect diverse data to cover all conditions.
However, due to high cost of data collection or insufficient resource in the field, it is often impractical to cover all possible combinations of factors.
In most cases, training data collection can only cover a few limited, accessible scenarios, and the data from target domain may not be available during the training phase at all.
One motivating example is the distributed fiber optical sensing (Rogers, 1988) technique started to be used in smart city applications (Huang et al., 2019).
Collecting fiber sensing data for machine learning is expensive and the characteristics of sensing data vary considerably across various heterogeneous factors, such as weather-ground conditions, signal source types, and sensing distances.
Although conducting experiments to cover a small subset of combinations of different factors is possible, it is difficult to conduct experiments to cover all possible combinations.
Specifically, in order to account for the effects of multiple factors (e.g., soil type × distance to sensor × weather), one has to visit multiple sites and set up the sensing equipment, and wait for the right time until the target type of data can be collected, and some combination of factors are not accessible due to the constraint of the physical world (e.g. a testbed at 10 km sensing distance with asphalt pavement surface).
Besides, in the digital pathology application, domain shift can be caused by different clinical centers, scanners, and tumor types (Fagerblom et al., 2021).
It is impossible to cover every combination in training (e.g., one center maybe specialized in certain tumor class or own one particular type of scanners).
Ideally, for these applications, one would want to train a model under a subset of scenarios, and adapt it to new unseen scenarios without collecting new data.
Another motivating application to design data augmentation with composition of operations.
For instance, in image recognition applications, there are often multiple operations can be combined into augmented datasets, including blurring, translating, viewpoint, flipping, scaling, etc, and each with several levels or values to choose from.
It may require huge amount of augmented data to cover all combinations of operations.
Ideally, one only wants to try a small subset of all possible combinations.
Previous works have shown that composing operations in careful ways outperforms randomly using data augmentation schemes (Ratner et al., 2017; Cubuk et al., 2019).
In the general ZSDA formulation, each domain is associated with a task descriptor, which is used to generate a predictor for the domain.
This function that maps a task descriptor to a predictor, i.e., a predictor generator, is trained on training domains where data is available (Yang & Hospedales, 2014).
In our setting, we can view the categorical indices for each domain as a task descriptor and thus apply existing approaches.
However, this ignores the inherent multiway structure that connects different domains.
Furthermore, existing approaches lack theoretical guarantees, and thus it is unclear under what conditions, the learned predictor generator can provably output an accurate predictor on unseen domains.
A natural question is
Can we design a provably sample-efficient algorithm for zero-shot domain adaptation that exploits the multiway structure?
1. O UR C ONTRIBUTIONS
In this paper, we answer this question affirmatively.
Our contributions are summarized below.
• we consider a multilinear structure which naturally characterize the relatedness among different domains.
Formally, we assume that there are totally D =
d M domains that form a d × M -dimensional task tensor, where the predictor on domain t ∈
[ D ] is parameterized by w ∗ t ◦ ϕ ∗ ∈ W ◦ Φ where ϕ ∗ : X → R p is a common representation for tasks and w t ∈ R p is a domain specific linear predictor.
We only consider the case when p is small.
Note the linear predictors, w ∗ 1 , . .
. , w ∗ D ∈ R p , together form a form a d × d × · · · × d (cid:124)
(cid:123)(cid:122) (cid:125)
M times × p -dimensional tensor,
which we denote as T .
To enable domain adaptation
we further impose a low-rank multi-linear on the linear predictor T .
The structure we impose on the model is that the slice along the last axis is always rank- K with K ≪ d M .
That is, for all j ∈ [ p ] , T · ,j ∈ R
d
×
d ×···× d has rank K .
• We provide a finite-sample statistics analysis for this model.
We show that if during training T ∈ [ D ] source domains are observed, and in each observed domain n samples are collected, then the expected excess risk across all D domains is of order ˜ O (cid:18)(cid:16)
TC
W
+ C
(Φ)
nT
[Equation]
where C ( F ) represents the complexity of function class F .
The first term corresponds to the cost of learning the common representation and domain-specific linear classifiers, and the second term
corresponds to the cost
of generalizing
to unseen domains In the case where
n is large , we can simply ignore
the first term,
and
conclude
that
T should scale
with
Kd ( pM ) 2 . This theoretically justifies our
method can adapt to unseen domains with limited training domains • We test our proposed method on a two-way MNIST dataset and four-way fiber sensing datasets.
The empirical results show our method matches the performance of general ZSDA algorithm by Yang & Hospedales (2014) which has a
lot
more parameters than our method
R ELATED W ORK
For theoretical results of multi-task learning, Baxter (2000) first derived a covering number bound for sample complexities.
Later Maurer et al.
(2016) gave a uniform convergence bound for multitask representation learning.
Their bound is of order O
( (cid:112) 1 /m + (cid:112) 1 /T ) , where m is the number of training samples in the target domain, so it is not reflecting how their learning process benefits from seeing multiple domains.
Recently, Du et al.
Tripuraneni et al.
(2020) successfully derived results of type O ( (cid:112) 1 /m + (cid:112) 1 / ( nT )) , which satisfactorily explained how learning algorithm benefits from seeing abundant training data in many source domains, even if training data in target domain is scarce.
This setting is often referred to as transfer learning or few-shot learning.
A key difference between this setting and ours is that we do not see any training data from the target domain.
Blitzer et al.
(2009) also studied ZSDA, but they studied a different approach which relies on multi-view learning and is restricted to linear models.
Many attempts to solving multi-task learning via low-rank matrices/tensors have been proposed
Romera-Paredes et al.
; Signoretto et al.
Wimalawarne et al.
(2014), focusing on regularizing shallow models.
Wimalawarne et al.
(2014) specifically discussed task imputation and gave a sample complexity bound.
However, their analysis assumed each training data is uniformly sampled from all source domains, so it is incomparable to our result.
Yang & Hospedales (2017); Li et al.
(2017) used low-rank tensor decomposition to share parameters between neural architectures for multiple tasks and empirically verified that both multi-task learning and domain generalization can benefit from the low-rank structure.
Some different but closely related settings include unsupervised domain adaptation and zero-shot learning, where the test labels are either unseen during the training phase or different from what the model has been trained with.
This is beyond the scope of this paper, as we only consider the case where all domains share same set of labels.
The low-rank matrix completion problem has been thoroughly studied in the past decade Srebro &
Shraibman (2005); Srebro et al. (2004); Cand`es & Recht (2009); Recht (2011).
Despite the combinatorial nature of rank, it has a nice convex relaxation, the trace norm, that can be optimized efficiently, in both noiseless and noisy settings Wainwright (2019).
Although these quantities (trace norms, ranks, etc) are easy to calculate for matrices, most quantities associated with tensors are
NP-hard to compute, including the trace norm Hillar & Lim (2013).
There are many efforts in the theoretical computer science community to tackle tensor completion problems from the computational complexity perspective Barak & Moitra (2016); Liu & Moitra (2020).
In this paper, we use the statistical properties of tensor completion despite their computational inefficiency.
Hence our sample complexity bound does not contradict the seemingly worse bounds in the theory literature.
P RELIMINARY AND O VERVIEW
Notation.
For D ∈ Z , we let [ D ] = { 1 , 2 , . . .
, D } .
We write ∥ · ∥ to represent the ℓ 2 norm or
Frobenius norm.
Let ⟨· , ·⟩ be the inner product on an inner product space.
Throughout the paper, we assume for simplicity in total there are D =
d × d × · · · × d (cid:124) (cid:123)(cid:122) (cid:125)
M data domains.
One can easily generalize the results to the general case where D = (cid:81) Mi
=1 d i .
We use ⊗ to denote the tensor product and ⊙ the Hadamard product.
We use T ∈
[ D ] to denote the number of seen source domains, n to be the amount of sample in a single source domain.
Since each t ∈ [ D ] also uniquely corresponds to a multi-index in I ∈ [ d ] × M , if T ∈ R d ×···× d × p is a d × M dimension tensor composing of pdimensional linear functionals, we also write T t, · ∈ R p to represent the classifier at multi-index I , and we use t and I as indices interchangeably.
3. P ROBLEM S ETUP
During training, we have T source domains out of the D domains uniformly at random.
For each domain t ∈ [ T ] , we have n i.i.d data { ( x t,i , y t,i ) ni
=1 } samples from the following probability (Tripuraneni et al., 2020): P t ( x, y )
=
P w ∗ t ◦ ϕ ∗ ( x, y ) =
P x ( x ) P y | x ( y | w ∗ t ◦ ϕ ∗ ( x )) , where all domains share the common feature mapping ϕ ∗ : ( R r → R p ) ∩ Φ and a common marginal distribution P x .
Each domain has its specific classifier w ∗ t ∈ ( R p
→ R ) ∩ W .
Φ can be a general function class and W composes of Lipschitz linear functionals.
We denote this distribution as D t .
The key assumption is that D domain-specific classifiers form a D × p
rank- K tensor T in the following sense:
[Equation]
for α ∗ k,t m ∈ R p .
We remark that this does not mean T has rank K .
Instead, this means for each j ∈ [ p ] , T · ,j has rank K .
Let ℓ : R × R → R ≥ 0 be the loss function, L (( w ◦ ϕ ) ( x ) , y ) =
E x,y [ ℓ (( w ◦ ϕ ) ( x ) , y )] be the expected loss, (cid:98) L n (( w ◦ ϕ )( x ) , y )
= 1 n (cid:80) ni =1 ℓ (( w ◦ ϕ )
( x i ) , y i ) be the empirical loss.
When x and y are clear from the context, we write L ( w ◦ ϕ ) to denote L (( w ◦ ϕ ) ( x ) , y ) , and similarly for ℓ and (cid:98) L n .
When the number of samples n is clear from the context, we write (cid:98) L := (cid:98) L n .
We write L t :=
E D t [ ℓ ( · , · ))] to emphasize the data is from D t .
Our goal is to minimize the average excess risk across all domains:
Our learning algorithm first outputs the empirical risk minimizer (ERM) on the seen source domains:
[Equation]
Naturally we put ˆ w t into a d × M × p tensor ˜ T , such that ˜ T t, · = ˆ w t .
Then we do a tensor completion for each j ∈ [ p ] separately:
[Equation]
Finally, at test time, for target domain indexed by t ∈ [ D ] and test data x ∼ D t , we make the prediction ˆ y =
( ˆ w t ◦ ˆ ϕ ) ( x ) , where ˆ w t = (cid:98) T t, ·
Notion of Complexity We use Gaussian complexity and Rademacher complexity to measure the function class complexity.
Definition 3.1 (Gaussian and Rademacher complexity) .
Let F ⊂ { f : R p
→ R q } be a vectorvalued function class, the empirical Gaussian and Rademacher complexity on n points X
= { x 1 , . . .
, x n } are defined as:
[Equation]
ϵ ki f k ( x i )   , where g ki ’s are all standard Gaussian random variables, ϵ ki ’s are Rademacher random variables, and f k is the k th entry of f .
Let G n ( F ) =
E X [ (cid:98) G n ( F | X )] denote the expected Gaussian complexity (similarly for
Rademacher complexity).
To deal with the divergence among domains, we adopt the following notions from Tripuraneni et al.
(2020): G n ( W ) =
max Z ∈Z ˆ G n ( W | Z ) , where Z = { ( ϕ ( x 1 ) , · · · , ϕ ( x n )) | ϕ ∈ Φ , x i ∈
X for all i ∈ [ n ] } .
To measure the complexity of tensors, we use the notion of pseudo-dimension.
Definition 3.2 (Pseudo-dimension) .
Let F ⊆ R X be a real-valued function class.
Let x m
=
( x 1 , . .
, x m ) ∈
X m .
We say x m 1 is pseudo-shattered by F is there exists r = ( r 1 , . . .
, r m ) ∈ R m such that for all b
= ( b 1 , . . .
, b m ) ∈ {± 1 } m , there exists f ∈ F such that sign( f b ( x i ) − r i )
=
b i for all i ∈ [ m ] .
The pseudo-dimension of F is defined as:
[Equation]
T HEORETICAL R ESULTS
In this section, we derive the sample complexity bound for our DG setting.
As a high level overview, we first prove that on the T seen source domains, with enough training data and sufficient regularity conditions, we can have ˆ w t being sufficient close to w ∗ t on the source domains.
Then we show that with a large enough T , even on an unseen domain t ∈ [ D ] \ [ T ] we can also approximate w ∗ t well by completing the low-rank tensor formed by learned ˆ w t .
Finally, by certain regularity conditions on the loss function, we can show the excess risk is also small.
We require the following regularity assumptions for our theoretical development.
Assumption 4.1.
The learning problem is realizable, that is, w ∗ t ∈ W for all t ∈
[ D ] and ϕ ∗ ∈ Φ .
WLOG assume that w ∗ t ◦ ϕ ∗ is the unique minimizer of L t for all t .
ℓ ( · , · ) is B -bounded, and ℓ ( · , y ) is L -Lipschitz.
For all w ∈ W , ∥ w ∥ ≤ W .
sup x ∥ ϕ ( x ) ∥ ≤ D X , for any ϕ ∈ Φ .
For all t ∈ [ D ] , L t is λ -strongly convex in w t for ϕ ∗ .
The first assumption is indeed general.
Since we care about the excess risk, in realizable problems we can compare to the unique minimizer of L in W ◦ Φ instead of w ∗ t ◦ ϕ ∗ .
The existence of a unique minimizer is necessary, otherwise tensor completion can lead to arbitrary errors.
Assumptions 2are common.
Lastly, without strong convexity in the last assumption, one cannot derive the closeness of ˆ w t to w ∗ t from the closeness of the excess risk on source domains.
4. L EARNING C OMMON R EPRESENTATION
In this subsection, we discuss how to learn the shared representation.
The proof follows Tripuraneni et al.
(2020) with modifications to adopt to our setting.
First we introduce some definitions that defines the divergence among the source domains and target domains.
Definition 4.1.
For a function class W , T functions w 1 , . . .
, w T , and data ( x t , y t ) ∼ D t for any t ∈
[ T ] , the task-average representation difference (TARD) between representation ϕ and ϕ ′ is defined as:
[Equation]
Let w ∗ , ϕ ∗ be the true underlying functions.
Define the uniform absolute representation difference (UARD) to be
[Equation]
For W , we say w = { w 1 , . . .
, w T } is ( ν , ϵ ) -diverse for a representation ϕ , if the following holds for all [-φ (cid:
-]ϕ ′
[Equation]
Φ :
[Equation]
The notion of task-average representation difference was introduced by Tripuraneni et al.
In their setting, they bound the worse-case representation difference (WCRD) between two representations ϕ, ϕ ′ ∈ Φ which is defined as
[Equation]
using the task-average representation difference.
One should note that WCRD is changing the data distribution, while UARD takes expectation over the true distribution D t .
We are saying that under the true distribution, the worst case difference between using ϕ vs. ϕ ′ , over both the choice of linear classifiers w and the domains, is not much larger than TARD.
Intuitively, this says that our source domains and task domains are benign enough, such that the ERM ˆ ϕ performs similarly to the true ϕ ∗ .
Although it seems that ¯ d W ,w ( ϕ ′ ; ϕ ) can be negative and d W ( ϕ ′ ; ϕ ) is always positive, later we only consider ¯ d W ,w ∗ ( ϕ ′ ; ϕ ∗ ) and w ∗ t ◦ ϕ ∗ is assumed to be the minimizer.
Hence, ¯ d W ,w ∗ ( ϕ ′ ; ϕ ∗ ) is always positive, and our notion of task diversity makes sense.
We cite the following theorem from Tripuraneni et al.
Theorem 4.1.
Let ˆ ϕ be the ERM in eq.
Under assumption 4.1, with probability at least 1 − δ , we have
[Equation]
4. L EARNING D OMAIN S PECIFIC L INEAR L AYER AND T ENSOR C OMPLETION
Now we give results for learning the domain specific linear classification.
Theorem 4.2.
Let ˆ w, ˆ ϕ be the ERM in eq.
Let assumption 4.1 holds.
With probability at least 1 − δ , we have
[Equation]
The proof of Theorem 4.2 starts with showing that L ( ˆ w t ◦ ϕ ∗ ) is close to L ( w ∗ t ◦ ϕ ∗ ) , while a normal ERM analysis only asserts L ( ˆ w t ◦ ˆ ϕ ) is close to L ( w ∗ t ◦ ϕ ∗ ) .
Such assertion holds by the ( ν, ϵ ) -diverse assumption.
Intuitively, such diversity assumption makes sure our learning landscape is somehow smooth: ˆ w t should be stable such that if we perturb ˆ ϕ to ϕ ∗ , the loss function does not alter too much.
Together with strong convexity, these conditions guarantee ˆ w t is close to the true w ∗ t on average.
After we learn ˆ w t for all t ∈ [ T ] , we find another ERM (cid:98) T by constructing p tensors (cid:98) T · ,i for all i ∈
[ p ] separately as in eq.
We only observe the empirical tensor completion loss 1 T (cid:80)
Tt =1 | (cid:98) T t,i − ˜ T t,i | during training.
With large enough T , by a uniform convergence argument, we can show that 1 T (cid:80) Tt =1 | (cid:98) T t,i − ˜ T t,i | can approximate 1 D (cid:80)
Dt =1 | (cid:98) T t,i − T ∗ t,i | fairly accurately.
Lemma 4.1.
Let X K be the class of rank- K tensor of shape d × M , its pseudo-dimension can be bounded by Pdim( X K ) ≤ KdM 2 log(8 ed ) .
Pdim( X K ) is computed by treating tensors as polynomials and counting the connected components of these polynomials.
Even though any X ∈ X K has d M entries, its complexity only scales as poly( K, d, M ) .
This assures that we only need to see polynomially many source tasks to perform well in unseen domains.
Using the pseudo-dimension, we have the following uniform convergence result.
Theorem 4.3.
With probability at least 1 − δ ,
[Equation]
The last O ( n − 1 / 4 ) term in eq.
(4) comes from Theorem 4.2.
This is the cost we pay for not knowing the true T ∗ t, · .
If in each source domains we have infinity number of training samples, then statistically
Theorem 4.2 recovers the true T ∗ t, · .
In this case, we only need to observe T = poly( p, K, d, M ) source domains.
[Equation]
We are now ready to show our main result.
Theorem 4.4.
Let assumption 4.1 holds and w ∗
= { w ∗ 1 . . .
, w ∗ T } being ( ν, ϵ ) -diverse for representation ϕ ∗ .
With probability at least 1 − 3 δ , the following holds:
[Equation]
E ( x,y )
∼D t [ ℓ ( ˆ w t ◦ ˆ ϕ ( x ) , y ) − ℓ ( w ∗ t ◦ ϕ ∗ ( x ) , y )]
≤ LD X W T (cid:88) t ∈ [ T ] (cid:88)
j ∈ [ p ] (cid:12)(cid:12)(cid:12) ˆ w t,j − ˜ T t,j (cid:12)(cid:12)(cid:12) + LD X
Wp (cid:114) KdM 2 log (8 ed ) + log( p/δ )
T + ˜ O
(cid:32) C ( W ) n + C (Φ)
nT (cid:33) 1 /. The first two terms correspond to the cost of tensor completion and the last term corresponds to predicting with inaccurate ˆ ϕ .
The term (cid:80) t ∈ [ T ] (cid:80) j ∈ [ p ] (cid:12)(cid:12)(cid:12) ˆ w t,j − ˜ T t,j (cid:12)(cid:12)(cid:12) can be exactly computed on the training dataset.
Recall ˆ w t is the learned by eq.
(2) and (cid:98) T t, · is the estimated linear classifier after tensor completion.
As n increases, this difference becomes smaller as ˆ w t becoming close to w ∗ t .
E XPERIMENTS
We empirically verify that our proposed model leads to better generalization performance than baseline model with vanilla representation learning on both a variant of MNIST dataset and a fiber sensing dataset.
On both datasets, we use LeNet trained on all available training data as the baseline.
According to Li et al.
(2017; 2019), this is a simple yet strong baseline that outperforms most domain generalization methods.
Our model is trained in an end-to-end fashion.
Instead of finding ERMs in eq.
(2) and perform tensor completion, we directly represent ˆ w t = (cid:80)
Kk =1 ⊙ Mm =
ˆ α k,t m , and output
[Equation]
In this way, we can fully exploit the computational convenience of auto-differentiation rather than dealing with the algorithmic difficulty of tensor completion.
All models are trained using the cross entropy loss.
Since our theorem is a uniform convergence bound by nature, the sample complexity will also apply to the end-to-end trained model 1 .
See more discussion in the appendix.
To prevent overfitting, we stop training of all models on the two-way MNIST dataset as soon as the lastiterations have average loss less than 0 . 05 , and the training of all models on a four-way fiber sensing dataset is stopped once the last 100 iterations have average loss less than 0 .
Throughout the experiments, the Adam optimizer with default learning rate 10 − 3 is used.
The sensitivity of the regularization parameter is investigated on MNIST data and we set it to 0 .
for all rest of the experiments.
For MNIST dataset, the source and target domain data are augmented from MNIST training and test data respectively.
For the fiber sensing dataset, the source and target domain data are collected in separate experimental rounds.
Across all results tables, mean accuracy is outside the parenthesis, standard deviation is inside the parenthesis.
5. T WO - WAY MNIST
A variant of MNIST is created by rotation and translation operations.
We rotate all MNIST digits by [ − 30 , − 15 , 0 , 15 , 30] degrees, and translate all MNIST by [( − 3 , 0) , (0 , − 3) , (0 , 0) , (0 , 3) , (3 , 0)] pixels, leading to 5 × 5 domains.
For our proposed method, we use a simplified low-rank structure on the last two layers of LeNet.
Specifically, LeNet has the structure of conv1-pool1-conv2-pool2-fc1-relu-fc2-relu-fc3-sigmoid.
We impose the low-rank structure on both fc2 and fc3.
We create 11 linear classifiers for each layer, denote as s 1 , . . .
, s 5 , v 1 , . .
. , v 5 , u .
For task ( i, j ) ∈ 5 × 5 , we use s i + v j + u for prediction.
This formulation is just a special case of the general formulation in eq.
Indeed, let α 1 =
[ s 1 , s 2 , s 3 , s 4 , s 5 , 1 , 1 , 1 , 1 , 1 ] , α
=
[ 1 , 1 , 1 , 1 , 1 , v 1 , v 2 , v 3 , v 4 , v 5 ] , and α 3 =
[ u, u, u, u, u, 1 , 1 , 1 , 1 , 1 ] , where each w i , v i , u, 1 ∈ R p and α k ∈ R 10 × R p .
Then for any task at t =
( i, j ) ∈ 5 × 5 , its classifier w t this can be formally written as w t =
(cid:80)k =1 α k,i ⊙ α k, 5+ j , which is the same form as eq.
This is done for both fc2 and fc3, and each layer has its own distinct set of weights.
Similar idea has been previously proposed for domain generalization Yang & Hospedales (2017);
Li et al.
These previous works do not assume a tensor structure on the tasks.
Instead, they put a low-rank tensor structure on the classifiers themselves.
This fundamentally distinguishes our settings from previous ones.
As a result, during test phase they have to use the common classifier u for different target domains, but we can incorporate more prior knowledge by using s i + v j + u .
During training time, we collect training data from ( i, i ) entries for all i ∈ [5] , and leave data in any other domains for test only.
This is one of the designs requires the minimal number of source domains, and we can still successfully train all unknown classifiers s , v and u .
Due to the excess amount of learnable parameters, it is easy to overfit on our method.
To reduce model
[Table]
complexity, we regularize all learnable classifiers to be close to their mean.
That is, on each lowrank layer, let µ = 111 ( (cid:80) i v i + (cid:80) j s j + u ) , we add the following regularizer to the loss function Ω λ ( s, v, u )
=
λ 11 (cid:16)(cid:80) i
∥ v[-i − µ (cid:107) 
-]
i − µ ∥ 2 + (cid:80) j ∥ s j − µ ∥ 2 + ∥ u − µ ∥ 2 (cid:17) .
We run the experiments 10 times and report the mean performances and standard deviations in Table 1.
Since this method uses the domain description information ( i, j ) during testing, we refer to it as the domain-specific model.
In addition, we also report the performance of using just the common classifier u in fc2 and fc3.
This model uses no domain information during testing, and we call it the domain-agnostic model.
The baseline model is LeNet trained with data pooled from all source domains together.
Notice that each s i + v j + ν corresponds to a unique task descriptor q i,j that serves as the coefficients for the combination of the linear layers, so for the ZSDA model, we further trained another descriptor network that outputs ReLU( Wq ) as the new coefficients.
This is done for both the last two layers.
Our method almost uniformly dominates the baseline in every domain, sometimes by a large margin, and almost matches the performance of the ZSDA model, with less parameters.
The domain-agnostic model achieves comparable performances to our proposed method.
This shows that with the low-rank tensor structure, domain-agnostic models can also accommodate the domain shifts on this dataset.
On most test domains, especially the ones that are “further away” from the training domains, our proposed algorithm consistently outperforms
Fish (Shi et al., 2021), one of the state of the art domain generalization algorithms.
Such results are expected as the Fish algorithm does not consider multi-way structure into consideration.
Another interesting observation is that the performances of all models are better near the diagonal, and getting worse away from the diagonal.
This may provide insight into how we should design experiments under a fixed budget of data collection.
A conjecture is that the performances on unseen target domains relate to the Manhattan distance of these domains to the seen source domains.
Further discussion is deferred to the appendix.
5. F OUR - WAY F IBER S ENSING D ATASET
The distributed optic fiber sensing technique turns underground cable of tens of kilometers into a linear array of sensors, which could be used for traffic monitoring in smart city applications.
In this paper, we aim to build a classifier for automatic vehicle counting and run-off-road event detection.
The objective is to classify whether the sensed vibration signal is purely ambient noise, or it contains vibration caused by a vehicle either driving normally or crossing the rumbling stripes alongside the road.
The sensing data takes the form of a 2D spatio-temporal array that can be viewed as an image - each pixel represents the vibration intensity at a particular time and location along the cable.
Vehicles driving on the road, running-off-road, and ambient noise all create different patterns, which makes convolutional neural networks a natural choice for a 3 -class classification model.
In experimental design, we consider several influencing factors representing the practical challenges faced after field deployment.
These factors include weather-ground conditions (sunny-dry, rainywet), shoulder type (grass, concrete), sensing distance ( 0 km, 10 km, 15 km), and vehicle type (van, sedan, truck), which produce combined effects on the data domain.
In order to evaluate our approach, we spent efforts on collecting data with all possible combinations of the levels in the aforementioned factors in a lab testbed, resulting to a multiway data indexed by a 2 × 3 × 3 × 2 tensor.
Under each condition, we conduct 20 ∼ 25 rounds for the run-off-road events and normal driving.
The ambient noise data is collected when no vehicles are near the cable.
The classes are balanced in both training and test data.
[Figure]
y - m i n i v a nk m - c
o n c r e t e s unn
y - m i n i v a nk m - g r a ss s unn
y - m i n i v a nk m - c
o n c r e t e s unn
y - s e d a n - 0 k m - g r a ss r
a
i n y - t
r u c k - 0 k m - g r a ss r a i n y - t r u c k - 0 k m - c
o n c r e t e r a i n
y - t r u c k - 10 k m - c
o n c r e t e r a i n
y - t r u c k - 15 k m - c
o n c r e t e r a i n y - m i n i v a nk m - c o n c r e t e r a i n y - m i n i v a n15 k m - g r a ss r a i n y - m i n i v a n15 k m - c
o n c r e t e r a i n y - s e d a nk m - g r a ss r
a
i n y - s e d a nk m - g r a ss 0.
[Figure] [Figure]
2 Rank
[Figure]
We evaluate model performance against number of source domains ( 5 , 10 , 15 , or 20 , each withsimulation runs) and results are shown in Figure 1(a).
The performance increases with number of source domains as expected.
In particular, Figure 1(b) summarizes the test performance for models trained with 10 source domains and tested on the rest.
In each run, the observed source domains are randomly sampled.
Among the 10 runs, ”rainy-sedan-15km-grass” happens to be always selected as the source domain, thus the test result is not available for this domain.
We add two additional low-rank models in the form of eq.
(5) with K = 2 and 3 just in the last layer for comparison.
Among the combination of factor levels, some scenarios are more challenging than others.
For example, sedan is the lightest vehicle among the three, which generates much weaker vibration than a truck.
Also the signal-to-noise ratio decays with increasing sensing distance.
Results show that in most of the cases, our ZSDA models achieve improved performance over the baseline, and the margins over baseline are particularly large in several challenging scenarios.
C ONCLUSION
In this work, we propose a particular domain adaptation framework where T out of D =
d M total domains are observed during training.
All D domains are parameterized by a common latent representation and their domain-specific linear functionals, which form a d × M -dimensional low-rank tensor.
This multilinear structure allows us to achieve an average excess risk of order
[Equation]
In addition to domain adaptation, our setting also sheds light on more efficient experiment designs and data augmentations.
Algorithms developed under our framework are empirically verified on both benchmark and real-world datasets.
A P ROOFS IN S ECTION
Theorem 4.2.
Let ˆ w, ˆ ϕ be the ERM in eq.
Let assumption 4.1 holds.
With probability at least 1 − δ , we have
[Equation]
Proof.
By a standard decomposition
[Equation]
we have with probability at least 1 − 2 δ
[Equation]
w
[Equation]
t
[Equation]
i
[Equation]
i
[Equation]
(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)
[Equation]
(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)
[Equation]
Use the fact that (cid:98) R n ( H ) ≤ (cid:112) π/ 2 (cid:98) G n ( H ) for any function class H and the decomposition of
R nT
( W ⊗ T ◦ Φ) introduced in Tripuraneni et al.
(2020), we conclude that
[Equation]
=
[Equation]
Meanwhile, by our assumption of uniform absolute representation difference and ( ν, ϵ ) -task diversity:  T T (cid:88) t = (cid:16) L (
[Equation]
which gives
[Equation]
≤ 1 ⃝
[Equation]
1 ⃝
[Equation] ϵ [Equation] where we use d W ,w ∗ (ˆ ϕ, ϕ ∗ ) ≤ 1 ⃝ from Theorem 4.1.
By strong convexity, we conclude for any T ∈
[ D ] , ν ≤ 1 :
[Equation]
Now we proceed to show the results related to tensor completion.
The main idea is to treat a tensor as a polynomial, and count its connect components.
This number restricts the complexity of the tensor.
Corollary A.1.
The number of {± 1 , 0 } sign configurations of r polynomials of degree at most d , over q variables, is at most (8 edr/q ) q for r > q > 2 .
Lemma 4.1.
Let X K be the class of rank- K tensor of shape d × M , its pseudo-dimension can be bounded by Pdim( X K ) ≤ KdM 2 log(8 ed ) .
Proof.
Let f T ( d, M, K ) =
(cid:12)(cid:12)(cid:12) { sign( X − T ) ∈ {± 1 , 0 } d
× M : X ∈ X K } (cid:12)(cid:12)(cid:12) .
It suffices to show that f T ( d, M, K ) ≤ (8 ed ) KdM 2 .
A rank K d × M tensor can be decomposed as:
[Equation]
for t ∈ [ d ] × M .
Then one can treat X − T as d M polynomials of degree at most M over the following entries:
[Equation]
T is a fixed arbitrary tensor, so there are in total KdM variables.
Applying Corollary A.1 yields the desired result.
Theorem 4.3.
With probability at least 1 − δ ,
[Equation]
Proof.
The following equation holds with probability at least 1 − δ , and follows directly from the uniform convergence bound using covering number and bounding covering number using pseudodimension.
See Srebro & Shraibman (2005) for detail.
[Equation]
Then by triangle
[Table]
p/δ )
T + O
( p 1 / 2 n − 1 / 4 ) , where the first step is from the fact that ∥ · ∥ 2 ≤ ∥ · ∥ 1 and union bounding eq.
(6) over p events.
The
O ( p 1 / 2 n − 1 / 4 ) term follows from Theorem 4.2 and equivalence between norms.
Note that p ≪ n hence asymptotically our conclusion holds.
Theorem 4.4.
Let assumption 4.1 holds and w ∗
= { w ∗ 1 . . .
, w ∗ T } being ( ν, ϵ ) -diverse for representation ϕ ∗ .
With probability at least 1 − 3 δ , the following holds:
[Equation]
Proof.
[Equation]
Let ¯ d W ,w ∗ (ˆ ϕ, ϕ ∗ ) be as defined in definition 4.1.
By our assumption of uniform absolute representation difference and ( ν, ϵ ) -diverse, we can upper bound A by ¯ d W ,w ∗ (ˆ ϕ, ϕ ∗ ) /ν
+ ϵ .
The second term can be bounded by lipschitzness,
[Equation]
Plug in our approximation to d W ,w ∗ (ˆ ϕ, ϕ ∗ ) in Theorem 4.1, 1 D (cid:80) t ∈
[ D ] ∥
ˆ w t − w ∗ t ∥ in Theorem 4.4, and union bound, we conclude the theorem.
[Table]
B M ORE D ISCUSSION TO S ECTION
We mention in Section 5.1 that the test accuracy on unseen domain might relate to the Manhattan distance between the seen and unseen domains.
Here is another experiment in the same setting as in section 5.1, but the chosen observed entries are [(0,0), (1,3), (2,2), (3,1), (4,4)].
In both Table 2 and Table 1, every factor level has been observed exactly once.
If the factors are categorical nominal, then permuting rows 2 and row 4 in Table 2 leads to the same balanced design with Table 1, and the performance shall be similar.
However, the factors (rotation, translation) considered here are not nominal, for example, there is a ordinal relation between rotation − 30 and rotation − 15 .
Hence, the above-mentioned permutation seems prohibitive.
Consequently, it makes sense to talk about Manhattan distances between observed and unobserved entries.
In Table [Table] cell (4,0) is 4 units away from its closest observed cell in Manhattan distance (in the following we omit to mention the metric is Manhattan distance), but in Table 2, (4,0) is 2 units away from the closest observed entry.
One can see the accuracy in that domain gets much better.
However, the closest distance to the observed entry is not the only factor here.
For example, (0,1) in Tableoutperforms (0,1) in Table 2 a lot.
Therefore, the average distance to the observed entries may also be a contributing factor.
It is an open question how to select the best subset of tensor entries to be observed, such that the overall performance in the unseen target domains can be optimized.
This question may relate to the area of factorial experiment design, where many factors are involved and some have confounded interactions.
One subject is to design minimal sets of experiments such that the effects of all factors can be studied.
Our theory deals particularly with the case when the factor combinations are chosen uniformly at random, without assuming any particular tensor structure.
With more prior knowledge, more efficient sampling algorithms can be designed.
For instance, McKay et al.
(2000) discussed how to use Latin hypercube sampling to achieve a smaller sample complexity.
There are also some works that connect the dots between error coding theory and factorial experiment design Ben-Gal & Levitin (2001).
There could be information theoretic understanding to the relation between our setting of experiment design and Manhattan distance as well.
This can be an interesting research direction and beyond the scope of our paper.
Fish Algorithm
The Fish algorithm was proposed in Shi et al.
(2021) as a domain generalization method, which achieves state-of-the-art results on the WILDS benchmarks.
Its intuition is that the model should be regularized (implicitly) during training such that the gradient steps on different domains are invariant, thus leading to an invariant feature representation across different domain. Comparing to the Fish algorithm, our proposed algorithm consistently outperforms Fish on most test domains, especially the ones that are “further away” from the training domains. Such results are expected as the Fish algorithm does not consider multi-way structure into consideration. See the results in table 1.
Fish is used for the LeNet architecture.
Its inner step is trained using an Adam optimizer with step size 10 − 2 and the meta step uses a learning rate of 0 . 5 .
The number of meta steps is set to be 5 .
We use the same hyperparameters in the GTOS experiment as well.
During training, we found out that the Fish algorithm does not converge well if the batch size is too large.
Hence we pick batch size 20 .
This is of the same magnitude as the batch size in Shi et al.
, but our proposed model and the ERM models exhibit better generalization when trained with larger batch size 200 .
Hyperparameter Sensitivity Model selection in domain adaptation is tricky in general, since no data from the target domains is seen.
One benefit of using the special low-rank formulation is that it has fewer number of tuning parameters than general low-rank formulations.
In addition to tuning λ in the regularizer Ω λ , the form in eq.
(5) also requires to choose rank K .
We evaluate the sensitivity of λ on both the source and target domains.
Observing data from ( i, i ) domains on the diagonal, we train on 5000 training data using λ ∈ [0 . 005 , 0 . 01 , 0 .
05 , 0 . 1 , 0 . 5 , 1] , and test on 1000 data from both ( i, i ) source domains for i ∈ [5] and ( i, j ) task domains for i ̸
= j ∈ [5] .
Results show that the test performances on both source domains and target domains are insensitive to λ .
The mean performances and standard deviations are reported in Table 3.
[Table]
C T HREE - WAY G ROUND T ERRAIN IN O UTDOOR S CENES D ATASET
To train a model invariant to domain shifts, one would either need to collect massive training data from many different domains such that the model is able to generalize (implicitly) to unseen cases, or build a mechanism allowing (explicitly) adaptation to new scenarios utilizing limited domain information.
Our work belongs to the latter.
The proposed multi-way domain setup represents a combination of the environmental or experimental factors, which naturally arises in many real life applications and the levels of factors are pre-known.
This setup is general enough for many tasks, especially those involving data collection experiments that are costly and limited by physical constraints.
To make the applicability of our method more compelling, we present results on the GTOS (Ground Terrain in Outdoor Scenes) dataset (Xue et al., 2017), which a large-scale real-world dataset that naturally fits into our framework.
The task of outdoor ground material recognition is strongly influenced by the weather and lighting conditions, as well as the surface viewpoints.
The GTOS dataset consists of over 30 , 000 images covering 40 classes (cement, asphalt, brick, etc.).
The multi-way domain structure include: 4 different weather conditions (cloudy dry, cloudy wet, sunny morning and sunny afternoon), 3 illumination conditions with different exposure times, and 19 viewpoints from differential angular imaging.
As a result, each domain is indexed on a multidimensional array of size 4 × 3 × 19 .
Experimental results in table 4 show that our method outperforms both the ERM and the Fish algorithm.
For our model, we use the same architecture as described in the beginning of section 5.1: a simplified low-rank structure on the last two layers of LeNet.
Specifically, LeNet has the structure of conv1pool1-conv2-pool2-fc1-relu-fc2-relu-fc3-sigmoid.
We impose the low-rank structure on both fc and fc3.
We create 27 linear classifiers for each layer, denote as s i , u j , v k , h , for i ∈ [3] , j ∈ [4] , k ∈
For task ( i, j, k ) ∈ [3] × [4] × [19] , we use s i + u j + v k + h for prediction.
The ERM model and Fish model both use LeNet.
Both our model and the ERM model are trained using Adam optimizers with learning rate 10 −with batch size 200 .
The Fish model was trained with batch size 20 , its inner step is trained with an
Adam optimizer with learning rate 10 − 2 and the meta step has learning rate 0 .
We choose 5 for the meta steps N (this is the parameter that determines how many training domains the model sees at every iteration.
The original paper tested N = 5 , 10 , 20 and found the performance insensitive to
N ).
During training, we found that Fish tends to not converging with large batch size, hence we reduce the batch size from 200 to 20 .
For Fish to converge, we also need to increase the learning rate.
One conjecture of this phenomenon is because the number of observed training domains is quite large, hence it is hard to match their gradients.
As Shi et al.
(2021) pointed out, Fish usually does not outperform ERM when the number of domains is enormous.
This is consistent with our observation.
[Table]