S TABILIZING A DVERSARIAL I NVARIANCE I NDUCTION BY D ISCRIMINATOR M ATCHING
Anonymous authors
Paper under double-blind review
A BSTRACT
Incorporating the desired invariance into representation learning is a key challenge in many situations, e.g., for domain generalization and privacy/fairness constraints.
An adversarial invariance induction (AII) shows its power on this purpose, which maximizes the proxy of the conditional entropy between representations and attributes by adversarial training between an attribute discriminator and feature extractor (Xie et al., 2017).
However, the practical behavior of AII is still unclear as the previous analysis assumes the optimality of the attribute classiﬁer, which is rarely held in practice.
This paper ﬁrst analyzes the practical behavior of
AII, indicating that AII has theoretical difﬁculty as it maximizes variational upper bound of the actual conditional entropy, and AII catastrophically fails to induce invariance even in simple cases as suggested by the above theoretical ﬁndings.
We then argue that a simple modiﬁcation to AII can signiﬁcantly stabilize the adversarial induction framework and achieve better invariant representations.
Our modiﬁcation is based on the property of conditional entropy; it is maximized if and only if the divergence between all pairs of marginal distributions over representations between different attributes is minimized.
The proposed method, invariance induction by discriminator matching , modify AII objective to explicitly consider the divergence minimization requirements.
Empirical validations on both the toy dataset and four real-world datasets (related to applications of user anonymization and domain generalization) reveal that the proposed method provides superior performance when inducing invariance for nuisance factors.
I NTRODUCTION
Extensive studies have demonstrated that deep neural networks (DNNs) can uncover complicated variations in data to provide powerful representations that are useful for classiﬁcation tasks (Hinton et al., 2006; Krizhevsky et al., 2012).
However, in some scenarios, the learned representation should be invariant to some attribute of the input data.
A motivating example is a task called domain generalization (Blanchard et al., 2011), which requires learning a domain-invariant representation that applies to unseen domains (e.g., the data of an unseen user or different image sources).
When practitioners apply DNNs to data that include a large amount of user information (such as images with usernames (Edwards & Storkey, 2016) or data from wearables (Iwasawa et al., 2017)), the desired representations should not include user identifying information.
For legal and ethical reasons, machine learning algorithms must make fair decisions that are independent of sensitive variables such as gender, age, or race (Louizos et al., 2016).
Therefore, this study aims to answer the following question: how can we systematically incorporate the desired invariance into representation learning?
Invariance induction is a systematic solution to this problem, which often introduces an additional regularization term that measures the level of invariance (Edwards & Storkey, 2016; Iwasawa et al., 2017; Xie et al., 2017).
One theoretically sound metric is the conditional entropy of attributes given representations of data H ( a | z ) =
E p ( z,a ) [ − log p ( a | z )] , where a and z denote the random variables of attributes and representations, as it is maximized if and only if the representations are invariant to attributes.
However, exact calculation is intractable as p ( a | z ) is unknown in general.
Recently, Xie et al.
(2017) introduced a sensible way to approximate the conditional entropy (Figure 1-(a)), which uses probabilistic attribute classiﬁer q φ , where φ represents the parameter of the classiﬁer, to approximate the conditional probability distribution p ( a | z ) .
One can estimate the desired conditional entropy by simply substituting p ( a | z ) to the approximated conditional distribution
[Figure]
q φ ( a | z ) .
The estimated conditional entropy is then used to update the weights of the encoder f
θ so that the updated representations increase the approximated conditional entropy.
Since f θ and q φ is an adversarial relationship, this framework is called adversarial invariance induction (AII) .
A similar approach was extensively used in domain generalization, fair-prediction, and privacy-protection contexts (Edwards & Storkey, 2016;
Motiian et al., 2017; Xie et al., 2017; Iwasawa et al., 2017).
Build upon the above achievements, this paper examines a way to improve the stability of the adversarial invariance induction framework.
Note that, Xie et al.
(2017) already demonstrated that the above procedure (alternatively optimizing attribute classiﬁer and feature extractor) possesses an equilibrium where the encoder maximizes the true conditional entropy.
However, their analysis impractically assumes q φ ( a | z )
=
p ( a | z ) , so little is known about the practical behavior of AII and how to improve it.
Indeed, several prior works report unsuccessful results of AII (Xie et al., 2017;
Moyer et al., 2018).
To further examine the practical behavior of AII, we ﬁrst analyze the behavior of AII from the lens of the variational approximation.
Our analysis shows that AII maximizes the variational upper bound of the conditional entropy H ( a | z ) , and AII objective itself is not upperbounded.
This result suggests that the optimization of AII, without the assumption of the optimality of q φ ( a | z ) , does not need to maximize the conditional entropy, as the maximizing upper bound does not give any guarantees.
Empirical validations show that AII catastrophically fails to induce invariance even in satisfactory simple situations, as suggested by the above ﬁnding.
We then argue that the simple modiﬁcation to AII attains better property from the optimization perspective while achieving the same goal asymptotically.
Our modiﬁcation is based on the property of the conditional entropy, i.e., it is maximized if and only if the divergence between all pairs of marginal distributions over z between different attributes are minimized (under the uniform assumption of p ( a ) ).
This property suggests that the invariance induction algorithm should also minimize the divergence, which is not considered on AII and possibly induce unstable behavior.
In contrast, our proposed method, invariance induction by discriminator matching (IIDM) , explicitly considers the divergence minimization requirements by minimizing the proxy of the divergence between the marginals, which push the representations with different attributes are recognized similarly by the discriminator (as shown in Figure 1-(b)).
We discuss the relationship among our proxy, the divergence between the marginals, and non-saturating heuristics used in different but related community (Goodfellow et al., 2014).
The main contributions of this paper can be summarized as follows.
(1) We highlight the practical issues of AII, which is a state-of-the-art framework for invariance induction.
(2) We propose a modiﬁcation to AII by explicitly consider the property of the maximum conditional entropy.
Empirical validations on the toy dataset and four real-world datasets demonstrate that the proposed method provides superior performance and faster convergence at the level of invariance induction.
For example, in the experiments on toy dataset, the proposed method converges to mostly the maximum conditional entropy, while the optimization of AII is catastrophically unstable.
Gif visualizations available at https://drive.google.com/open?id= 1N2kuTCfwjQBGgv3dxTSD9oBklAenLj
(see Section 4.3 for more detail).
R ELATED W ORKS
The goal of the invariance induction is to learn attribute-invariant spaces given a training dataset made of tuples of (cid:8) ( x n , y n , a n ) (cid:9) N n =1 (supervised setting) or pairs of (cid:8) ( x n , y n ) (cid:9) N n =1 (referred to as unsupervised setting (Jaiswal et al., 2018)), where x n is an observation and y n is a target of x n , a n ∈
A is a realization of a categorical random variable a .
This setting arises in many application areas.
For example, Iwasawa et al.
(2017) considers the privacy-preserving activity recognition problem using the data of wearables, where one wants to learn user invariant representations while keeping the information about activity into the representations.
In this case, the attribute a corresponds to some sensitive user information, and y is the activity label.
In the context of fairness-aware decision making, one needs to ensure the algorithm to make fair decisions, which often done by statistical away the sensitive attributes a (such as gender, age, or race) from the representations (Edwards & Storkey, 2016).
To build a classiﬁer robust to the domain shifts (called domain generalization
Blanchard et al.
(2011)), learning representations invariant to domain shifts is a popular approach (the domain label is the attribute in this case)
(Muandet et al., 2013; Ghifary et al., 2015).
Assume f
θ is a function (encoder) that parameterized by a neural network, which maps observations x to representations z ∈ Z .
Typically, the invariance induction algorithm use differentiable dependency measurements and use it as a regularization term to learn f θ : E [ L ( f θ ( x n ) , y n ) + λV ( f θ ( x n ) , a n )] , where a λ is the weighting parameter, V somehow measures invariance of the representations regarding the attribute, and L is a loss function that represents how much information about y is present in the representations.
Adversarial invariance induction (AII) is a recently proposed approach for measuring the V by an external neural network.
That is, if the external network can accurately predict a from z = f θ ( x ) ,
AII considers z to have considerable information about a .
The external neural network is often called as a discriminator or adversary in this context.
Information from the discriminator is used to update the weights of the encoder f
θ so that the updated representations have less information about a .
Mathematically, the method optimizes following min–max game:
[Equation]
where q ψ ( y | . ) and q φ ( a | . ) is a conditional probability distribution approximated by a categorical classiﬁer parameterized by ψ (for y ) and φ (for a ) respectively.
By alternatingly (or jointly with the gradient reversal layer (Gan et al., 2016)) optimizing θ and φ , this framework ensures that there is little or no information about the nuisance attributes in the representations.
As Xie et al.
(2017) demonstrated, the above min–max game can be regarded as a way to estimate the conditional entropy H ( a | z ) and use the estimates to induce the invariance.
The key advantage of AII is that this framework does not depend on the pre-deﬁned metrics such as L2 distance and maximum mean discrepancy (Zemel et al., 2013; Li et al., 2014;
Louizos et al., 2016)), which is often easy to compute yet less powerful.
Formally, Xie et al.
(2017) demonstrated that the above adversarial game has an equilibrium where the encoder maximizes the true conditional entropy, under the assumption that q φ ( a | z ) correctly estimates the true p ( a | z ) .
However, their analysis assumes the optimality of q φ ( a | z ) , which is rarely held in practice.
This paper analyzes the behavior of AII without such an assumption to examine the practical behavior of AII.
It is noteworthy that the above formulation resembles the original formulation of GAN (Goodfellow et al., 2014) and domain adversarial networks (DAN) (Ajakan et al., 2014; Gan et al., 2016), which is never used practically.
Instead, they often incorporate several heuristics, e.g., non-saturating heuristics in GAN, and asymmetric mapping in domain adaptation (Tzeng et al., 2017).
These works motivate us to replace the min–max game of the adversarial invariance induction problem.
Although no prior works in the invariance induction community have been explicitly considered yet, one can transfer the non-saturating heuristic used in the GAN via label ﬂipping:
[Equation]
which also enhances the discriminator to misclassify the attribute of the data.
In the remainder of this paper, we refer to this version as the non-saturating version and denote it by NS.
As discussed in the GAN community, this objective provides meaningful gradients because it not saturated even if the discriminator is a supremum.
Later, we discuss the connection between the proposal and this objective, and how our proposal attains better properties while inheriting the non-saturating nature of the NS objective.
P RACTICAL B EHAVIOR OF A DVERSARIAL I NVARIANCE I NDUCTION
In this section, we analyze the practical behavior of AII framework.
As mentioned above, the prior analysis of AII focus on the ideal situation where one can access the perfect attribute classiﬁer, i.e., q φ ( a | z )
= p ( a | z ) .
What happen if the optimality does not holds?
As the optimally rarely holds in practice, it is important to analyze the behavior under the absence of the optimality.
3. V ARIATIONAL B OUNDS
To examine the practical behavior of AII, we ﬁrst derive the general relationships between the conditional entropy and AII framework, without assuming q φ ( a | z )
= p ( a | z ) .
In the remainder of this paper, we assume the use of alternating optimization to solve the adversarial game.
At each iteration, AII ﬁrst updates the attribute classiﬁer κ times by maximizing eq. 1 while ﬁxing f θ .
AII then updates the encoder by minimizing the eq.1 while ﬁxing q φ .
The conditional entropy and AII objective has the following relationships:
[Equation]
where D KL represents the Kullback–Leibler (KL) divergence, which is greater than zero by definition, and p θ ( z ) is an empirical distribution of representations.
Maximizing H q ( a | z ) yields the encoder update in AII framework exactly.
The update of the discriminator is equivalent to minimizing this KL divergence.
Therefore, the update of the discriminator tightens the bound.
The bound is tight when D KL ( p ( a | z )
||
q φ ( a | z ))
= 0 .
In this case, maximizing H q ( a | z ) is equivalent to maximizing the true conditional entropy, recovering the previous analysis (Xie et al., 2017).
Unfortunately, it is not practical to assume the optimality of q φ ( a | z ) due to the limitation of the capacity of the φ and computational costs to increase κ .
In such a practical situation, AII maximizes the upper bounds of the conditional entropy, as shown in the eq. 4.
This challenge AII as maximizing the upper bound of the function of interest f does not guarantee the maximizing the f in general (in our case, f is the conditional entropy).
For example, in the most exaggerated case, moving the entire distribution in a speciﬁc direction increases the upper bound while the actual conditional entropy remains constant.
The above observations do not immediately mean that maximizing H q ( a | z ) (which is done in AII) is useless.
However, it implies that there are regions where maximizing
H q ( a | z ) does not increase H ( a | z ) .
3. D IVERGENCE M INIMIZATION R EQUIREMENT
It is noteworthy that H q ( a | z ) itself is not upper-bounded, as assigning zero probability for correct pair of z, a makes H q ( a | z ) inﬁnity. As the true conditional entropy has maximum values by deﬁnition, it suggests that AII’s optimization has an incentive to update the parameter of the encoder even when the conditional entropy is successfully maximized.
Why AII has such an incentive? Here, we derive divergence minimization requirements for maximizing the conditional entropy and how it challenges AII optimization.
Speciﬁcally, the maximum conditional entropy holds the following property:
Proposition 1.
We assume that A is a uniform categorical random variable.
The maximum conditional entropy H ( a | z ) is − log
1 K , and H ( a | z ) is maximized if and only if p ( z | a i ) =
p ( z | a j ) for all a i (cid:54) = a j ∈ A and z ∈ Z .
The proof is shown in the Appendix A.
This proposition means that maximizing conditional entropy is asymptotically equal to minimizing pairwise divergence.
Assume D is a divergence measurement over a space of a possible probability distribution (i.e., D ( p || q ) ≥ 0 for all p, q and D ( p || q )
=
if and only if p = q ).
For simplicity, we denote the marginal distribution over a random variable z associated with an attribute a = a i as p i θ ( z ) .
Then, the following corollary holds.
Corollary 1.
If f θ gives an attribute invariant representation (i.e., conditional entropy H ( a | z ) is maximized), then D ( p iθ ( z ) || p
jθ ( z ))
=
for all a i , a j and vice versa.
The above analysis suggests that the invariance induction algorithm should also minimize the divergence between marginal distributions of different attributes a .
However, the original AII does not
[Figure]
consider such constraints as it only keeps the distribution p iθ ( z ) away where a discriminator correctly predicts the attribute.
a, b) visualize how AII updates the feature extractor, assuming there is three gaussian distribution where each distribution corresponds to different attributes.
The arrow in the represents the of the gradient the The suggests move the distribution of whether it aligns marginal distributions of
I NVARIANCE I NDUCTION BY D ISCRIMINATOR M ATCHING 4. D ISCRIMINATOR M ATCHING
Based on the analysis, we propose simple modiﬁcations to AII considering the divergence minimization requirements.
One possible approach to induce this divergence minimization requirement is to cast the representations on some distribution whose divergence is easy to compute.
For example,
KL divergence is easy to compute if both marginal distributions are Gaussian.
However, casting the distribution harms the representative power of the deep encoder as selecting the proper prior is difﬁcult in general.
Moreover, if the representations have much information about the nuisance attribute and, therefore, the marginal distributions between different attributes do not have supports in the representation spaces, D ( p || q ) generally does not exists.
We propose a simple alternative by deﬁning the proxy of the divergence using the learned critic function q φ .
Speciﬁcally, we consider a divergence over q iφ ( a ) , where q iφ ( a ) =
(cid:82) p iθ ( z ) q φ ( a | z ) dz .
In the remainder of the paper, we assume to use KL-divergence as divergence measurements, though it could be a design choice in practice.
IIDM minimizes the following discriminator matching loss for all pairs of a i and a j (cid:54) =
a i :
[Equation]
Intuitively speaking, IIDM restricts the update of the encoder to consider the location of the marginal distributions of different attributes, in addition to the decision boundary (which is all the information source of the AII).
In other words, IIDM alleviates the possibility that the encoder moves the distribution regardless of whether it aligns marginal distributions of different attributes.
Note that, such a divergence minimization perspective is missing in the original AII, as mentioned in Section 3.2.
For reference, Figure 2 compares how AII and the proposed method update the feature extractor.
Formally, the discriminator matching objective V dm is related to the divergence D KL ( p iθ ( z ) || p jθ ( z )) through the divergence between D KL ( q iφ ( a )
|| q jφ ( a )) .
Firstly, we can derive
[Equation]
by using the Jensen’s inequality.
Also, based on the data processing inequality of the f-divergence (Gerchinovitz et al., 2017; Barber et al., 2018), the following inequality holds:
[Equation]
See the Appendix B for more detail.
Algorithm
Require:
Initialize weights of neural networks { θ, φ, ψ } , and the centroid Q (0) with all data S .
while training() do while repeat κ times do update the attribute classiﬁer by eq.
9 with the bath of data B ∼ p ( x, y, a ) .
end while sample the batch of data B ∼ p ( x, y, a ) .
split the bath of data B into B 0 , · · · B K − 1 where B i is the batch of data with the attribute a i .
Q it ← γQ i ( t − 1) + (1 − γ ) 1 |B i | (cid:80) x i ∈B i q φ ( a | f θ ( x i ))
( ∀ i ∈ A ) .
update the feature extractor and label classiﬁer by eq.
10 with the batch of the data B .
end while
As V dm is an upper bound of the divergence D KL ( q iφ ( a )
|| q jφ ( a )) , minimizing V dm surely minimizes the KL-divergence.
Besides, in a special case where the attribute classiﬁer is invertible,
V dm ( θ, φ ) =
ensures that p iθ ( z )
=
p jθ ( z ) , as minimizing D KL ( q iφ ( a )
|| q jφ ( a )) is equivalent to minimizing D KL ( p iθ ( z )
|| p
jθ ( z ))
(Barber et al., 2018).
In other words, minimizing V dm has the same ﬁxed points with conditional entropy maximization if the discriminator is invertible.
Restricting the invertibility of the discriminator is an interesting direction.
However, we did not add such a regularization as restricting neural networks is difﬁcult in general and open research areas (Jacobsen et al., 2018; Behrmann et al., 2018; Ardizzone et al., 2018).
Instead, we empirically validate that the proposed method reliably learns invariant representations even without such a regularization.
It is worth mentioning that the discriminator matching loss is closely related to the non-saturating version of AII.
Speciﬁcally, the proposed method minimizes
[Equation]
and the NS objective (Eq. 2) can be rewritten as
[Equation]
where p i ( a ) is equal to 1 . 0 for a = a i and zero otherwise.
Ignoring the constant term, the only difference is whether to push q φ ( a | z j ) to q iφ ( a ) , or
true marginal p i ( a ) .
Because the discriminator matching loss considers q φ ( a (cid:54) =
a j | z j ) , similar to the NS objective, its gradient does not vanish even if q φ is the supremum.
This property encourages faster convergence as with the NS loss.
It differs from NS as it considers the divergence minimization requirements, while NS only considers the current decision boundary of the discriminator but does not consider information from p iθ ( z ) directly (similar to AII).
Therefore, NS push representations as far as possible as long as it successfully changes the discriminator’s prediction regardless of whether it aligns marginal distributions.
4. A LGORITHM
One implementation choice is how to calculate q iφ ( a ) in Eq.
The straightforward approach is through Monte Carlo approximation: q iφ ( a [Equation] = [Equation]
E p iθ ( z ) [ q φ ( a | z )] .
Although it is an unbiased estimation, the variance is large if the number of samples is small.
The average can be calculated from all samples (or a sufﬁciently large number of samples from each K attributes) at every iteration.
However, it requires additional computation other than standard mini-batch estimation.
Moreover, the computation becomes intractable as the number of attribute values grows.
We address these issues by using the moving centroid mechanism.
Instead of estimating q iθ,φ ( a ) every time with sufﬁciently large samples, the proposed method stores the moving average of q i φ ( a ) :
[Equation]
8) where Q jt − 1 is a previous centroid, q it ( a ) is the new estimation of the centroid based on a single batch, and γ is the decay parameter for controlling the speed at which the centroids change.
We initialized Q j 0 by computing the centroids of all training data points.
[Figure]
[Figure]
Then we can use the standard mini-batch method to calculate the discriminator matching loss.
As with the AII, IIDM incorporates alternating optimization.
Speciﬁcally, as with AII, IIDM ﬁrstly update the attribute classiﬁer q φ by
[Equation]
[Figure] ) and update the encoder and the classiﬁer by
[Equation]
where ψ is the parameter of the classiﬁer, the 1st term is a classiﬁcation loss (which is same with
AII), and λ is a weighting parameter.
4. S IMULATION
To clarify the practical issue of AII and the beneﬁt of the proposal, we design the toy dataset, which comprises samples from several Gaussian distributions with different means ( [sin( iK π ) , cos( iK π )] , and i ∈ 1 , 2 , · · · K ) and the same variance, assuming that each distribution corresponds to different attributes.
We test AII on this synthesized dataset while varying the number of distributions K and κ (number of updates of φ per iteration).
Speciﬁcally, we ﬁrst train the discriminator 100 times with a batch size of 128 and update q φ and f θ iteratively using stochastic gradient descent with a learning rate= 0 . 1 .
Figure 3 visualizes how distributions move during the optimization of (a) AII and (b)
IIDM on synthesized data ( K = 3 and κ =1).
The Figure 4 represents the quantitative results on this conﬁguration, where solid lines represent the approximated conditional entropy by using a post-hoc classiﬁer q eval , which is parameterized by the neural network having the same architecture as that of q φ .
For reference, the theoretical maximum value of the conditional entropy (gray line) and the negative log-likelihood of q φ (dashed lines) are also depicted.
Figure 4 compares the performances of (b) AII (c) NS, and (d) IIDM on different conﬁgurations of { K, κ } , where color denotes different
K , marker denotes different κ , and the dashed line denotes optimal values.
We can make the following observations.
(1) As shown in the visualization of AII and the vibration of the red lines in Figure 4-a, AII is catastrophically unstable, even such a simple case.
Figure 4-a also indicates that, at some points (e.g., around 50 iterations), the approximated conditional entropy becomes signiﬁcantly large, whereas the true conditional entropy remains constant or even decreases.
The issue may be alleviated if the discriminator has a sufﬁciently large capacity and is trained many times at each iteration, as suggested by a faster convergence of AII when κ = 8 .
However, the toy dataset is much simpler than real datasets, and it is fair to say that identifying the supremum is more challenging.
(2) NS is superior to AII, but it still unstable near the optimal point, as indicated by the vibration of the plots.
(3) IIDM consistently reaches the theoretical maximum values in all conﬁgurations, as depicted in Figure 4-d.
4. R EMARKS
Continuous nuisance attribute: One may question the applicability of our method to the continuous attribute case, e.g., the goal is to learn age-invariant representations.
Firstly, the treatment of continuous R.V. is an open question.
The most straightforward yet practically used answer is to discretize the continuous R.V.
For example, (Xie et al., 2017) divides an age variable into two groups.
We can apply the proposed method with similar discretization.
Semantic alignments: One well-known problem of invariant feature learning is determining how to incorporate semantic alignment, i.e., how to align only the pair of samples that have the same semantic (the target label).
For this purpose, (Li et al., 2018b) proposes adversarial training based semantic alignment method, which prepares multiple domain classiﬁcation networks where each classiﬁer specialize for each class y .
Another merit of the proposed method is that we can enforce semantic alignment with a simple modiﬁcation, without any additional computational costs.
Individually, semantic alignment can be carried out by merely computing the centroids for each (attribute, label) tuple and aligning the q φ ( a | z ) of { x, y, a } between only centroids of the same label y (cid:48)
=
y but different attributes a (cid:48)
(cid:54) = a .
Since most applications of invariant feature learning require that L y is also minimized, we also test this modiﬁcation for all the later-described experiments.
E XPERIMENTS 5. E XPERIMENTAL S ETTINGS
In addition to the simulation results, we provide experimental results on two tasks (four datasets) relevant to invariant feature learning: (1) user anonymization (Opportunity and USC datasets), and (2) domain generalization (MNISTR and PACS datasets).
All experiments were implemented in
PyTorch and were run on GPUs (either GTX 1080 or Tesla V100).
For user anonymization tasks, Opportunity and USC datasets were used.
This task is to learn anonymized representations ( z that does not contain user-identiﬁable information) while maintaining classiﬁcation performance.
The Opportunity dataset (Sagha et al., 2011) consists of sensory data regarding human activity in a breakfast scenario.
Each record consists of 113 real-value sensory readings, excluding time information.
We considered the task of recognizing 18 classes 1 .
Following previous studies (Yang et al., 2015; Iwasawa et al., 2017), we use a sliding window procedure with 30 frames and a 50% overlap.
The number of samples was 57,790 in total.
We parameterize the encoder using convolutional neural networks (CNN) with three convolution-ReLU-pooling repetitions followed by one fully connected layer and classiﬁcation by logistic regression, following previous studies (Yang et al., 2015; Iwasawa et al., 2017).
The discriminator is a simple feedforward network with 800–400 hidden units.
The USC-HAD dataset is another activity recognition dataset that consists of 14 subjects (Zhang & Sawchuk, 2012).
The data include 12 activity classes 2 that correspond to people’s most essential and daily activities.
MotionNode, which is a 6 DOF inertial measurement unit, is used to record the output from accelerometers that record six real sensory values.
The sliding window procedure, with 30 frames and a 50% overlap, produced 172,169 samples.
The MNISTR and PACS are two typical datasets of domain generalization tasks.
The MNISTR dataset, derived from MNIST, was introduced by (Ghifary et al., 2015).
Its labels comprise the ten digits; domains are created by rotating the images in multiples of 15 degrees: 0, 15, 30, 45, 60, and 75.
The domains are labeled with the angle by which they are rotated, e.g., M15 and M30.
Each image is cropped to 16 × 16 pixel in accordance with a previous study (Ghifary et al., 2015) 3 .
Similar to (Ghifary et al., 2015), we used two convolution layers with 32 and 48 ﬁlters of 5 ×kernels, followed by a max-pooling layer and two fully connected layers with 100 hidden units.
A discriminator with 100 hidden units is connected to the output of the ﬁrst fully connected layer.
The PACS dataset is a relatively new benchmark dataset designed for cross-domain recognition (Li et al., 2017).
The dataset has 9991 images in total across seven categories (dog, elephant, giraffe, guitar, house, horse, and person) and four domains of different stylistic depictions (photo, painting, open door 1, open door 2, close door 1, close door 2, open fridge, close fridge, open dishwasher, close dishwasher,
[Table]
cartoon, and sketch).
The diverse depiction styles provide a signiﬁcant domain gap.
We use the
ImageNet pre-trained AlexNet CNN (Krizhevsky et al., 2012) as a base network, following previous studies(Li et al., 2017; 2018a).
A discriminator with 1024 hidden units is connected to the output of the last fully connected layer.
Baselines: To demonstrate the efﬁcacy of the proposed method, we compared it with the following methods.
(1) A CNN trained on the aggregation of data from all source domains.
Although there are special treatments for domain generalization, (Li et al., 2017) reports that CNN outperforms many domain generalization methods on the PACS dataset.
(2) AII (Xie et al., 2017), is a main baseline.
(3) AII+GP uses a variant of AII with an additional gradient penalty regularization used in GAN (Mescheder et al., 2018).
(4) RevGrad is a slightly modiﬁed version of AII, which uses the gradient reversal layer (Ganin et al., 2016) to train all the networks (encoder, classiﬁer, and discriminator) at the same time.
(5) NS is a non-saturating version of AII introduced in section 3 of this paper.
CrossGrad (Shankar et al., 2018) is regarded as a state-of-the-art method in domain generalization tasks.
Note that it does not intend to learn invariant representation, so we use CrossGrad only for comparing domain generalization performance.
(7) IIDM is our proposal.
We used the gradient penalty as well.
We also tested semantic alignment version and denoted it as IIDM+.
Optimization: For all datasets and methods, we used RMSprop for optimization.
For all datasets except PACS, we set the learning rate to 0 .
001 and the batch size to 128 .
For PACS, we set the learning rate to 5 e − 5 and the batch size to 64 .
The number of iterations was 10 k , 5 k , 20 k , 30 k , and 50 k for MNISTR, PACS, Opp, and USC, respectively.
For a fair comparison, hyperparameters were tuned on a validation set for each baseline.
For the adversarial-training-based method, we optimized weighting parameter λ from { 0 . 001 , 0 . 01 , 0 . 1 , 1 . 0 } , except for MNISTR, for which it was optimized from { 0 . 01 , 0 . 1 , 1 . 0 , 10 . 0 } .
The value of α for CrossGrad was selected from { 0 . 1 , 0 . 25 , 0 . 5 , 0 . 75 , 0 . 9 } .
Unless mentioned otherwise, we set the decay rate γ to 0 .
Evaluation:
In all the experiments, we selected the data of one or several domains for the test set and used the data of a disjoint domain as the training/validation data.
Accurately, we split the data of the disjoint domain into groupings of 80% and 20% .
We denote the test domain by a sufﬁx (e.g., MNISTR-M0 denotes that the model is trained with the data from M15, M30, M45, M60, and M75 and evaluated on M0).
We conducted 20 validations during training at equal intervals.
In each validation, we measured the label classiﬁcation accuracy (Y-acc) and the level of invariance.
We empirically measured the level of invariance by training a post-hoc classiﬁer D eval that tries to predict a over learned representations, following previous studies (Xie et al., 2017; Iwasawa et al., 2017).
Speciﬁcally, we trained the classiﬁer with 800 hidden units 1 k iterations (by RMSprop optimizer, with a learning rate of 0 .
001 and a batch size of 128 ) with the data that are used to train the encoder and evaluate attribute classiﬁcation accuracy on the validation dataset.
5. R ESULTS
User anonymization: Table 1 compares the user-anonymization performance.
The value represents the lowest user-classiﬁcation accuracy (the lower the better) with speciﬁc performance degradation compared to CNN on classiﬁcation accuracy.
For example, the columns with 0 .
01 represent the lowest user-classiﬁcation accuracy with less than 0 .
01 point performance degradation.
The best performance is underlined and highlighted in bold, and the second-best performance is only highlighted in bold.
IIDM+ represents the variants that use the semantic alignment extension introduced in section 4.
The results show the clear beneﬁt of our proposal to inducing user invariance.
Speciﬁcally,
IIDM performs best on seven out of ten conﬁgurations.
Note that the value with ’None’ represents the method always reduce the label classiﬁcation performance signiﬁcantly.
Domain generalization: Table 2 summarizes the classiﬁcation performance on two different datasets: MNISTR, and PACS.
The top row of each table represents the test domain.
We report
[Table]
[Figure]
the mean accuracy as well as the standard error of three different seeds (ﬁve seeds for MNISTR and three seeds for PACS).
The best performance is underlined and highlighted in bold, and the second-best performance is only highlighted in bold.
We can make the following observations.
IIDM and IIDM+ demonstrate the best or comparable performance on all conditions except sketch domain.
Although the semantic alignment extension does not help the performance on a simpler task (MNISTR), it improves the performance on PACS dataset, giving approximately 1 . 0 point performance gain.
(2) RevGrad and AII often fail to improve performance even when compared with a standard CNN.
The score of AII+GP suggests that gradient penalty helps to improve the performance, but the improvements are lower than our proposal.
The Wilcoxon rank-sum test shows that IIDM is statistically better than CNN, RevGrad, AII, AII+GP, and CrossGrad with p < 0 .
Figure 5 compares AII and IIDM on different (a) weighing parameter γ , (b) the number of the discriminator update κ , and (c) the network architecture of the discriminator.
The dataset used is
MNISTR with M0 as a test domain.
In each ﬁgure, color represents a different method (red: AII, blue: IIDM) and marker denotes different conﬁgurations.
The value represents the attribute classiﬁcation accuracy (the lower the better invariant) by a post-hoc classiﬁer q eval ( a | z ) .
For λ we used 1 . 0 by default.
For κ and the architecture, we used default setting described in Section 5.1.
The results show that our proposal is consistently to learn better invariant representations regardless of the choice of the hyperparameters.
These results suggest that our proposal is better than searching such hyperparameters.
Note that, λ = 10 . 0 for AII seems to attain better invariance, it was degenerated to the random representations and gives a random performance on the classiﬁcation of y .
C ONCLUSION
This paper presents a new method for invariance induction, called IIDM, by analyzing and extending current state-of-the-art adversarial invariance induction framework.
This paper ﬁrst examines the instability issue of AII both theoretically and empirically, indicating that AII has theoretical difﬁculty as it maximizes variational upper bound of the actual conditional entropy, and this fact leads AII to catastrophically fails even in simple cases.
We then argue that a simple modiﬁcation to AII can signiﬁcantly stabilize the adversarial induction framework and achieve better invariant representations.
The fundamental principle of our proposal is that a desirable invariance induction algorithm should also minimize the divergence between marginal distribution p ( z ) between different attributes, as it is a requirement of maximum conditional entropy (Corollary 1) and missing in AII optimization.
IIDM minimizes discriminator matching loss (Eq. 5), which is a proxy of the divergence between the marginals.
On toy dataset, we compare our proposal with the adversarial invariance induction framework, and show that our proposal signiﬁcantly stabilizes the optimization (Figure 3 and Figure 4).
Two real-world tasks (user-anonymization in Table 1 and domain generalization in Table 1) also supports that our proposal achieve better invariance induction.
A P ROOF OF THE P ROPOSITION
Proof.
Using the Lagrange multiplier method, the derivative of
[Equation]
is equal to zero for the maximum entropy H ( a | z ) .
Solving the simultaneous equations, we can say p ( a 1 | z ) =
p ( a 2 | z ) = · · · = p ( a K | z ) = 1 K for all z ∈ Z when the conditional entropy is maximized, and based on the deﬁnition, the conditional entropy becomes − log 1 K .
From Bayes’ law and the uniform assumption of p ( a ) , p ( z | a i ) = p ( z | a j ) holds ∀ a i (cid:54) = a j ∈ A and z ∈ Z .
B R ELATIONSHIPS BETWEEN DISCRIMINATOR MATCHING AND THE DIVERGENCE MINIMIZATION REQUIREMENTS B. P ROOF OF THE E Q .
Proof. [Equation] The inequality shows that the discriminator matching objective is a variational upper bound of the
KL-divergence between q iφ ( a ) and q jφ ( a ) . Therefore, minimizing the proposed objective surely minimize the KL-divergence between q iφ ( a ) and q jφ ( a ) . Note that, this inequality holds even when q ( a | z ) is not optimal. B. D ATA PROCESSING INEQUALITY OF THE F - DIVERGENCE
Theorem 1.
Consider a channel that produces y given x based on the p ( y | x ) .
For any f-divergence
[Equation] Proof. Using p ( y | x ) , we consider the following joint distributions.
[Equation]
The divergence between the tow joint distributions is
[Equation]
as p ( x, y ) and q ( x, y ) has common channel p ( y | x ) , and p ( y | x ) is canceled. For other direction, D f
[Equation]
p
[Equation]
x
[Equation]
The inequality uses Jensen’s inequality. Combining these two equations, [Equation]
[Equation]
As the KL divergence is also the family of the f-divergence, by replacing the p ( y | x ) to q φ ( a | z ) , p ( x ) to p iθ ( z ) , q ( x ) to p jθ ( z ) , p ( y ) to q iφ ( a ) , and p ( y ) to q jφ ( a ) ,
[Equation]
which is equivalent to eq.
It is noteworthily that if one can assume the common inverse mapping p ( x | y ) for both joint distributions p ( x, y ) and q ( x, y ) , then
[Equation]
The proof is straightforward results with the above proof. In our case, p ( y | x ) is parameterized by neural networks. In this case, if the q φ ( a | z ) is invertible, then the inverse mapping exists. Intuitively speaking, the data process q φ does not lose information, though the data is transformed to better explaining the attribute information (as q φ is trained to discriminate the attribute).