A DIRT-T A PPROACH TO U NSUPERVISED D OMAIN A DAPTATION
Anonymous authors
Paper under double-blind review
A BSTRACT
Domain adaptation refers to the problem of leveraging labeled data in a source domain to learn an accurate model in a target domain where labels are scarce or unavailable.
A recent approach for ﬁnding a common representation of the two domains is via domain adversarial training (Ganin & Lempitsky, 2015), which attempts to induce a feature extractor that matches the source and target feature distributions in some feature space.
However, domain adversarial training faces two critical limitations: 1) if the feature extraction function has high-capacity, then feature distribution matching is a weak constraint, 2) in non-conservative domain adaptation (where no single classiﬁer can perform well in both the source and target domains), training the model to do well on the source domain hurts performance on the target domain.
In this paper, we address these issues through the lens of the cluster assumption, i.e., decision boundaries should not cross high-density data regions.
We propose two novel and related models: 1) the Virtual Adversarial Domain Adaptation (VADA) model, which combines domain adversarial training with a penalty term that punishes the violation the cluster assumption; 2) the Decision-boundary Iterative Reﬁnement Training with a Teacher (DIRT-T)model, which takes the VADA model as initialization and employs natural gradient steps to further minimize the cluster assumption violation.
Extensive empirical results demonstrate that the combination of these two models signiﬁcantly improve the state-of-the-art performance on several visual domain adaptation benchmarks.
I NTRODUCTION
The development of deep neural networks has enabled impressive performance in a wide variety of machine learning tasks.
However, these advancements often rely on the existence of a large amount of labeled training data.
In many cases, direct access to vast quantities of labeled data for the task of interest (the target domain) is either costly or otherwise absent, but labels are readily available for related training sets (the source domain).
A notable example of this scenario occurs when the source domain consists of richly-annotated synthetic or semi-synthetic data, but the target domain consists of unannotated real-world data (Sun & Saenko, 2014; Vazquez et al., 2014).
However, the source data distribution is often dissimilar to the target data distribution, and the resulting signiﬁcant covariate shift is often detrimental to the performance of the source-trained model when applied to the target domain (Shimodaira, 2000).
Solving the covariate shift problem of this nature is an instance of domain adaptation (Ben-David et al., 2010b).
In this paper, we consider a challenging setting of domain adaptation where 1) we are provided with fully-labeled source samples and completely-unlabeled target samples, and 2) the existence of a classiﬁer in the hypothesis space with low generalization error in both source and target domains is not guaranteed.
Borrowing approximately the terminology from Ben-David et al.
(2010b), we refer to this setting as unsupervised, non-conservative domain adaptation.
We note that this is in contrast to conservative domain adaptation, where we assume our hypothesis space contains a classiﬁer that performs well in both the source and target domains.
To tackle unsupervised domain adaptation, Ganin & Lempitsky (2015) proposed to constrain the classiﬁer to only rely on domain-invariant features.
This is achieved by training the classiﬁer to
Pronounce as perform well on the source domain while minimizing the divergence between features extracted from the source versus target domains.
To achieve divergence minimization, Ganin & Lempitsky (2015) employ domain adversarial training.
We highlight two issues with this approach: 1) when the feature function has high-capacity and the source-target supports are disjoint, the domain-invariance constraint is potentially very weak (see Section 3), and 2) good generalization on the source domain hurts target performance in the non-conservative setting.
Saito et al.
(2017) addressed these issues by replacing domain adversarial training with asymmetric tri-training (ATT), which relies on the assumption that target samples that are labeled by a sourcetrained classiﬁer with high conﬁdence are correctly labeled by the source classiﬁer.
In this paper, we consider an orthogonal assumption: the cluster assumption (Chapelle & Zien, 2005), that the input distribution contains separated data clusters and that data samples in the same cluster share the same class label.
This assumption introduces an additional bias where we seek decision boundaries that do not go through high-density regions.
Based on this intuition, we propose two novel models: 1) the Virtual Adversarial Domain Adaptation (VADA) model which incorporates an additional virtual adversarial training (Miyato et al., 2017) and conditional entropy loss to push the decision boundaries away from the empirical data, and 2) the Decision-boundary Iterative Reﬁnement Training with a Teacher (DIRT-T) model which uses natural gradients to further reﬁne the output of the
VADA model while focusing purely on the target domain.
We demonstrate that
In conservative domain adaptation, where the classiﬁer is trained to perform well on the source domain, VADA can be used to further constrain the hypothesis space by penalizing violations of the cluster assumption, thereby improving domain adversarial training.
In non-conservative domain adaptation, where we account for the mismatch between the source and target optimal classiﬁers, DIRT-T allows us to transition from a joint (source and target) classiﬁer (VADA) to a better target
domain classiﬁer.
Interestingly, we demonstrate the advantage of natural gradients in DIRT-T reﬁnement steps.
We report results for domain adaptation in digits classiﬁcation (MNIST-M, MNIST, SYN DIGITS,
SVHN), trafﬁc sign classiﬁcation (SYN SIGNS, GTSRB), general object classiﬁcation (STL-10,
CIFAR-10), and Wi-Fi activity recognition (Youseﬁ et al., 2017).
We show that, in nearly all experiments, VADA improves upon previous methods and that DIRT-T improves upon VADA, setting new state-of-the-art performances across a wide range of domain adaptation benchmarks.
In adapting
MNIST → SVHN, a very challenging task, we out-perform ATT by over 20% .
R ELATED W ORK
Given the extensive literature on domain adaptation, we highlight several works most relevant to our paper.
Shimodaira (2000); Mansour et al.
(2009) proposed to correct for covariate shift by re-weighting the source samples such that the discrepancy between the target distribution and reweighted source distribution is minimized.
Such a procedure is problematic, however, if the source and target distributions do not contain sufﬁcient overlap.
Huang et al.
Long et al. (2015);
Ganin & Lempitsky (2015) proposed to instead project both distributions into some feature space and encourage distribution matching in the feature space.
Ganin & Lempitsky (2015) in particular encouraged feature matching via domain adversarial training, which corresponds approximately to Jensen-Shannon divergence minimization (Goodfellow et al., 2014).
To better perform nonconservative domain adaptation, Saito et al.
(2017) proposed to modify tri-training (Zhou & Li, 2005) for domain adaptation, leveraging the assumption that highly-conﬁdent predictions are correct predictions (Zhu, 2005).
Several of aforementioned methods are based on Ben-David et al.
(2010a)’s theoretical analysis of domain adaptation, which states the following,
Theorem 1 (Ben-David et al., 2010a) Let H be the hypothesis space and let ( X s , (cid:15) s ) and ( X t , (cid:15) t ) be the two domains and their corresponding generalization error functions.
Then for any h ∈ H ,
[Equation]
where d H ∆ H denotes the H ∆ H -distance between the domains X s and X t ,
[Equation]
Intuitively, d H ∆ H measures the extent to which small changes to the hypothesis in the source domain can lead to large changes in the target domain.
It is evident that d H ∆ H relates intimately to the complexity of the hypothesis space and the divergence between the source and target domains.
For disjoint domains and inﬁnite-capacity models, d H ∆ H is maximal.
A critical component to our paper is the cluster assumption, which states that decision boundaries should not cross high-density regions (Chapelle & Zien, 2005).
This assumption has been extensively studied and leveraged for semi-supervised learning, leading to proposals such as conditional entropy minimization (Grandvalet & Bengio, 2005) and pseudo-labeling (Lee, 2013).
More recently, the cluster assumption has led to many successful deep semi-supervised learning algorithms such as semi-supervised generative adversarial networks (Dai et al., 2017), virtual adversarial training (Miyato et al., 2017), and self/temporal-ensembling (Laine & Aila, 2016; Tarvainen & Valpola, 2017).
Given the success of the cluster assumption in semi-supervised learning, it is natural to consider its application to domain adaptation.
Indeed, Ben-David & Urner (2014) formalized the cluster assumption through the lens of probabilistic Lipschitzness and proposed a nearest-neighbors model for domain adaptation.
Our work extends this line of research by showing that the cluster assumption can be applied to deep neural networks to solve complex, high-dimensional domain adaptation problems.
Independently of our work, French et al.
(2017) demonstrated the application of selfensembling to domain adaptation.
However, our work additionally considers the application of the cluster assumption to non-conservative domain adaptation.
L IMITATION OF D OMAIN A DVERSARIAL T RAINING
Before describing our model, we ﬁrst highlight that domain adversarial training may not be sufﬁcient for domain adaptation if the feature extraction function has high-capacity.
Consider a classiﬁer h θ , parameterized by θ , that maps inputs to the K -simplex, where K is the number of classes.
Suppose the classiﬁer h
= g ◦ f can be decomposed as the composite of an embedding function f : X → Z and embedding classiﬁer g :
Z → Y .
For the source domain, let D s be the joint distribution over input x and one-hot label y and let X s be the marginal input distribution.
D t , X t ) are analogously deﬁned for the target domain.
Let (
L s , L d ) be the loss functions
[Equation]
where the supremum ranges over discriminators D : Z → (0 , 1) .
Then L y is the cross-entropy objective and D is a domain discriminator.
Domain adversarial training minimizes the objective
[Equation]
where λ d is a weighting factor.
Minimization of L d encourages the learning of a feature extractor f for which the Jensen-Shannon divergence between f ( X s ) and f ( X t ) is small.
2 Ganin & Lempitsky (2015) suggest that successful adaptation tends to occur when the source generalization error and feature divergence are both small.
It is easy, however, to construct situations where this suggestion does not hold.
In particular, if f has inﬁnite-capacity and the source-target supports are disjoint, then f can employ arbitrary transformations to the target domain so as to match the source feature distribution.
A formal statement and proof is provided in
Appendix E. We verify empirically that, for sufﬁciently deep layers, jointly achieving small source generalization error and feature divergence does not imply high accuracy on the target task (Table 5).
Given the inherent limitations of domain adversarial training, we wish to identify additional constraints that one can place on the model to achieve better, more reliable domain adaptation.
C ONSTRAINING VIA C ONDITIONAL E NTROPY M INIMIZATION
In this paper, we apply the cluster assumption to domain adaptation.
The cluster assumption states that the input distribution X contains clusters and that points in the same cluster come from the same
[Equation]
[Figure]
class.
This assumption has been extensively studied and applied successfully to a wide range of classiﬁcation tasks (see Section 2).
If the cluster assumption holds, the optimal decision boundaries should occur far away from data-dense regions in the space of X (Chapelle & Zien, 2005).
Following
Grandvalet & Bengio (2005), we achieve this behavior via minimization of the conditional entropy with respect to the target distribution,
[Equation]
Intuitively, minimizing the conditional entropy forces the classiﬁer to be conﬁdent on the unlabeled target data, thus driving the classiﬁer’s decision boundaries away from the target data (Grandvalet & Bengio, 2005).
In practice, the conditional entropy must be empirically estimated using the available data.
However, Grandvalet & Bengio (2005) note that this approximation breaks down if the classiﬁer h is not locally-Lipschitz.
Without the locally-Lipschitz constraint, the classiﬁer is allowed to abruptly change its prediction in the vicinity of the training data points, which 1) results in a unreliable empirical estimate of conditional entropy and 2) allows placement of the classiﬁer decision boundaries close to the training samples even when the empirical conditional entropy is minimized.
To prevent this, we propose to explicitly incorporate the locally-Lipschitz constraint via virtual adversarial training (Miyato et al., 2017) and add to the objective function the additional term
[Equation]
which enforces classiﬁer consistency within the norm-ball neighborhood of each sample x .
Note that virtual adversarial training can be applied with respect to either the target or source distributions.
We can combine the conditional entropy minimization objective and domain adversarial training to yield min .
[Equation]
a basic combination of domain adversarial training and semi-supervised training objectives.
We refer to this as the Virtual Adversarial Domain Adaptation (VADA) model.
Empirically, we observed that the hyperparameters ( λ d , λ s , λ t ) are easy to choose and work well across multiple tasks (Appendix B).
H ∆ H -Distance Minimization .
VADA aligns well with the theory of domain adaptation provided in Theorem 1.
Let the loss,
[Equation]
denote the degree to which the target-side cluster assumption is violated.
Modulating λ t enables
VADA to trade-off between hypotheses with low target-side cluster assumption violation and hypotheses with low source-side generalization error.
Setting λ t > 0 allows rejection of hypotheses with high target-side cluster assumption violation.
By rejecting such hypotheses from the hypothesis space H , VADA reduces d H ∆ H and yields a tighter bound on the target generalization error.
We verify empirically that VADA achieves signiﬁcant improvements over existing models on multiple domain adaptation benchmarks (Table 1).
[Figure]
D ECISION - BOUNDARY I TERATIVE R EFINEMENT T RAINING
In non-conservative domain adaptation, we account for the following inequality,
[Equation]
where ( (cid:15) s , (cid:15) t ) are generalization error functions for the source and target domains.
This means that, for a given hypothesis class H , the optimal classiﬁer in the source domain does not coincide with the optimal classiﬁer in the target domain.
We assume that the optimality gap in Eq.
(10) results from violation of the cluster assumption.
In other words, we suppose that any source-optimal classiﬁer drawn from our hypothesis space necessarily violates the cluster assumption in the target domain.
Insofar as VADA is trained on the source domain, we hypothesize that a better hypothesis is achievable by introducing a secondary training phase that solely minimizes the target-side cluster assumption violation.
Under this assumption, the natural solution is to initialize with the VADA model and then further minimize the cluster assumption violation in the target domain.
In particular, we ﬁrst use VADA to learn an initial classiﬁer h θ 0 .
Next, we incrementally push the classiﬁer’s decision boundaries away from data-dense regions by minimizing the target-side cluster assumption violation loss L t in
Eq.
We denote this procedure Decision-boundary Iterative Reﬁnement Training (DIRT).
5. D ECISION - BOUNDARY I TERATIVE R EFINEMENT T RAINING WITH A T EACHER
Stochastic gradient descent minimizes the loss L t by selecting gradient steps ∆ θ according to the following objective,
[Equation]
[Equation] [Equation]
which deﬁnes the neighborhood in the parameter space
This notion of neighborhood is sensitive to the parameterization of the model; depending on the parameterization, a seemingly small step ∆ θ may result in a vastly different classiﬁer.
This contradicts our intention of incrementally and locally pushing the decision boundaries to a local conditional entropy minimum, which requires that the decision boundaries of h θ +∆ θ stay close to that of h θ .
It is therefore important to deﬁne a neighborhood that is parameterization-invariant.
Following Pascanu & Bengio (2013), we instead select ∆ θ using the following objective,
[Equation]
Each optimization step now solves for a gradient step ∆ θ that minimizes the conditional entropy, subject to the constraint that the Kullback-Leibler divergence between h θ ( x ) and h θ +∆ θ ( x ) is small for x ∼ X t .
The corresponding Lagrangian suggests that one can instead minimize a sequence of optimization problems
[Equation]
that approximates the application of a series of natural gradient steps.
In practice, each of optimization problems in Eq.
(14) can be solved approximately via a ﬁnite number of stochastic gradient descent steps.
We denote the number of steps taken to be the reﬁnement interval B .
Similar to Tarvainen & Valpola (2017), we use the Adam Optimizer with Polyak averaging (Polyak & Juditsky, 1992).
We interpret h θ n − 1 as a (sub-optimal) teacher for the student model h θ n , which is trained to stay close to the teacher model while seeking to reduce the cluster assumption violation.
As a result, we denote this model as Decision-boundary Iterative Reﬁnement
Training with a Teacher (DIRT-T).
Weakly-Supervised Learning .
This sequence of optimization problems has a natural interpretation that exposes a connection to weakly-supervised learning.
In each optimization problem, the teacher model h θ n − 1 pseudo-labels the target samples with noisy labels.
Rather than naively training the student model h θ n on the noisy labels, the additional training signal L t allows the student model to place its decision boundaries further from the data.
If the clustering assumption holds and the initial noisy labels are sufﬁciently similar to the true labels, conditional entropy minimization can improve the placement of the decision boundaries (Reed et al., 2014).
Domain Adaptation .
An alternative interpretation is that DIRT-T is the recursive extension of
VADA, where the act of pseudo-labeling of the target distribution constructs a new “source” domain (i.e. target distribution X t with pseudo-labels).
The sequence of optimization problems can then be seen as a sequence of non-conservative domain adaptation problems in which X s =
X t but p s ( y | x ) (cid:54) =
p t ( y | x ) , where p s ( y | x ) =
h θ n − 1 ( x ) and p t ( y | x ) is the true conditional label distribution in the target domain.
Since d
H ∆ H is strictly zero in this sequence of optimization problems, domain adversarial training is no longer necessary.
Furthermore, if L t minimization does improve the student classiﬁer, then the gap in Eq.
(10) should get smaller each time the source domain is updated.
E XPERIMENTS
In principle, our method can be applied to any domain adaptation tasks so long as one can deﬁne a reasonable notion of neighborhood for virtual adversarial training (Miyato et al., 2016).
For comparison against Saito et al.
(2017) and French et al.
(2017), we focus on visual domain adaptation and evaluate on MNIST, MNIST-M, Street View House Numbers (SVHN), Synthetic Digits (SYN
DIGITS),
Synthetic Trafﬁc Signs (SYN SIGNS), the German Trafﬁc Signs Recognition Benchmark (GTSRB), CIFAR-10, and STL-10.
For non-visual domain adaptation, we evaluate on Wi-Fi activity recognition.
6. I MPLEMENTATION D ETAIL
Architecture We use a small CNN for the digits, trafﬁc sign, and Wi-Fi domain adaptation experiments, and a larger CNN for domain adaptation between CIFAR-10 and STL-10.
Both architectures are available in Appendix A. For fair comparison, we additionally report the performance of source-only baseline models and demonstrate that the signiﬁcant improvements are attributable to our proposed method.
Replacing gradient reversal .
In contrast to Ganin & Lempitsky (2015), which proposed to implement domain adversarial training via gradient reversal, we follow the suggestion in Goodfellow et al.
and instead optimize via alternating updates to the discriminator and encoder.
Further details are provided in Appendix C
Instance normalization .
We explored the application of instance normalization as a pre-processing step to the input image.
This procedure makes the classiﬁer invariant to channel-wide shifts and rescaling of pixel intensities.
A discussion of instance normalization for domain adaptation is provided in Appendix D. We show in Figure 3 the effect of applying instance normalization to the input image.
Hyperparameters .
For each task, we tuned the four hyperparameters ( λ d , λ s , λ t , β ) by randomly selecting 1000 labeled target samples from the training set and using that as our validation set.
We observed that extensive hyperparameter-tuning is not necessary to achieve state-of-the-art performance.
In all experiments with instance-normalized inputs, we restrict our hyperparameter search for each task to λ d = { 0 , 10 − 2 } , λ s = { 0 , 1 } , λ t = { 10 − 2 , 10 − 1 } .
We ﬁxed β = 10 − 2 .
Note that the decision to turn ( λ d , λ s ) on or off that can often be determined a priori .
A complete list of the hyperparameters is provided in Appendix B.
6. M ODEL E VALUATION
[Table] [Table]
[Table]
MNIST → MNIST-M .
We ﬁrst evaluation the adaptation from MNIST to MNIST-M. MNIST-M is constructed by blending MNIST digits with random color patches from the BSDS500 dataset.
MNIST ↔ SVHN .
The distribution shift is exacerbated when adapting between MNIST and SVHN.
Whereas MNIST consists of black-and-white handwritten digits, SVHN consists of crops of colored, street house numbers.
Because MNIST has a signiﬁcantly lower intrinsic dimensionality that SVHN, the adaptation from MNIST → SVHN is especially challenging when the input is not pre-processed via instance normalization.
When instance normalization is applied, we achieve a strong state-ofthe-art performance 76 .
5% and an equally impressive margin-of-improvement over source-only of 35 .
Interestingly, by reducing the reﬁnement interval B and taking noisier natural gradient steps, we were occasionally able to achieve accuracies as high as 87% .
However, due to the high-variance associated with this, we omit reporting this conﬁguration in Table 1.
SYN DIGITS → SVHN .
The adaptation from SYN DIGITS → SVHN reﬂect a common adaptation problem of transferring from synthetic images to real images.
The SYN DIGITS dataset consist of 500000 images generated from Windows fonts by varying the text, positioning, orientation, background, stroke color, and the amount of blur.
SYN SIGNS → GTSRB .
This setting provides an additional demonstration of adapting from synthetic images to real images.
Unlike SYN DIGITS → SVHN, SYN SIGNS → GTSRB containsclasses instead of 10.
STL ↔ CIFAR .
Both STL-10 and CIFAR-10 are 10-class image datasets.
These two datasets contain nine overlapping classes.
Following the procedure in French et al.
, we removed the non-overlapping classes (“frog” and “monkey”) and reduce to a 9-class classiﬁcation problem.
We achieve state-of-the-art performance in both adaptation directions.
In STL → CIFAR, we achieve a 11 .
7% margin-of-improvement and a performance accuracy of 73 .
Note that because STLcontains a very small training set, it is difﬁcult to estimate the conditional entropy, thus making
DIRT-T unreliable for CIFAR → STL.
[Figure]
Activity Recognition Task
Wi-Fi Activity Recognition .
To evaluate the performance of our models on a non-visual domain adaptation task, we applied VADA and DIRT-T to the Wi-Fi Activity Recognition Dataset (Youseﬁ et al., 2017).
The Wi-Fi Activity Recognition Dataset is a classiﬁcation task that takes the Wi-Fi
Channel State Information (CSI) data stream as input x to predict motion activity within an indoor area as output y .
Domain adaptation is necessary when the training and testing data are collected from different rooms, which we denote as Rooms A and B. Table 3 shows that VADA signiﬁcantly improves classiﬁcation accuracy compared to Source-Only and DANN.
However, DIRT-T does not lead to further improvements on this dataset.
We perform experiments in Appendix F which suggests that VADA already achieves strong clustering in the target domain for this dataset, and therefore
DIRT-T is not expected to yield further performance improvement.
Overall .
We achieve state-of-the-art results across all tasks.
For a fairer comparison against ATT and the Π -model, Table 2 provides the improvement margin over the respective source-only performance reported in each paper.
In four of the tasks (MNIST → MNIST-M, SVHN → MNIST,
MNIST → SVHN, STL → CIFAR), we achieve substantial margin of improvement compared to previous models.
In the remaining three tasks, our improvement margin over the source-only model is competitive against previous models.
Our closest competitor is the Π -model.
However, unlike the Π -model, we do not perform data augmentation.
It is worth noting that DIRT-T consistently improves upon VADA.
Since DIRT-T operates by incrementally pushing the decision boundaries away from the target domain data, it relies heavily on the cluster assumption.
DIRT-T’s empirical success therefore demonstrates the effectiveness of leveraging the cluster assumption in unsupervised domain adaptation with deep neural networks.
6. A NALYSIS OF VADA AND DIRT-T 6.3. R OLE OF V IRTUAL A DVERSARIAL T RAINING
To study the relative contribution of the virtual adversarial training in the VADA and DIRT-T objectives (Eq.
(8) and Eq.
(14) respectively)
[Table]
we perform an extensive ablation analysis in Table
[Table]
The removal of the virtual adversarial training component is denoted by the “no-vat” subscript.
Our results show that VADA no-vat is sufﬁcient for out-performing DANN in all but one task.
The further ability for DIRT-T no-vat to improve upon VADA no-vat demonstrates the effectiveness of conditional entropy minimization.
Ultimately, in six of the seven tasks, both virtual adversarial training and conditional entropy minimization are essential for achieving the best performance.
The empirical importance of incorporating virtual adversarial training shows that the locally-Lipschitz constraint is beneﬁcial for pushing the classiﬁer decision boundaries away from data
[Table]
[Figure]
6.3. R OLE OF T EACHER M ODEL IN DIRT-T
[Figure]
When considering Eq.
(14), it is natural to ask whether deﬁning the neighborhood with respect to the classiﬁer is truly necessary.
In Figure 4, we demonstrate in SVHN → MNIST and STL → CIFAR that removal of the KL-term negatively impacts the model.
Since the MNIST data manifold is low-dimensional and contains easily identiﬁable clusters, applying naive gradient descent (Eq.
(12)) can also boost the test accuracy during initial training.
However, without the KL constraint, the classiﬁer can sometimes deviate signiﬁcantly from the neighborhood of the previous classiﬁer, and the resulting spikes in the KL-term correspond to sharp drops in target test accuracy.
In STL →
CIFAR, where the data manifold is much more complex and contains less obvious clusters, naive gradient descent causes immediate decline in the target test accuracy.
6.3. V ISUALIZATION OF R EPRESENTATION
[Figure]
We further analyze the behavior of VADA and DIRT-T by showing T-SNE embeddings of the last hidden layer of the model trained to adapt from MNIST → SVHN.
In Figure 5, source-only training shows strong clustering of the MNIST samples (blue) and performs poorly on SVHN (red).
VADA offers signiﬁcant improvement and exhibits signs of clustering on SVHN.
DIRT-T begins with the VADA initialization and further enhances the clustering, resulting in the best performance on MNIST → SVHN.
6. D OMAIN A DVERSARIAL T RAINING : L AYER A BLATION
[Figure]
[Table]
training is applied to various layers.
We denote the very last (simplex) layer of the neural network as L and ablatively domain adversarial training to the last eight layers.
A lower bound on the Jensen-Shannon Divergence is computed by training a logistic regression model to predict domain origin when given the layer embeddings.
In Table 5, we applied domain adversarial training to various layers of a Domain Adversarial Neural Network (Ganin & Lempitsky, 2015) trained to adapt MNIST → SVHN.
With the exception of layers L − 2 and L − 0 , which experienced training instability, the general observation is that as the layer gets deeper, the additional capacity of the corresponding embedding function allows better matching of the source and target distributions without hurting source generalization accuracy.
This demonstrates that the combination of low divergence and high source accuracy does not imply better adaptation to the target domain.
Interestingly, when the classiﬁer is regularized to be locally-Lipschitz via VADA, the combination of low divergence and high source accuracy appears to correlate more strongly with better adaptation.
C ONCLUSION
In this paper, we presented two novel models for domain adaptation inspired by the cluster assumption.
Our ﬁrst model, VADA, performs domain adversarial training with an added term that penalizes violations of the cluster assumption.
Our second model, DIRT-T, is an extension of VADA that recursively reﬁnes the VADA classiﬁer by untethering the model from the source training signal and applying approximate natural gradients to further minimize the cluster assumption violation.
Our experiments demonstrate the effectiveness of the cluster assumption: VADA achieves strong performance across several domain adaptation benchmarks, and DIRT-T further improves VADA performance.
Our proposed models open up several possibilities for future work.
One possibility is to apply DIRT-T to weakly supervised learning; another is to improve the natural gradient approximation via K-FAC (Martens & Grosse, 2015) and PPO (Schulman et al., 2017).
Given the strong performance of our models, we also recommend them for other downstream domain adaptation applications.
A
[Table] [Table]
B H YPERPARAMETERS
We observed that extensive hyperparameter-tuning is not necessary to achieve state-of-the-art performance.
To demonstrate this, we restrict our hyperparameter search for each task to λ d = { 0 , 10 − 2 } , λ s = { 0 , 1 } , λ t = { 10 − 2 , 10 − 1 } , in all experiments with instance-normalized inputs.
We ﬁxed β = 10 − 2 .
Note that the decision to turn ( λ d , λ s ) on or off that can often be determined a priori based on prior belief regarding the extent to covariate shift.
In the absence of such prior belief, a reliable choice is ( λ d = 10 − 2 , λ s = 1 , λ t = 10 − 2 , β = 10 − 2 )
[Table]
target-side virtual adversarial training) only during VADA.
We apply target-side conditional entropy minimization and virtual adversarial training during DIRT-T.
To compensate, we use a lower β during the DIRT-T phase to allow for larger natural gradient steps.
When the target domain is MNIST/MNIST-M, the task is sufﬁciently simple that we only allocate
B = 500 iterations to each optimization problem in Eq.
In all other cases, we set the reﬁnement interval B = 5000 .
We apply Adam Optimizer (learning rate = 0 .
001 , β 1 = 0 .
5 , β 2 = 0 .
with Polyak averaging (more accurately, we apply an exponential moving average with momentum = 0 .
998 to the parameter trajectory).
VADA was trained for 80000 iterations and DIRT-T takes
VADA as initialization and was trained for up to 80000 iterations.
C R EPLACING G RADIENT R EVERSAL
We note from Goodfellow et al.
that the gradient of ∇ f ln(1 − D ( f ( x ))) is weaker than −∇ f ln D ( f ( x )) during initial training since the latter rescales the gradient by 1 /D
( f ( x )) .
Following this observation, we replace the gradient reversal procedure with alternating minimization of
[Equation]
The choice of using gradient reversal versus alternating minimization reﬂects a difference in choice of approximating the mini-max using saturating versus non-saturating optimization (Fedus et al., 2017).
In some of our initial experiments, we observed the replacement of gradient reversal with alternating minimization stabilizes domain adversarial training.
However, we encourage practitioners to try either optimization strategy when applying VADA.
D I NSTANCE N ORMALIZATION FOR D OMAIN A DAPTATION
Theorem 1 suggests that we should identify ways of constraining the hypothesis space without hurting the global optimal classiﬁer for the joint task.
We propose to further constrain our model by introducing instance normalization as a pre-processing step for the input data.
Instance normalization was proposed for style transfer Ulyanov et al.
and applies the operation
[Equation]
where x ( i ) ∈
R H × W × C denotes the i th sample and µ, σ : R H × W × C
→ R C are functions that compute the mean and standard deviation across the spatial dimensions.
A notable property of instance normalization is that it is invariant to channel-wide scaling and shifting of the input elements.
Formally, consider scaling and shift variables γ, β ∈ R C .
If γ (cid:31) 0 and σ ( x ( i ) ) is deﬁned, then
[Equation]
For visual data the application of instance normalization to the input layer makes the classiﬁer invariant to channel-wide shifts and scaling of the pixel intensities.
For most visual tasks, sensitivity to channel-wide pixel intensity changes is not critical to the success of the classiﬁer.
As such, instance normalization of the input may help reduce d H ∆ H without hurting the globally optimal classiﬁer.
Interestingly, Figure 3 shows that input instance normalization is not equivalent to gray-scaling, since color is partially preserved.
To test the effect of instance normalization, we report results both with and without the use of instance-normalized inputs.
E L IMITATION OF D OMAIN A DVERSARIAL T RAINING
For simplicity, we restrict ourselves to the case of binary classiﬁcation with balanced classes, where the marginal label distributions Y s and Y t are the same, and which we shall refer to as simply Y , and that Y is a random variable uniformly distributed over the support Y = { 0 , 1 } .
Next, we construct the following probabilistic graphical model
[Equation] [Equation]
where p s , p t are any conditional probability density functions deﬁned over the space of X .
We consider any source and target domains whose underlying data-generating function p satisﬁes this generative model.
Next, we consider a family of embedding functions F and deﬁne f ∈ F to be a stochastic function f :
[Equation]
Z where E (in an abuse of notation) is a multivariate Gaussian random variable—a condition that holds in practice since noise is often injected into the classiﬁer.
And let the probabilistic embedding classiﬁer
[Equation]
18) be the true posterior probability of the event Y = 1 conditioned on z .
Note that, by construction, g is a linear classiﬁer.
Similarly, we deﬁne
[Equation] [Equation]
where ( k s , k t ) are the true labeling functions corresponding to the source and target domains.
Following Ben-David et al.
(2010a), we deﬁne the generalization error (cid:15) of a hypothesis h :
X → { 0 , 1 } with respect to a labeling function k : X → [0 , 1] and covariate distribution X as
[Equation]
Note that, for a given ( k, X ) , the Bayes-optimal hard classiﬁer h ∗ achieves the optimal generalization error (cid:15) ( h ∗ , k, X ) and can be constructed from the true labeling function as
[Equation]
(22) where (cid:98)·(cid:101) rounds to the nearest integer.
We therefore denote the Bayes-optimal hard classiﬁer in the source domain as h ∗ s ( x ) = (cid:98)
k
s ( x ) (cid:101) with a source generalization error of (cid:15) ∗ s
= (cid:15) ( h ∗ s , k s , X s ) .
We deﬁne the target domain Bayes-optimal hard classiﬁer h ∗ t and its target generalization error (cid:15) ∗ t analogously.
Proposition 1 Let ( X s , X t ) be random variables corresponding to the source and target domains from Eq.
If the embedding function family F has inﬁnite capacity and ( X s , X t ) have disjoint supports X s ∩ X t = ∅ , then
there exists f ∈ F such that f ( X s , E ) =
f ( X t , E ) and h ( x )
= (cid:98) E ε ∼E [ g ◦ f
( x, ε )] (cid:101) achieves the source error (cid:15) ( h, k s , X s )
= (cid:15) ∗ s and target error (cid:15) ( h, k t , X t ) =
(cid:15) ∗ t .
there exists f (cid:
) ∈ F such that f (cid:48)
( X s , E ) =
f (cid:48)
( X t , E ) and h (cid:48) ( x ) = (cid:98) E ε ∼E [ g ◦ f (cid:48) ( x, ε )] (cid:101) achieves the source error (cid:15) ( h (cid:48) , k s , X s )
=
(cid:15) ∗ s but the target error (cid:15)
( h (cid:48) , k t , X t ) = 1 − (cid:15) ∗ t .
Proof sketch.
The true labeling function in each domain is
[Equation]
Since F has inﬁnite capacity, let f s simulate sampling from p ( z | X s = x ) and let f t sample from p ( z | X t = x ) .
The labeling functions can thus be reparameterized as
[Equation] [Equation]
Since X s and X t are disjoint, let D : X → { 0 , 1 } classify the domain origin, where D ( x ) =
⇐⇒ x ∈ X t .
Then, construct the embedding function as
[Equation]
It is easy to see that
[Equation]
28) and that therefore
[Equation] [Equation]
Now consider the volume-preserving bijective function v : (0 , 2) → (0 , 2)
[Equation]
Deﬁne the embedding function f (cid:48) s as
[Equation]
Since v reverses the mapping in the space of Z when x ∈ X t ,
[Equation]
33) and therefore
[Equation] [Equation]
35) f (cid:48) ( x, (cid:15) ) will thus generalize well in the source domain and produce domain-invariant features, but perform poorly in the target domain.
[Equation]
ONNECTION TO T HEOREM
A justiﬁcation for domain adversarial training is that it bounds the H ∆ H -divergence term in Theorem 1.
Consider a family of embedding functions F and embedding classiﬁers G .
For any f ∈ F and g ∈ G , we can construct a hypothesis h as
[Equation]
We can then deﬁne the hypothesis space H as the set of all hypotheses achievable through this construction.
We now consider a subset F d = { f ∈ F | f ( X s , E ) =
f ( X t , E ) } as the family of embedding functions that satisﬁes the domain adversarial training constraint.
For any f d
[Equation]
F d and g ∈ G , we can construct a hypothesis h
d
as
[Equation]
We then denote the restricted hypothesis space which satisﬁes the domain adversarial training constraint as H d ⊆ H .
It is easy to see that from the deﬁnition that d H d ∆ H d ≤ d H ∆ H .
However, if
F has inﬁnite capacity and ( X s , X t ) have disjoint supports, Proposition 1 suggests that d H d ∆ H d is maximal, resulting in a vacuous upper bound.
Corollary 1 Let X s be a random variable whose support can be partitioned into X (cid:48) s ∪ X (cid:48)(cid:48) s =
X s such that Pr
( X
[Equation]
=
Pr( X s
[Equation]
X (cid:48)(cid:48) s
[Equation]
= 0 .
And let ( X t , X (cid:48) t , X (cid:48)(cid:48) t ) be analogously deﬁned.
If
X s ∩ X t = ∅ and F has inﬁnite capacity, then d H d ∆ H d = 2 .
Proof sketch.
From Eq.
(17), deﬁne p s ( x | z ) as
[Equation]
It follows that
[Equation]
and that the source generalization error is (cid:15) ∗ s = 0 .
A similar analysis follows for the target domain.
From Proposition 1, we can conclude that there exists h, h (cid:
) ∈
H d such that
[Equation] [Equation]
From the deﬁnition of d H ∆ H , we see that
[Equation]
The H d ∆ H d -divergence thus achieves the maximum value of 2 .
[Equation]
F N ON -V ISUAL D OMAIN A DAPTATION T ASK
To evaluate the performance of our models on a non-visual domain adaptation task, we applied
VADA and DIRT-T to the Wi-Fi Activity Recognition Dataset (Youseﬁ et al., 2017).
The Wi-Fi
Activity Recognition Dataset is a classiﬁcation task that takes the Wi-Fi Channel State Information (CSI) data stream as input x to predict motion activity within an indoor area as output y .
The dataset collected the CSI data stream samples associated with seven activities, denoted as “bed”, “fall”, “walk”, “pick up”, “run”, “sit down”, and “stand up”.
However, the joint distribution over the CSI data stream and motion activity changes depending on the room in which the data was collected.
Since the data was collected for multiple rooms, we selected two rooms (denoted here as Room A and Room B) and constructed the unsupervised domain adaptation task by using Room A as the source domain and Room B as the target domain.
We compare the performance of DANN, VADA, and DIRT-T on the Wi-Fi domain adaptation task in Table 3, using the hyperparameters ( λ d = 0 , λ s = 0 , λ t = 10 − 2 , β = 10 − 2 ) .
Table 3 shows that VADA signiﬁcantly improves classiﬁcation accuracy compared to Source-Only and DANN.
However, DIRT-T does not lead to further improvements on this dataset.
We believe this is attributable to VADA successfully pushing the decision boundary away from data-dense regions in the target domain.
As a result, further application of DIRT-T would not lead to better decision boundaries.
To validate this hypothesis, we visualize the t-SNE embeddings for VADA and DIRT-T in Figure 6 and show that VADA is already capable of yielding strong clustering in the target domain.
To verify that the decision boundary indeed did not change signiﬁcantly, we additionally provide the confusion matrix between the VADA and DIRT-T predictions in the target domain (Fig. 7).
[Figure] [Figure]