L EARNING C AUSAL S EMANTIC R EPRESENTATION FOR O UT - OF -D ISTRIBUTION P REDICTION
Anonymous authors
Paper under double-blind review
A BSTRACT
Conventional supervised learning methods, especially deep ones, are found to be sensitive to out-of-distribution (OOD) examples, largely because the learned representation mixes the semantic factor with the variation factor due to their domainspeciﬁc correlation, while only the semantic factor causes the output.
To address the problem, we propose a Causal Semantic Generative model (CSG) based on causality to model the two factors separately, and learn it on a single training domain for prediction without (OOD generalization) or with unsupervised data (domain adaptation) in a test domain.
We prove that CSG identiﬁes the semantic factor on the training domain, and the invariance principle of causality subsequently guarantees the boundedness of OOD generalization error and the success of adaptation.
We also design novel and delicate learning methods for both effective learning and easy prediction, following the ﬁrst principle of variational Bayes and the graphical structure of CSG.
Empirical study demonstrates the effect of our methods to improve test accuracy for OOD generalization and domain adaptation.
I NTRODUCTION
Deep learning has initiated a new era of artiﬁcial intelligence where the potential of machine learning models is greatly unleashed.
Despite the great success, these methods heavily rely on the independently-and-identically-distributed (IID) assumption.
This does not always perfectly hold in practice, and the prediction of output (label, response, outcome)
y may be saliently affected in out-of-distribution (OOD) cases, even from an essentially irrelevant change to the input (covariate) x , like a position shift or rotation of the object in an image, or a change of background, illumination or style (Shen et al., 2018;
He et al., 2019; Arjovsky et al., 2019).
These phenomena pose serious concerns on the robustness and trustworthiness of machine learning methods and severely impede them from risk-sensitive scenarios.
Looking into the problem, although deep learning models allow extracting abstract representation for prediction with their powerful approximation capacity, the representation may be overconﬁdent in the correlation between semantic factors s ( e.g. , shape of an object) and variation factors v ( e.g. , background, illumination, object position).
The correlation may be domain-speciﬁc and spurious, and may change drastically in a new environment.
So it has become a desire to learn representation that separates semantics s from variations v (Cai et al., 2019; Ilse et al., 2019).
Formally, the importance of this goal is that s represents the cause of y .
Causal relations better reﬂect the fundamental mechanisms of nature, bringing the merit to machine learning that they tend to be universal and invariant across domains (Sch¨olkopf et al., 2012; Peters et al., 2017; Sch¨olkopf, 2019), thus providing the most transferable and conﬁdent information to unseen domains.
Causality has also been shown to lead to proper domain adaptation (Sch¨olkopf et al., 2012; Zhang et al., 2013), lower adaptation cost and lighter catastrophic forgetting (Peters et al., 2016; Bengio et al., 2019; Ke et al., 2019).
In this work, we propose a Causal Semantic Generative model (CSG) for proper and robust OOD prediction, including OOD generalization and domain adaptation.
Both tasks have supervised data from a single training domain, but domain adaptation has unsupervised test-domain data during learning, while OOD generalization has no test-domain data, including cases where queries come sequentially or adaptation is unaffordable.
(1) We build the model by cautiously following the principle of causality, where we explicitly separate the latent variables into a (group of) semantic factor s and a (group of) variation factor v .
We prove that under appropriate conditions CSG identiﬁes the semantic factor by ﬁtting training data, even in presence of an s - v correlation.
By leveraging the causal invariance, we prove that a well-learned CSG is guaranteed to have a bounded OOD generalization error.
The bound shows how causal mechanisms affect the error.
(3) We develop a domain adaptation method using CSG and causal invariance, which suggests to ﬁx the causal generative mechanisms and adapt the prior to the new domain.
We prove the identiﬁcation of the new prior and the beneﬁt of adaptation.
(4) To learn and adapt the model from data, we design novel and delicate reformulations of the Evidence Lower BOund (ELBO) objective following the graphical structure of CSG, so that the inference models required therein can also serve for prediction, and modeling and optimizing inference models in both domains can be avoided.
To our best knowledge, our work is the ﬁrst to identify semantic factor and leverage latent causal invariance for OOD prediction with guarantees.
Empirical improvement in OOD performance and adaptation is demonstrated by experiments on multiple tasks including shifted MNIST and ImageCLEF-DA task.
R ELATED W ORK
There have been works that aim to leverage the merit of causality for OOD prediction.
For OOD generalization, some works ameliorate discriminative models towards a causal behavior.
Bahadori et al.
(2017) introduce a regularizer that reweights input dimensions based on their approximated causal effects to the output, and Shen et al.
(2018) reweight training samples by amortizing causal effects among input dimensions.
They are extended to nonlinear cases (Bahadori et al., 2017;
He et al., 2019) via linear-separable representations.
Heinze-Deml & Meinshausen (2019) enforce inference invariance by minimizing prediction variance within each label-identity group.
These methods introduce no additional modeling effort, but may also be limited to capture invariant causal mechanisms (they are non-generative) and may only behave quantitatively causal in the training domain.
For domain adaptation/generalization, methods are developed under various causal assumptions (Sch ¨ olkopf et al., 2012; Zhang et al., 2013) or using learned causal relations (Rojas-Carulla et al., 2018; Magliacane et al., 2018).
Zhang et al.
; Gong et al.
(2016; 2018) also consider certain ways of mechanism shift.
The considered causality is among directly observed variables, which may not be suitable for general data like image pixels where causality rather lies between data and conceptual latent factors (Lopez-Paz et al., 2017;
Besserve et al., 2018; Kilbertus et al., 2018).
To consider latent factors, there are domain adaptation (Pan et al., 2010; Baktashmotlagh et al., 2013;
Ganin et al., 2016; Long et al., 2015; 2018) and generalization methods (Muandet et al., 2013;
Shankar et al., 2018) that learn a representation with domain-invariant marginal distribution, and have achieved remarkable results.
Nevertheless, Johansson et al.
; Zhao et al.
(2019) point out that this invariance is neither sufﬁcient nor necessary to identify the true semantics and lower the adaptation error (Supplement D).
Moreover, these methods and invariance risk minimization (Arjovsky et al., 2019) also assume the invariance in the inference direction ( i.e. , data → representation), which may not be as general as causal invariance in the generative direction (Section 3.2).
There are also generative methods for domain adaptation/generalization that model latent factors.
Cai et al.
; Ilse et al.
(2019) introduce a semantic factor and a domain-feature factor.
They assume the two factors are independent in both the generative and inference models, which may not meet reality closely.
They also do not adapt the prior for domain shift thus resort to inference invariance.
Zhang et al.
(2020) consider a partially observed manipulation variable, while assume its independence from the output in both the joint and posterior, and the adaptation is inconsistent with causal invariance.
Atzmon et al.
(2020) consider similar latent factors, but use the same (uniform) prior in all domains.
These methods also do not show guarantees to identify their latent factors.
Teshima et al.
(2020) leverage causal invariance and adapt the prior, while also assume latent independence and do not separate the semantic factor.
They require some supervised test-domain data, and their deterministic and invertible mechanism also indicates inference invariance.
In addition, most domain generalization methods require multiple training domains, with exceptions ( e.g. , Qiao et al., 2020) that still seek to augment domains.
In contrast, CSG leverages causal invariance, and has guarantee to identify the semantic factor from a single training domain, even with a correlation to the variation factor.
Generative supervised learning is not new (Mcauliffe & Blei, 2008; Kingma et al., 2014), but most works do not consider the encoded causality.
Other works consider solving causality tasks, notably causal/treatment effect estimation (Louizos et al., 2017; Yao et al., 2018; Wang & Blei, 2019).
The task does not focus on OOD prediction, and requires labels for both treated and controlled groups.
Disentangling latent representations is also of interest in unsupervised learning.
Despite some empirical success (Chen et al., 2016;
Higgins et al., 2017; Chen et al., 2018), Locatello et al.
(2019) conclude that it is impossible to guarantee the disentanglement in unsupervised settings.
Khemakhem et al.
(2019; 2020) show an encouraging result that disentangled representation can be identiﬁed up to a permutation with a cause of the latent variable observed.
But the methods cannot separate the semantic factor from variation for supervised learning, and require observing sufﬁciently many different values of the cause variable, making it hard to leverage labels.
Causality with latent variable has been considered in a rich literature (Verma & Pearl, 1991; Spirtes et al., 2000; Richardson et al., 2002; Hoyer et al., 2008; Shpitser et al., 2014), while most works focus on the consequence on observation-level causality.
Others consider identifying the latent variable.
Janzing et al.
; Lee et al.
(2019) show the identiﬁability under additive noise or similar assumptions.
For discrete data, a “simple” latent variable can be identiﬁed under various speciﬁcations (Janzing et al., 2011; Sgouritsa et al., 2013; Kocaoglu et al., 2018).
Romeijn & Williamson (2018) leverage interventional datasets.
Over these works, we step further to separate and identify the latent variable as semantic and variation factors, and show the beneﬁt for OOD prediction.
T HE C AUSAL S EMANTIC G ENERATIVE M ODEL
To develop the model seriously and soberly based on causality, we require the formal deﬁnition of causality: two variables have a causal relation, denoted as “ cause → effect ”, if externally intervening the cause (by changing variables out of the considered system) may change the effect , but not vice versa (Pearl, 2009; Peters et al., 2017).
We then follow the logic below to build our model.
(1) It may be a general case that neither y → x ( e.g. , adding noise to the labels in a dataset does not change the images) nor x → y holds ( e.g. , intervening an image by e.g. breaking a camera sensor unit when taking the image, does not change how the photographer labels it), as also argued by
Peters et al.
(2017, Section 1.4); Kilbertus et al.
So we employ a generative model ( i.e. , not only modeling p ( y | x ) ), and introduce a latent variable z to capture factors with causal relations.
The latent variable z as underlying generating factors ( e.g. , object features like shape and texture, background and illumination in imaging) is plausible to cause both x ( e.g. , the change of object shape or background makes a different image, but breaking a camera sensor unit does not change the object shape or background) and
y ( e.g. , the photographer would give a different label if the object shape, texture, etc. had been replaced by those of a different object, but noise-corrupting the label does not change the object features).
So we orient the edges in the generative direction z
→ ( x, y ) , as also adopted by Mcauliffe & Blei (2008); Peters et al.
; Teshima et al.
This is in contrast to Cai et al.
; Ilse et al.
; Castro et al.
(2020) who treat y as the cause of a semantic factor, which, when y is also a noisy observation, makes unreasonable implications ( e.g. , adding noise to the labels in a dataset automatically changes object features and consequently the images, and changing the object features does not change the label).
This difference is also discussed by Peters et al.
(2017, Section 1.4); Kilbertus et al.
(3) We attribute all x - y relation to the existence of some latent factors (“purely common cause”, Lee et al., 2019;
Janzing et al., 2009), and exclude x - y edges.
This can be achieved as long as z holds sufﬁcient information of data ( e.g. , with shape, background etc.
ﬁxed, breaking a sensor unit does not change the label, and noise-corrupting the label does not change the image).
Promoting this restriction reduces arbitrariness in explaining x - y relation and beneﬁts the identiﬁcation of z .
This is in contrast to Kingma et al.
; Zhang et al.
; Castro et al.
(2020) who treat y as a cause of x since no latent variable is introduced between.
(4) Not all latent factors are the causes of y ( e.g. , changing the shape may alter the label, while changing the background does not).
We thus split the latent variable as z =
( s, v ) and remove the edge v → y , where s represents the semantic factor of x that causes y , and v describes the variation or diversity in generating x .
This formalizes the intuition on the concepts in Introduction.
The variation v often has a relation to the semantics s , which is often a spurious correlation ( e.g. , desks prefer a workspace background, but they can also appear in bedrooms and beds can also appear in workspace).
So we keep the undirected s - v edge.
Although v is not a cause of y , modeling it explicitly is worth the effort since otherwise it would still be implicitly incorporated in s anyway through the s - v correlation.
We summarize these conclusions in the following deﬁnition.
Deﬁnition 3.1 (CSG) .
A Causal Semantic Generative Model (CSG) p
= ( p ( s, v ) , p ( x | s, v ) , p ( y | s )) is a generative model on data variables x ∈ X ⊂ R d X and y ∈ Y with semantic s ∈ S ⊂ R d S and variation v ∈ V ⊂ R d V latent variables, following the graphical structure shown in Fig.
3. T HE C AUSAL I NVARIANCE P RINCIPLE
The domain-invariance of causal relations translates to the following principle for CSG:
Principle 3.2 (causal invariance) .
The causal generative mechanisms p ( x | s, v ) and p ( y | s ) in CSG are invariant across domains, and the change of prior p ( s, v ) is the only source of domain shift.
It is supported by the invariance of basic laws of nature (Sch ¨ olkopf et al., 2012; Peters et al., 2017;
Besserve et al., 2018; B ¨ uhlmann, 2018; Sch ¨ olkopf, 2019).
Other works instead introduce domain index (Cai et al., 2019;
Ilse et al., 2019; 2020; Castro et al., 2020) or manipulation variables (Zhang et al., 2020; Khemakhem et al., 2019; 2020) to model distribution change explicitly.
They require multiple training domains or additional observations, and such changes can also be explained under causal invariance as long as the latent variable includes all shifted factors ( e.g. , domain change of images can be attributed to a different preference of shape, style, texture, background, etc. and their correlations, while the processes generating image and label from them remain the same).
3. C OMPARISON WITH I NFERENCE I NVARIANCE
Domain-invariant-representation-based adaptation and generalization methods, and invariant risk minimization (Arjovsky et al., 2019) for domain generalization, use a shared feature extractor across domains.
This effectively assumes the invariance of the process in the other direction, i.e. , inferring the latent representation from data.
We note that in its supportive examples ( e.g. , inferring the object position from an image, or extracting the fundamental frequency from a vocal audio), generating mechanisms are nearly deterministic and invertible, so that the posterior is almost determined by the inverse function, and causal invariance implies inference invariance.
For noisy or degenerate mechanisms (Fig. 2), ambiguity occurs during inference since there may be multiple values of a latent feature that generate the same observation.
The inferred feature would notably rely on the prior through the Bayes rule.
Since the prior changes across domains, the inference rule then changes by nature, which challenges the existence of a domain-shared feature extractor.
In this case, causal invariance is more reliable than inference invariance.
To leverage causal invariance, we adjust the prior conservatively for OOD generalization (CSG-ind) and data-driven for domain adaptation (CSG-DA), so together with the invariant generative mechanisms, it gives a different and more reliable inference rule than that following inference invariance.
M ETHOD
We develop learning, adaptation and prediction methods for OOD generalization and domain adaptation using CSG following the causal invariance Principle 3.2, and devise practical objectives using variational Bayes.
Supplement E.1 details all the derivations.
4. M ETHOD FOR OOD G ENERALIZATION
For OOD generalization, a CSG p = ( p ( s, v ) , p ( x | s, v ) , p ( y | s )) needs to ﬁrst learn from the supervised data from an underlying data distribution p ∗ ( x, y ) on the training domain.
Maximizing likelihood E p ∗ ( x,y ) [log p ( x, y )] is intractable since p ( x, y ) given by the CSG p is hard to estimate effectively.
We thus adopt the Evidence Lower BOund (ELBO)
L q,p ( x, y ) :
= E q ( s,v | x,y ) [log p ( s,v,x,y ) q
( s,v | x,y ) ]
(Jordan et al., 1999; Wainwright et al., 2008) as a tractable surrogate, which requires an auxiliary inference model q ( s, v | x, y ) to estimate the expectation effectively.
Maximizing L q,p w.r.t q drives q towards the posterior p ( s, v | x, y ) and meanwhile makes L q,p a tighter lower bound of log p ( x, y ) .
The expected ELBO E p ∗ ( x,y )
[ L q,p ( x, y )] then drives p ( x, y ) towards p ∗ ( x, y ) .
However, the subtlety with supervised learning is that after ﬁtting data, evaluating p ( y | x ) for prediction is still hard.
We thus propose to employ a model for q ( s, v, y | x ) instead.
The required inference model can be then expressed as q ( s, v | x, y )
=
q ( s, v, y | x ) /q
( y | x ) where q ( y | x ) = (cid:82) q
( s, v, y | x ) d s d v .
It reformulates the expected ELBO as:
[Equation]
The ﬁrst term is the common cross entropy loss (negative) driving q ( y | x ) towards p ∗ ( y | x ) .
Once this is achieved, the second term becomes the expected ELBO E p ∗ ( x ) [ L q ( s,v,y | x ) ,p ( x )] that drives q ( s, v, y | x ) towards p ( s, v, y | x ) (and p ( x ) towards p ∗ ( x ) ).
Since the target p ( s, v, y | x ) admits the factorization p ( s, v | x ) p ( y | s ) (since ( v, x ) ⊥⊥ y | s ) where p ( y | s ) is already given by the CSG, we can further ease the modeling of q ( s, v, y | x ) as q ( s, v | x ) p ( y | s ) .
The ELBO is then reformulated as:
[Equation]
where q ( y | x )
=
E q ( s,v | x ) [ p ( y | s )] .
The CSG p and q ( s, v | x ) are to be optimized.
The expectations can be estimated by Monte Carlo, and their gradients can be estimated using the reparameterization trick (Kingma & Welling, 2014).
When well optimized, q ( s, v | x ) well approximates p ( s, v | x ) , so q ( y | x ) then well approximates p ( y | x ) =
E p ( s,v | x ) [ p ( y | s )] for prediction.
CSG-ind To actively mitigate the spurious s - v correlation from the training domain, we also consider a CSG with an ind ependent prior p ⊥⊥ ( s, v ) :
= p ( s ) p ( v ) for prediction in the unknown test domain, where p ( s ) and p ( v ) are the marginals of p ( s, v ) .
The independent prior p ⊥⊥ ( s, v ) encourages the model to stay neutral on the s - v correlation.
It has a larger entropy than p ( s, v ) (Cover &
Thomas, 2006, Theorem 2.6.6), so it reduces the information of the training-domain-speciﬁc prior.
The model then relies more on the invariant generative mechanisms, thus better leverages causal invariance and gives more reliable prediction than that following inference invariance.
For the method, note that the prediction is given by p ⊥⊥ ( y | x ) =
E p ⊥⊥ ( s,v | x ) [ p ( y | s )] , so we use an inference model for q ⊥⊥ ( s, v | x ) that approximates p ⊥⊥ ( s, v | x ) .
However, learning on the training domain still requires the original inference model q ( s, v | x ) .
To save the cost of building and learning two inference models, we propose to use q ⊥⊥ ( s, v | x ) to represent q ( s, v | x ) .
Noting that their targets are related by p ( s, v | x )
= p ( s,v ) p ⊥⊥ ( s,v ) p ⊥⊥ ( x ) p ( x ) p ⊥⊥ ( s, v | x ) , we formulate q ( s, v | x ) =
p ( s,v ) p ⊥⊥ ( s,v ) p ⊥⊥ ( x ) p ( x ) q ⊥⊥ ( s, v | x ) accordingly, so that this q ( s, v | x ) achieves its target once q ⊥⊥ ( s, v | x ) does.
The ELBO then becomes:
[Equation]
3) where π ( y | x ) :
=
E q ⊥⊥ ( s,v | x ) (cid:2) p ( s,v ) p ⊥⊥ ( s,v ) p ( y | s ) (cid:3) .
The CSG p and q ( s, v | x ) are to be optimized (note that p ⊥⊥ ( s, v ) is determined by p ( s, v ) in the CSG p ).
Prediction is given by p ⊥⊥ ( y | x )
≈ E q ⊥⊥ ( s,v | x ) [ p ( y | s )] .
4. M ETHOD FOR D OMAIN A DAPTATION
When unsupervised data is available from an underlying data distribution ˜ p ∗ ( x ) on the test domain, we can leverage it for adaptation.
According to the causal invariance Principle 3.2, we only need to adapt for the test-domain prior ˜ p ( s, v ) and the corresponding inference model ˜ q ( s, v | x ) , while the causal mechanisms p ( x | s, v ) and p ( y | s ) are not optimized.
Adaptation is done by ﬁtting the test data via maximizing E ˜ p ∗ ( x ) [ L ˜ q,
˜ p ( x )] , where the ELBO is in the standard form:
[Equation]
Prediction is given by ˜ p
( y | x ) ≈ E ˜ q
( s,v | x ) [ p ( y | s )] .
Similar to the case of CSG-ind, we need ˜ q
( s, v | x ) for prediction, but q ( s, v
| x ) is still required for learning on the training domain.
When data from both domains are available during learning, we can save the effort of modeling and learning q ( s, v | x ) using a similar technique.
We formulate it using ˜ q ( s, v | x ) as q ( s, v | x ) =
˜ p ( x ) p ( x ) p ( s,v ) ˜ p ( s,v ) ˜
q ( s, v | x ) following the same relation between their targets, and the ELBO on the training domain becomes:
[Equation]
where π ( y | x ) :
= E ˜ q ( s,v | x ) (cid:2) p ( s,v ) ˜ p ( s,v ) p ( y | s ) (cid:3) .
The CSG p and ˜ q ( s, v | x ) are to be optimized (not for ˜ p
( s, v ) ).
The resulting method, termed CSG-DA, solves both optimizations (4, 5) simultaneously.
For implementing the three methods, note that only one inference model is required in each case.
Supplement E.2 shows its implementation from a general discriminative model ( e.g. , how to select its hidden nodes as s and v ).
In practice x often has a much larger dimension than y , making the supervised part of the training-domain ELBO ( i.e. , the ﬁrst term in its formulation Eq.
(1)) scales smaller than the unsupervised part.
So we include an additional cross entropy loss in the objectives.
T HEORY
We now establish guarantee for the methods on identifying the semantic factor and the subsequent merits for OOD generalization and domain adaptation.
We only consider the inﬁnite-data regime to isolate another source of error from ﬁnite data.
Supplement A shows all the proofs.
Identiﬁability is hard to achieve for latent variable models (Koopmans & Reiersol, 1950; Murphy, 2012;
Yacoby et al., 2019; Locatello et al., 2019), since it is a task beyond modeling observational relations (Janzing et al., 2009; Peters et al., 2017).
Assumptions are required to draw deﬁnite conclusions.
Assumption 5.1 (additive noise) .
There exist nonlinear functions f and g with bounded derivatives up to third-order, and independent random variables µ and ν , such that p ( x | s, v ) =
p µ ( x − f
( s, v )) , and p ( y | s ) =
p ν ( y − g ( s )) for continuous y or p ( y | s ) =
Cat( y | g ( s )) for categorical y .
This structure disables describing a bivariate joint distribution in both generating directions (Zhang & Hyv¨arinen (2009, Theorem 8), Peters et al.
(2014, Proposition 23)), and is widely adopted in directed causal discovery (Janzing et al., 2009; B ¨ uhlmann et al., 2014).
CSG needs this since it should make the causal direction exclusive.
It is also easy to implement with deep models (Kingma & Welling, 2014), so does not essentially restrict model capacity.
Assumption 5.2 (bijectivity) .
Function f is bijective and g is injective.
It is a common assumption for identiﬁability (Janzing et al., 2009; Shalit et al., 2017; Khemakhem et al., 2019; Lee et al., 2019).
Under Assumption 5.1, it is a sufﬁcient condition (Peters et al., 2014,
Proposition 17; Peters et al., 2017, Proposition 7.4) of causal minimality (Peters et al., 2014, p.2012;
Peters et al., 2017, Deﬁnition 6.33), a fundamental requirement for identiﬁability (Peters et al., 2014,
Proposition 7; Peters et al., 2017, p.109).
Particularly, s and v are otherwise allowed to have dummy dimensions that f and g simply ignore, raising another ambiguity against identiﬁability.
On the other hand, according to the commonly acknowledged manifold hypothesis (Weinberger & Saul, 2006; Fefferman et al., 2016) that data tends to lie on a lower-dimensional manifold embedded in the data space, we can take X as the manifold and such a bijection exists as a coordinate map, which is an injection to the original data space (thus allowing d S + d V < d X ).
5. I DENTIFIABILITY T HEORY
We ﬁrst formalize the goal of identifying the semantic factor.
Deﬁnition 5.3 (semantic-equivalence) .
We say two CSGs p and p (cid:48) are semantic-equivalent , if there exists a homeomorphism 2 Φ on S × V , such that (i) its output dimensions in S is constant of v :
It is an equivalent relation if V is connected and is either open or closed in R d V (Supplement A.1).
Here, Φ # [ p s,v ] denotes the pushed-forward distribution 3 by Φ , i.e. the distribution of the transformed random variable Φ( s, v ) when ( s, v ) ∼ p s,v .
As a reparameterization, Φ allows the two models to have different latent-variable parameterizations while inducing the same distribution on the observed data variables ( x, y ) (Supplement Lemma A.2).
At the heart of the deﬁnition, the vconstancy of Φ S implies that Φ is semantic-preserving : one model does not mix the other’s v into its s , so that the s variables of both models hold equivalent information.
We say that a learned CSG p identiﬁes the semantic factor if it is semantic-equivalent to the groundtruth CSG p ∗ .
This identiﬁcation cannot be characterized by the statistical independence between s and v (as in Cai et al.
; Ilse et al.
; Zhang et al.
(2020)), which is not sufﬁcient (Locatello et al., 2019) nor necessary (due to the existence of spurious correlation).
Another related concept is disentanglement .
It requires that a semantic transformation on x changes the learned s only (Higgins et al., 2018; Besserve et al., 2020), while the identiﬁcation here does not require the learned v to be constant of the ground-truth s .
To identify the semantic factor, the ground-truth model could at most provide its information via the data distribution p ∗ ( x, y ) .
Although semantic-equivalent CSGs induce the same distribution on ( x, y ) , the inverse is nontrivial.
The following theorem shows that the semantic-identiﬁability can be achieved under appropriate conditions.
Theorem 5.4 (semantic-identiﬁability) .
With Assumptions 5.1 and 5.2, a well-learned CSG p with p ( x, y )
=
p ∗ ( x, y ) is semantic-equivalent to the ground-truth CSG p ∗ , if log p ( s, v ) and log p ∗ ( s, v ) have bounded derivatives up to the second-order, and that 4 (i) 1 σ 2 µ → ∞ where σ 2 µ :=
E [ µ (cid:62) µ ] , or (ii) p µ has an a.e. non-zero characteristic function ( e.g. , a Gaussian distribution).
Remarks.
The requirement on p ( s, v ) and p ∗ ( s, v ) excludes extreme training data that show a deterministic s - v relation, which makes the ( s, v ) density functions unbounded and discontinuous.
In that case ( e.g. , all desks appear in workspace and all beds in bedrooms), one cannot tell whether the label y is caused by s ( e.g. , the shape) or by v ( e.g. , the background).
In condition (i) , 1 σ 2 µ measures the intensity of the causal mechanism p ( x | s, v ) .
A strong p ( x | s, v ) helps disambiguating values of ( s, v ) in generating a given x .
The condition makes p ( x | s, v ) so strong that it is almost deterministic and invertible, so inference invariance also holds (Section 3.2).
Supplement A.2 provides a quantitative reference of large intensity for a practical consideration, and
Supplement B gives a non-asymptotic extension showing how the intensity trades-off the tolerance of equalities in Deﬁnition 5.3.
Condition (ii) covers more than inference invariance.
It roughly implies that different values of ( s, v ) a.s. produce different distributions p ( x | s, v ) on X , so their roles in generating x become clear which helps identiﬁcation.
The theorem does not contradict the impossibility result by Locatello et al.
(2019), which considers disentangling each latent dimension with an unconstrained ( s, v ) → ( x, y ) , while we identify s as a whole with the edge v → y removed which breaks the s - v symmetry.
5. OOD G ENERALIZATION T HEORY
The causal invariance Principle 3.2 forms the ground-truth CSG on the test domain as ˜ p ∗ =
(˜ p ∗ ( s, v ) , p ∗ ( x | s, v ) , p ∗ ( y | s )) with the new ground-truth prior ˜ p ∗ ( s, v ) , which gives the optimal predictor
˜ E ∗
[ y | x ] 5 on the test domain.
The principle also leads to the invariance of identiﬁed causal mechanisms, which shows that the OOD generalization error of a CSG is bounded:
Theorem 5.5 (OOD generalization error) .
With Assumptions 5.1 and 5.2, for a semanticallyidentiﬁed CSG p on the training domain with reparameterization Φ , we have up to O ( σ 2 µ ) that for any x ∈ supp( p x ) ∩ supp(˜ p ∗ x ) ,
[Equation]
where supp denotes the support of a distribution, J f − 1 is the Jacobian matrix of f − 1 , and ˜ p s,v :=
Φ # [˜ p ∗ s,v ] is the test-domain prior under the parameterization of the identiﬁed CSG p .
The result shows that when the causal mechanism p ( x | s, v ) is strong, especially in the extreme case σ µ = 0 where inference invariance also holds, it dominates prediction over the prior and the generalization error diminishes.
In more general cases where only causal invariance holds, the prior change deviates the prediction rule.
The prior-change term (cid:107)∇ log( p ( s, v ) /
˜ p ( s, v ))
(cid:107) 2 measures the hardness or severity of OOD.
It diminishes in IID cases, and makes the bound lose its effect when the two priors do not share their support.
Using a CSG to ﬁt training data enforces causal invariance and other assumptions, so its E [ y | x ] behaves more faithfully in low p ∗ ( x ) area and the boundedness becomes more plausible in practice.
CSG-ind further actively uses an independent prior whose larger support covers more ˜ p s,v candidates.
5. D OMAIN A DAPTATION T HEORY
In cases of weak causal mechanism or violent prior change, the new ground-truth prior p ∗ s,v is important for prediction.
The domain adaptation method learns a new prior ˜ p s,v by ﬁtting unsupervised test-domain data, with causal mechanisms shared.
Once the mechanisms are identiﬁed, p ∗ s,v can also be identiﬁed under the learned parameterization, and prediction can be made precise.
Theorem 5.6 (domain adaptation error) .
Under the conditions of Theorem 5.4, for a semanticallyidentiﬁed CSG p on the training domain with reparameterization Φ , if its new prior ˜ p s,v for the test domain is well-learned with ˜ p ( x ) = ˜
p ∗ ( x ) , then ˜ p s,v = Φ # [˜ p ∗ s,v ] , and ˜ E
[ y | x ] = ˜
E ∗ [ y | x ] for any x ∈ supp(˜ p ∗ x ) .
Different from existing domain adaptation bounds (Supplement D), Theorems 5.5 and 5.6 allow different inference models in the two domains, thus go beyond inference invariance.
E XPERIMENTS
For baselines of OOD generalization, apart from the conventional supervised learning optimizing cross entropy (CE), we also consider a causal discriminative method CNBB
(He et al., 2019), and a generative method supervised VAE (sVAE) which is a counterpart of CSG that does not separate its latent variable into s and v .
For domain adaptation, we consider well-acknowledged DANN (Ganin et al., 2016), DAN (Long et al., 2015) and CDAN (Long et al., 2018) methods implemented in the dalib package (Jiang et al., 2020), and also sVAE using a similar method as CSG-DA.
All methods share the same optimization setup.
We align the scale of the CE term in the objectives of all methods, and tune their hyperparameters to lie on the margin that makes the ﬁnal accuracy near 1 on a validation set from the training domain.
See Supplement F for details.
6. S HIFTED MNIST
We consider an OOD prediction task on MNIST to classify digits “0” and “1”.
In the training data, “0”s are horizontally shifted at random by δ pixels with δ ∼ N ( − 5 , 1 2 ) , and “1”s by δ ∼ N (5 , 1 2 ) pixels.
We consider two test domains where the digits are not moved, or are shifted δ ∼ N (0 , 2 2 ) pixels.
Both domains have balanced classes.
We implement all methods using multilayer perceptron which is not naturally shift invariant.
We use a larger architecture for discriminative and domain adaptation methods to compensate the additional generative components of generative methods.
The OOD performance is shown in Table 1.
For OOD generalization, CSG gives more genuine predictions in unseen domains, thanks to the identiﬁcation of the semantic factor.
CSG-ind performs even better, demonstrating the merit of approaching a CSG with an independent prior.
Other methods are more signiﬁcantly misled by the position factor from the spurious correlation.
CNBB ameliorates the position bias, but not as thoroughly without explicit structures for causal mechanisms.
CSG
[Table] [Table]
also outperforms sVAE, showing the beneﬁt of separating semantics and variation and modeling the variation explicitly, so the model could consciously drive semantic representation into s .
For domain adaptation, existing methods differ a lot
[Table]
and are hard to perform well on both test domains.
When fail to identify, adaptation sometimes even worsens the result, as the misleading representation based on position gets strengthened on the unsupervised test data.
CSG is beneﬁted from adaptation by leveraging test data in a proper way that identiﬁes the semantics.
6. I MAGE CLEF-DA
ImageCLEF-DA (ima, 2014) is a standard benchmark dataset for the ImageCLEF 2014 domain adaptation challenge.
We select a pair of adaptation tasks between two of its domains: C altechand P ascal VOC 2012.
Each domain has 12 classes and 600 images following a different distribution from each other.
We adopt the same setup as in Long et al.
(2018), including the ResNet50 structure
(He et al., 2016) pretrained on ImageNet as the backbone of the discriminative/inference model.
For generative methods, we leverage the DCGAN generator (Radford et al., 2015) pretrained on Cifar10.
Table 2 shows the results.
We see that CSG(-ind) achieves the best OOD generalization result, and performs comparable with modern domain adaptation methods.
On this task, the underlying causal mechanism may be very noisy ( e.g. , photos taken from inside and outside both count for the aircraft class), making identiﬁcation hard.
So CSG-DA does not make a salient improvement.
C ONCLUSION AND D ISCUSSION
We tackle OOD generalization and domain adaptation tasks by proposing a Causal Semantic Generative model (CSG), which builds upon a causal reasoning, and models semantic and variation factors separately while allowing their correlation.
Using the invariance principle of causality, we develop effective and delicate methods for learning, adaptation and prediction, and prove the identiﬁcation of the semantic factor, the boundedness of OOD generalization error, and the success of adaptation under appropriate conditions.
Experiments show the improved performance in both tasks.
The consideration of separating semantics from variation extends to broader examples regarding robustness.
Convolutional neural networks are found to change its prediction under a different texture but the same shape (Geirhos et al., 2019;
Brendel & Bethge, 2019).
Adversarial vulnerability (Szegedy et al., 2014; Goodfellow et al., 2015; Kurakin et al., 2016) extends variation factors to human-imperceptible features, i.e. the adversarial noise, which is shown to have a strong spurious correlation with semantics (Ilyas et al., 2019).
The separation also matters for fairness when a sensitive variation factor may change prediction due to a spurious correlation.
Our methods are potentially beneﬁcial in these examples.
S UPPLEMENTARY M ATERIALS A P ROOFS
We ﬁrst introduce some handy concepts and results to make the proof succinct.
We begin with extended discussions on CSG.
Deﬁnition A.1.
A homeomorphism Φ on S × V is called a reparameterization from CSG p to
CSG p (cid:48) , if Φ # [ p s,v ] = p (cid:48) s,v , and p ( x | s, v ) =
p (cid:48)
( x | Φ( s, v )) and p ( y | s ) =
p (cid:48)
( y | Φ S ( s, v )) for any ( s, v ) ∈ S × V .
A reparameterization Φ is called to be semantic-preserving , if its output dimensions in S is constant of v : Φ S ( s, v ) =
Φ S ( s ) for any v ∈ V .
Note that a reparameterization unnecessarily has its output dimensions in S , i.e. Φ S ( s, v ) , constant of v .
The condition that p ( y | s ) = p (cid:48)
( y | Φ S ( s, v )) for any v ∈ V does not indicate that Φ S ( s, v ) is constant of v , since p (cid:48)
( y | s (cid:48) ) may ignore the change of s (cid:48) =
Φ S ( s, v ) from the change of v .
The following lemma shows the meaning of a reparameterization: it allows a CSG to vary while inducing the same distribution on the observed data variables ( x, y ) ( i.e. , holding the same effect on describing data).
Lemma A.2.
If there exists a reparameterization Φ from CSG p to CSG p (cid:48) , then p ( x, y ) = p (cid:48)
( x, y ) .
Proof.
By the deﬁnition of a reparameterization, we have:
[Equation]
where we used variable substitution ( s (cid:48) , v (cid:48) )
:=
Φ( s, v ) in the second-last equality.
Note that by the deﬁnition of pushed-forward distribution and the bijectivity of Φ , Φ # [ p s,v ] = p (cid:48)
s,v implies p s,v =
Φ − 1# [ p (cid:48) s,v ] , and (cid:82) f
( s (cid:48) , v (cid:48) )
p (cid:48) s,v ( s (cid:48) , v (cid:48) )
d s (cid:48)
d v (cid:48)
= (cid:82) f
(Φ( s, v ))
Φ − 1# [ p (cid:48)
s,v ]( s, v ) d
s d v (can also be veriﬁed deductively using the rule of change of variables,
i.e. Lemma A.4 in the following).
The deﬁnition of semantic-equivalence (Deﬁnition 5.3) can be rephrased by the existence of a semantic-preserving reparameterization.
With appropriate model assumptions, we can show that any reparameterization between two CSGs is semantic-preserving, so that semantic-preserving CSGs cannot be converted to each other by a reparameterization that mixes s with v .
Lemma A.3.
For two CSGs p and p (cid:48) , if p (cid:48) ( y | s ) has a statistics M (cid:48)
( s ) that is an injective function of s , then any reparameterization Φ from p to p (cid:48) , if exists, has its Φ S constant of v .
Proof.
Let Φ =
(Φ S , Φ V ) be any reparameterization from p to p (cid:48) .
Then the condition that p ( y | s ) = p (cid:48)
( y | Φ S ( s, v )) for any v ∈ V indicates that M ( s ) =
M (cid:48) (Φ S ( s, v )) .
If there exist s ∈ S and v (1) (cid:54) = v (2) ∈
V such that Φ S ( s, v (1) ) (cid:54) =
Φ S ( s, v (2) ) , then M (cid:48) (Φ S ( s, v (1) )) (cid:54) =
M (cid:48) (Φ S ( s, v (2) )) since M (cid:48) is injective.
This violates M ( s ) =
M (cid:48) (Φ S ( s, v )) which requires both M (cid:48) (Φ S ( s, v (1) )) and M (cid:48) (Φ S ( s, v (2) )) to be equal to M ( s ) .
So Φ S ( s, v ) must be constant of v .
We then introduce two mathematical facts.
Lemma A.4 (rule of change of variables) .
Let z be a random variable on a Euclidean space R
d
Z with density function p z ( z ) , and let Φ be a homeomorphism on R d Z whose inverse Φ − 1 is differentiable.
Then the distribution of the transformed random variable z (cid:48)
=
Φ( z ) has a density function Φ # [ p z ]( z (cid:48) )
=
p z (Φ − 1 ( z (cid:48) ))
| J Φ − 1 ( z (cid:48) ) | , where | J Φ − 1 ( z (cid:48) ) | denotes the absolute value of the determinant of the Jacobian matrix (
[Equation]
Proof.
See e.g. , Billingsley (2012, Theorem 17.2).
Note that a homeomorphism is (Borel) measurable since it is continuous (Billingsley, 2012, Theorem 13.2), so the deﬁnition of Φ # [ p z ] is valid.
Lemma A.5.
Let µ be a random variable whose characteristic function is a.e. non-zero.
For two functions f and f (cid:48) on the same space, we have: f ∗ p µ = f (cid:48) ∗ p µ ⇐⇒ f
= f (cid:48)
a.e., where ( f ∗ p µ )( x ) :
= (cid:82) f
( x ) p µ ( x − µ ) d µ denotes convolution.
Proof.
The function equality f ∗ p µ = f (cid:48) ∗ p µ leads to the equality under Fourier transformation F [ f ∗ p µ ]
=
F [ f (cid:48) ∗ p µ ] , which gives F [ f ] F [ p µ ]
=
F [ f (cid:48) ]
F [ p µ ] .
Since F [ p µ ] is the characteristic function of p µ , the condition that it is a.e. non-zero indicates that F [ f ] = F [ f (cid:48) ] a.e. thus f = f (cid:48)
a.e.
See also Khemakhem et al.
(2019, Theorem 1).
A. P ROOF OF THE E QUIVALENCE R ELATION
Proposition A.6.
The semantic-equivalence deﬁned in Deﬁnition 5.3 is an equivalence relation if V is connected and is either open or closed in R d V .
Proof.
Let Φ be a semantic-preserving reparameterization from one
CSG p =
( p ( s, v ) , p ( x | s, v ) , p ( y | s )) to another p (cid:48)
= ( p (cid:48)
( s, v ) , p (cid:48)
( x | s, v ) , p (cid:48)
( y | s )) .
It has its Φ S constant of v , so we can write Φ( s, v ) =
(Φ S ( s ) , Φ V ( s, v ))
=:
( φ ( s ) , ψ s ( v )) .
We
ﬁrst show that φ , and ψ s for any s ∈ S , are homeomorphisms on S and V , respectively, and that Φ − 1 ( s (cid:48) , v (cid:48) )
= ( φ − 1 ( s (cid:48) ) , ψ − 1 φ − 1 ( s (cid:48) )
( v (cid:48) )) .
• Since Φ( S × V ) =
S × V , so φ ( S ) =
Φ S ( S ) =
S , so φ is surjective.
• Suppose that there exists s (cid:48)
∈ S such that φ − 1 ( s (cid:48) )
= { s ( i ) } i ∈I contains multiple distinct elements.
Since Φ is surjective, for any v (cid:48) ∈ V , there exist
i ∈
I and v ∈ V such that ( s (cid:48) , v (cid:48) )
=
Φ( s ( i ) , v ) =
( φ ( s ( i ) ) , ψ s ( i ) ( v )) , which means that (cid:83) i ∈I ψ s ( i ) ( V )
=
V . 2.
Since Φ is injective, the sets { ψ s ( i ) ( V ) } i ∈I must be mutually disjoint.
Otherwise, there would exist i (cid:54) =
j ∈ I and v (1) , v
(2) ∈
V such that ψ s ( i ) ( v (1) )
= ψ s ( j ) ( v (2) )
thus Φ( s ( i ) , v (1) )
=
( s (cid:48) , ψ s ( i ) ( v (1) ))
=
( s (cid:48) , ψ s ( j ) ( v (2) )) =
Φ( s ( j ) , v (2) ) , which violates the injectivity of Φ since s ( i ) (cid:54) = s ( j ) .
In the case where V is open, then so is any ψ s ( i ) ( V ) =
Φ( s ( i ) , V ) since Φ is continuous.
But the union of disjoint open sets (cid:83) i ∈I ψ s ( i ) ( V ) =
V cannot be connected.
This violates the condition that V is connected.
A similar argument holds in the case where V is closed.
So φ − 1 ( s (cid:48) ) contains only one unique element for any s (cid:48) ∈ S .
So φ is injective.
• The above argument also shows that for any s (cid:48) ∈ S , we have (cid:83) i ∈I ψ s ( i ) ( V ) =
ψ
φ − 1 ( s (cid:48) )
( V ) =
V .
For any s ∈ S , there exists s (cid:48)
∈ S such that s =
φ − 1 ( s (cid:48) ) , so we have ψ s ( V )
= V .
So ψ s is surjective for any s ∈ S .
• Suppose that there exist v (1) (cid:54) = v (2) ∈
V such that ψ s ( v (1) )
= ψ s ( v (2) ) .
Then Φ( s, v (1) )
= ( φ ( s ) , ψ s ( v (1) ))
= ( φ ( s ) , ψ s ( v (2) ))
=
Φ( s, v (2) ) , which contradicts the injectivity of Φ since v (1) (cid:54) = v (2) .
So ψ s is injective for any s ∈ S .
• That Φ is continuous and Φ( s, v ) =
( φ ( s ) , ψ s ( v )) indicates that φ and ψ s are continuous.
For any ( s (cid:48) , v (cid:48) )
∈ S × V , we have Φ( φ − 1 ( s (cid:48) ) , ψ − 1 φ − 1 ( s (cid:48) )
( v (cid:48) ))
= ( φ ( φ − 1 ( s (cid:48) )) , ψ φ − 1 ( s (cid:48) )
( ψ − 1 φ − 1 ( s (cid:48) )
( v (cid:48) )))
=
( s (cid:48) , v (cid:48) ) .
Applying Φ − 1 to both sides gives
[Equation]
( φ − 1 ( s (cid:48) ) , ψ − 1 φ − 1 ( s (cid:48) )
( v (cid:48) )) .
• Since Φ − 1 is continuous, φ − 1 and ψ − 1 s are also continuous.
(2) We now show that the relation is an equivalence relation.
It amounts to showing the following three properties
• Reﬂexivity.
For two identical CSGs, we have p ( s, v ) =
p (cid:48)
( s, v ) , p ( x | s, v ) = p (cid:48)
( x | s, v ) and p ( y | s ) =
p (cid:48)
( y | s ) .
So the identity map as Φ obviously satisﬁes all the requirements.
• Symmetry.
Let Φ be a semantic-preserving reparameterization from p
= ( p ( s, v ) , p ( x | s, v ) , p ( y | s )) to p (cid:48)
=
( p (cid:48)
( s, v ) , p (cid:48) ( x | s, v ) , p (cid:48)
( y | s )) .
From the above conclu sion in (1) , we know that (Φ −
1 ) S
s
(cid:48) ,
v (cid:48) )
=
φ − 1 ( s (cid:48) ) is semantic-preserving.
Also, Φ − 1 is a homeomorphism on S × V since Φ is.
So we only need to show that Φ − 1 is a reparameterization from p (cid:48) to p for symmetry.
From the deﬁnition of pushed-forward distribution, we have Φ − 1#
[ p (cid:48) s,v ] =
p s,v if Φ # [ p s,v ] = p (cid:48)
s,v .
It can also be veriﬁed through the rule of change of variables (Lemma A.4) when Φ and Φ − 1 are differentiable
From
Φ # [ p s,v ] = p (cid:48)
s,v , we
have for any ( s (cid:48) , v (cid:48) ) , p s,v (Φ − 1 ( s (cid:48) , v (cid:48) ))
| J Φ − 1 ( s (cid:48) , v (cid:48) )
| =
p (cid:48) s,v ( s (cid:48) , v (cid:48)
Since for any ( s, v ) there exists ( s (cid:48) , v (cid:48) )
such that ( s, v ) =
Φ − 1 ( s (cid:48) , v (cid:48) ) , this implies that for any ( s, v ) , p s,v ( s, v ) |
J Φ − 1 (Φ( s, v )) | = p (cid:48) s,v (Φ( s, v )) , or p s,v ( s, v ) = p (cid:48)
s,v (Φ( s, v )) /
| J Φ − 1 (Φ( s, v )) | = p (cid:48) s,v (Φ( s, v ))
| J Φ ( s, v ) | (inverse function theorem), which means that p s,v =
Φ − 1# [ p (cid:48) s,v ] by the rule of change of variables.
For any ( s
(cid:48) ,
v
(cid:48) )
, there exists ( s, v ) such that ( s (cid:48) , v (cid:48) ) =
Φ( s, v ) , so p (cid:48) ( x | s (cid:48) , v (cid:48)
= p (cid:48)
( x | Φ( s, v )) =
p ( x | s, v ) = p ( x | Φ − 1 ( s (cid:48) , v (cid:48) )) , and p (cid:48)
( y | s (cid:48) )
=
p (cid:48)
( y | Φ S ( s ))
=
p ( y | s )
=
p ( y | (Φ − 1 ) S ( s (cid:48) )) .
So Φ − 1 is a reparameterization from p (cid:48) to p .
• Transitivity.
Given a third CSG p (cid:48)(cid:48) =
( p (cid:48)(cid:48)
( s, v ) , p (cid:48)(cid:48) ( x | s, v ) , p (cid:48)(cid:48)
( y | s ))
that is semanticequivalent to p (cid:48) , there exists a semantic-preserving reparameterization Φ (cid:48) from p (cid:48) to p (cid:48)(cid:48) .
It is easy to see that (Φ (cid:48) ◦ Φ) S ( s, v ) =
Φ (cid:48)S (Φ S ( s, v )) =
Φ (cid:48)S (Φ S ( s )) is constant of v thus semantic-preserving.
As the composition of two homeomorphisms Φ and Φ (cid:48) on S × V , Φ (cid:48) ◦ Φ is also a homeomorphism.
So we only need to show that Φ (cid:48) ◦ Φ is a reparameterization from p to p (cid:48)(cid:48) for transitivity.
From the deﬁnition of pushed-forward distribution we have (Φ (cid:48) ◦ Φ)
# [ p s,v ] =
Φ (cid:48)
# [Φ # [ p s,v ]] =
Φ (cid:48)
# [ p (cid:48) s,v ] =
p (cid:48)(cid:48) s,v if Φ # [ p s,v ] = p (cid:48)
s,v and Φ (cid:48)
# [ p (cid:48) s,v ] =
p (cid:48)(cid:48) s,v .
It can also be veriﬁed through the rule of change of variables (Lemma A.4) when Φ − 1 and Φ (cid:48)− 1 are differentiable.
For any ( s (cid:48)(cid:48) , v (cid:48)(cid:48) ) , we have
[Equation]
Φ
[Equation]
s,
[Equation] [Equation]
[Equation] [Equation]
(cid:48)(cid:48) ) .
For any ( s, v ) , we have:
[Equation]
So Φ (cid:48) ◦ Φ is a reparameterization from p to p (cid:48)(cid:48) .
This completes the proof for an equivalence relation.
A. P ROOF OF THE S EMANTIC -I DENTIFIABILITY T HEOREM 5.
We present a more general and detailed version of Theorem 5.4 and prove it.
The theorem in the main context corresponds to conclusions (ii) and (i) below by taking the two CSGs p (cid:48) and p as the well-learned p and the ground-truth CSGs p ∗ , respectively.
Theorem 5.4’ (semantic-identiﬁability) .
Consider CSGs p and p (cid:48) that have Assumptions 5.1 and 5.
hold, with the bounded derivative conditions speciﬁed to be that for both CSGs, f − 1 and g are twice and f thrice differentiable with mentioned derivatives bounded.
Further assume that their priors have bounded densities and their log p ( s, v ) have bounded derivatives up to the second-order.
If the two CSGs have p ( x, y ) = p (cid:48) ( x, y ) , then they are semantic-equivalent, under the conditions that:
(i) p µ has an a.e. non-zero characteristic function ( e
g. , a Gaussian distribution); (ii) 1 σ 2 µ → ∞ , where σ 2 µ := E [ µ (cid:62) µ ] ; (iii) 1 σ 2 µ (cid:29) B (cid:48)
f − 1 max
[Equation]
B (cid:48)
[Equation]
2 f
[Equation]
d 3 B (cid:48)(cid:48)(cid:48) f B (cid:48)
f − 1 )
where d := d S + d V , and for both CSGs, the constant B p
bounds p ( s, v ) , B (cid:48)
f − 1 , B (cid:48) g , B (cid:48) log p and B (cid:48)(cid:48)
f , B (cid:48)(cid:48) g , B (cid:48)(cid:48) log p bound the 2-norms 8 of the gradient/
Jacobian
and
the
Hessians of
the
respective functions
and B (cid:48)(cid:48)(cid:48)
f bounds
all the
3rd-
order derivatives of
f .
Proof.
Without loss of generality, we assume that µ and ν (for continuous y ) have zero mean.
If it is not, we can redeﬁne f ( s, v ) :
= f ( s, v ) + E [ µ ] and µ := µ − E [ µ ] (similarly for ν for continuous y ) which does not alter the joint distribution p ( s, v, x, y ) nor violates any assumptions.
Also without loss of generality, we consider one scalar component (dimension) l of y , and abuse the use of symbols y and g for y l and g l to avoid unnecessary complication.
Note that for continuous y , due to the additive noise structure y =
g ( s )+ ν and that ν has zero mean, we also have E [ y | s ]
= g ( s ) as the same as the categorical y case (under the one-hot representation).
We sometimes denote z :=
( s, v ) for convenience.
First note that for both CSGs and both continuous and categorical y , by construction g ( s ) is a sufﬁcient statistics of p ( y | s ) (not only the expectation E [ y | s ] ), and it is injective.
So by Lemma A.3, we only need to show that there exists a reparameterization from p to p (cid:48) .
We will show that Φ :=
f (cid:48)− 1 ◦ f is such a reparameterization.
Since f and f (cid:48) are bijective and continuous, we have Φ − 1 = f − 1 ◦ f (cid:48) , so Φ is bijective and Φ and Φ − 1 are continuous.
So Φ is a homeomorphism.
Also, by construction, we have:
[Equation]
So we only need to show
that p ( x, y ) =
p (cid:48)
( x, y ) indicates Φ # [ p z ] = p (cid:48)
z and p ( y | s ) =
p (cid:48)
( y | Φ S ( s, v )) , ∀ v ∈ V under the conditions.
Proof under condition (i).
We begin with a useful reformulation of the integral (cid:82) t ( z ) p ( x | z ) d z for a general function t of z .
We will encounter integrals in this form.
By Assumption 5.1, we have p ( x | z ) =
p µ ( x − f ( z )) , so we consider a transformation Ψ x
( z ) := x − f ( z ) and let µ =
Ψ x ( z ) .
It is invertible, Ψ − 1 x ( µ ) =
f − 1 ( x − µ ) , and J Ψ − 1 x ( µ ) =
− J f − 1 ( x − µ ) .
By these deﬁnitions and the rule of change of variables, we have:
[Equation]
where we have denoted functions ¯ t :
= t ◦ f − 1 , V :=
(cid:12)(cid:12)
J f − 1 (cid:12)(cid:12) , and abused the push-forward notation f # [ t ] for a general function t to formally denote ( t ◦ f − 1 ) (cid:12)(cid:12)
J f
[Equation]
According to the graphical structure of CSG, we have:
[Equation]
So from Eq.
(9), we have:
[Equation]
Matching the data distribution p ( x, y ) =
p (cid:48)
( x, y ) indicates both p ( x ) = p (cid:48) ( x ) and E
[ y | x ] = E (cid:48)
[ y | x ] .
Using Lemma A.5 under condition (i) , this further indicates f # [ p z ] = f (cid:48)
# [ p (cid:48)
z ] a.e. and f # [ gp z ] = f (cid:48)
# [ g (cid:48) p (cid:48)
z ] a.e.
The former gives Φ # [ p z ] = p (cid:48) z .
The latter can be reformed as ¯ gf # [ p z ]
= ¯ g (cid:48)
f (cid:48)
# [ p (cid:48)
z ] a.e., so ¯ g = ¯ g (cid:48) a.e., where we have denoted ¯ g :=
g ◦ ( f − 1 ) S
and ¯ g (cid:48) :
= g (cid:48) ◦ ( f (cid:48)− 1 ) S similarly.
From ¯ g = ¯ g (cid:48) , we have for any v ∈ V ,
[Equation]
For both continuous and categorical y , g ( s ) uniquely determines p ( y | s ) .
So the above equality means that p ( y | s ) =
p (cid:48)
( y | Φ S ( s, v )) for any v ∈ V .
Proof under condition (ii).
Applying Eq.
(8) to Eqs.
(10, 11), we have:
[Equation]
where we have similarly denoted ¯ p z :
= p z ◦ f − 1 .
Under condition (ii) , E [ µ (cid:62) µ ] is inﬁnitesimal, so we can expand the expressions w.r.t µ .
For p ( x ) , we have:
[Equation]
where all functions are evaluated at x .
For E [ y | x ] , we ﬁrst expand 1 /p ( x ) using 1 x + ε = 1 x − εx 2 +
O ( ε 2 ) to get: 1 p ( x ) =
1¯ p
z V −
[Equation]
+ O ( σ 3 µ ) .
The second term is expanded as:
[Equation]
Combining the two parts, we have:
[Equation] [Equation]
This equation holds for any x ∈ supp( p x ) since the expectation is taken w.r.t the distribution p ( x, y ) ; in other words, the considered x here is any value generated by the model.
So up to O ( σ 2 µ ) ,
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation] [Equation]
Given the bounding conditions in the theorem, the multiplicative factors to E [ µ (cid:62) µ ] in the last expressions are bounded by a constant.
So when 1 σ 2 µ → ∞ , i.e. E [ µ (cid:62) µ ] → 0 , we have p ( x ) and
E [ y | x ] converge uniformly to (¯ p z V )( x ) =
f
# [ p z ]( x ) and ¯ g ( x ) , respectively.
So p ( x, y ) = p (cid:48)
( x, y ) indicates f # [ p z ] = f (cid:48)
# [ p (cid:48)
z ] and ¯ g = ¯ g (cid:48) , which means Φ # [ p z ] = p (cid:48)
z and p ( y | s ) =
p (cid:48)
( y | Φ S ( s, v )) for any v ∈ V , due to Eq.
(13) and the explanation that follows.
Proof under condition (iii).
We only need to show that when 1 σ 2 µ is much larger than the given quantity, we still have p ( x, y )
=
p (cid:48)
( x, y ) =
⇒ ¯ p z V = ¯ p (cid:48)
z V (cid:48) , ¯ g = ¯ g (cid:48) up to a negligible effect.
This task amounts to showing that the residuals | p ( x ) − (¯ p z V )( x ) | and | E [ y | x ] − ¯ g ( x ) | controlled by
Eqs.
(15, 16) are negligible.
To achieve this, we need to further expand the controlling functions using derivatives of f , g and p z explicitly, and bound them by the bounding constants.
In the following, we use indices a, b, c for the components of x and i, j, k for those of z .
For functions of z appearing in the following ( e.g. , f , g , p z and their derivatives), they are evaluated at z = f − 1 ( x ) since we are bounding functions of x .
[Equation]
From the chain rule of differentiation, it is easy to show that:
[Equation]
where ∇ z g = ( ∇ g (cid:62) , 0 (cid:62) d V ) (cid:62) (recall that g is a function only of s ).
For the term ∇ log V , we apply
Jacobi’s formula for the derivative of the log-determinant:
[Equation]
However, as bounding Eq.
(17) already requires bounding (cid:13)(cid:13)
J f − 1 (cid:13)(cid:13) 2 , directly using this expression to bound (cid:107)∇ log V (cid:107) 2 would require to also bound (cid:107) J f (cid:107) 2 .
This requirement to bound the ﬁrst-order derivatives of both f and f − 1 is a relatively restrictive one.
To ease the requirement, we would like to express ∇ log V in terms of J f − 1 .
This can be achieved by expressing ∇∇ (cid:62)
f −
i ’s in terms of ∇∇ (cid:62) f c ’s.
To do this, ﬁrst consider a general invertible-matrix-valued function A ( α ) on a scalar α .
We have 0 = ∂ α (cid:0)
A ( α ) − 1 A ( α ) (cid:1) =
[Equation]
∂
[Equation]
A − 1 ) A + A − 1 ∂ α A , so we have A − 1 ∂ α A
= − ( ∂ α A − 1 ) A , consequently ∂ α A = − A ( ∂ α A
−
A .
Using this relation (in the fourth equality below), we have:
[Equation]
or in matrix form,
[Equation]
where we have deﬁned the matrix K c :
=
J
[Equation]
∇∇
[Equation]
f c ) J
[Equation]
f − 1 which is symmetric.
Substituting with this result
[Equation]
we can transform Eq.
(18) into a desired form:
[Equation]
so its norm can be bounded by:
[Equation]
21) where we have used the following result in the last inequality:
[Equation] [Equation]
Integrating Eq.
(17) and Eq.
[Equation]
we have:
[Equation]
For the Hessian of ¯ g , direct calculus gives:
[Equation]
To avoid the requirement of bounding both ∇∇ (cid:62) f c ’s and ∇∇ (cid:62) f −
i
[Equation]
, we substitute ∇∇ (cid:62) f − 1 i using
Eq.
[Equation]
So its norm can be bounded by:
[Equation]
where we have used Eq.
(22) in the last inequality.
Assembling Eq.
(23) and Eq.
(24) into Eq.
(16), we have:
[Equation]
So given the condition (iii) , this residual can be neglected.
(2) Bounding | p ( x ) − (
[Equation]
z
[Equation] [Equation]
) |
[Equation]
∇∇
(cid:62) log V (cid:13)(cid:13) 2 (cid:1) from Eq.
To begin with, for any x , ¯ p z ( x ) =
p z ( f − 1 ( x ))
(cid:54) B p , and V ( x ) = (cid:12)(cid:12)
J f − 1 ( x ) (cid:12)(cid:12) is the product of absolute eigenvalues of J f − 1 ( x ) .
Since (cid:13)(cid:13)
J f − 1 ( x ) (cid:13)(cid:13) 2 is the largest absolute eigenvalue of J f − 1 ( x ) , so V ( x ) (cid:54) (cid:13)(cid:13)
J f − 1 ( x ) (cid:13)(cid:13)
d 2 (cid:54) B (cid:48)
df − 1 .
For the ﬁrst norm in the bracket of the r.h.s of Eq.
(15), we have:
[Equation]
where we have utilized Eq.
(17) and Eq.
(21) in the last inequality.
We consider bounding (cid:107)∇ log V (cid:107) 22 separately.
Using Eq.
(20) (in the second equality below)
[Equation]
we have:
[Equation]
[Table]
[Equation]
where we have used the facts for general matrix A and (column) vectors α, β that
[Equation]
[Table]
[Equation] [Equation]
in the ﬁfth last inequality, and that
[Equation]
29) in the second last inequality.
Substituting Eq.
(27) into Eq.
(26), we have:
[Equation]
For the second norm in the bracket of the r.h.s of Eq.
(15), similar to Eq.
(24), we have:
[Equation]
The third norm (cid:13)(cid:13) ∇∇ (cid:62) log V (cid:13)(cid:13) 2 in the bracket of the r.h.s of Eq.
(15) needs some more effort.
From
Eq.
(20), we have ∂ b log V = − (cid:80) cij
[Equation]
J f − 1 ) ci ( ∂ i
∂ j f c )( J f − 1 ) bj , thus
[Equation]
a
[Equation]
log V
[Equation]
−
[Equation]
where we have used Eq.
(19) in the third equality for the ﬁrst two terms.
In matrix form, we have: ∇∇
[Equation]
We now bound the norms of the three terms in turn.
For the ﬁrst term,
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where we have used Eq.
(28) in the fourth last inequality and Eq.
(29) in the second last inequality
[Equation]
For the second term,
[Equation] [Equation]
where we have used Eq.
(22) in the last inequality.
For the third term,
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where we have used Eq.
(29) in the fourth last and second last inequalities
[Equation]
Finally, by assembling Eqs.
(30, 31, 32, 33, 34) into Eq.
[Equation]
we have:
[Equation]
So given the condition (iii) , this residual can be neglected.
A. P ROOF OF THE OOD G ENERALIZATION E RROR B OUND T HEOREM 5.
We give the following more detailed version of Theorem 5.5 and prove it.
The theorem in the main context corresponds to conclusion (ii) below ( i.e. , Eq.
(37) below recovers Eq.
(6)) by taking the CSGs p (cid:48) , p and ˜ p as the semantic-identiﬁed CSG p on the training domain and the groundtruth CSGs on the training p ∗ and test ˜
p ∗ domains, respectively.
Here, the semantic-identiﬁcation requirement on the learned CSG p is to guarantee that it is semantic-equivalent to the ground-truth
CSG p ∗ on the training domain, so that the condition in (ii) is satisﬁed.
Theorem 5.5’ (OOD generalization error) .
Let Assumptions 5.1 and 5.2 hold.
(i) Consider two
CSGs p and ˜ p that share the same generative mechanisms p ( x | s, v ) and p ( y | s ) but have different priors p s,v and ˜ p s,v .
Then up to O ( σ 2 µ ) where σ 2 µ := E [ µ (cid:62) µ ] , we have for any x ∈ supp( p x ) ∩ supp(˜ p x ) , (cid:12)(cid:12)(cid:12)
[Equation]
[Equation]
where J f − 1 is the Jacobian of f − 1 .
Further assume that the bounds B ’s deﬁned in Theorem 5.4’ (iii) hold.
Then the error is negligible for any x ∈ supp( p x ) ∩ supp(˜ p x ) if 1 σ 2 µ (cid:29) B (cid:48) log p B (cid:48)
g B (cid:48) 2 f − 1 , and:
[Equation]
(36) if supp( p x ) =
supp(˜ p x ) , where ∆ denotes the Laplacian operator.
(ii) Let p (cid:48) be a CSG that is semantic-equivalent to the CSG p introduced in (i) .
Then up to O ( σ 2 µ ) , we have for any x ∈ supp( p (cid:48) x ) ∩ supp(˜ p x ) ,
[Equation] [Equation]
where ˜ p (cid:48) s,v :=
Φ # [˜ p s,v ] is the prior of CSG ˜ p under the parameterization of CSG p (cid:48) , derived as the pushed-forward distribution by the reparameterization Φ :
= f (cid:48)− 1 ◦ f from p to p (cid:48) .
For conclusion (i) , in the expected OOD generalization error in Eq.
(36), the term E ˜ p s,v [2∆ log p s,v − ∆ log ˜ p s,v
+ (cid:107)∇ log p s,v (cid:107) 22 ] is actually the score matching objective (Fisher divergence)
(Hyv¨arinen, 2005) that measures the difference between ˜ p s,v and p s,v .
For Gaussian priors p ( s, v ) =
N (0 , Σ) and ˜ p ( s, v ) = N (0 , ˜Σ) , the term reduces to the matrix trace, tr( − 2Σ − 1 + ˜Σ − 1 + Σ − 1 ˜ΣΣ − 1 ) .
For Σ = ˜Σ , the term vanishes.
For conclusion (ii) , note that since p and p (cid:48) are semantic-equivalent, we have p (cid:48) x
= p x and E (cid:48)
[ y | x ] =
E
[ y | x ] (from Lemma A.2).
So Eqs.
(35, 37) bound the same quantity.
Equation (37) expresses the bound using the structures of the CSG p (cid:48) .
It is considered since recovering the exact CSG p from ( x, y ) data is impractical and we can only learn a CSG p (cid:48) that is semantic-equivalent to p .
Proof.
Following the proof A.2 of Theorem 5.4’, we assume the additive noise variables µ and ν (for continuous y ) have zero mean without loss of generality, and we denote z :
=
( s, v ) .
Proof under condition (i).
Under the assumptions, we have Eq.
(14) in the proof A.2 of Theorem 5.4’ hold.
Noting that the two CSGs share the same ¯ g and V (since they share the same p ( x | s, v ) and p ( y | s ) thus f and g ), we have for any x ∈ supp( p x ) ∩ supp(˜ p x ) ,
[Equation]
(38) where we have similarly deﬁned ¯˜ p z :
= ˜ p
z ◦ f − 1 .
By subtracting the two equations, we have that up to O ( σ 2 µ ) ,
[Equation]
The multiplicative factor to E [ µ (cid:62) µ ] on the right hand side can be further bounded by:
[Equation] [Equation]
where ∇ g and ∇ log( p z / ˜ p z ) are evaluated at z = f − 1 ( x ) .
This gives:
[Equation]
i.e. Eq.
(35) in conclusion (i) .
When the bounds B ’s in Theorem 5.4’ (iii) hold, we further have:
[Equation]
[Table]
[Equation]
So when 1 σ 2 µ (cid:29) B (cid:48) log p B (cid:48)
g B (cid:48)
f − 1 , this difference is negligible for any x ∈ supp( p x ) ∩ supp(˜ p x ) .
We now turn to the expected OOD generalization error Eq.
(36) in conclusion (i) .
When supp( p x ) = supp(˜ p x ) , Eq.
(35) hold on ˜ p x .
Together with the bounds in Theorem 5.4’ (iii) , we have:
[Equation]
where the equality holds due to the generating process of the model.
Note that the term
E ˜ p
z (cid:107)∇ log( p z / ˜ p
z ) (cid:107) 22 therein is the score matching objective (Fisher divergence).
By Hyv¨arinen (2005, Theorem 1), we can reformulate it as E ˜ p
z [2∆
[Equation]
+
[Equation]
log
[Equation]
z
[Equation]
22 ] , so we have:
E
[Equation]
Proof under condition (ii).
From Eq.
(14) in the proof A.2 of Theorem 5.4’, we have for CSG p (cid:48)
that for any x ∈ supp( p (cid:48) x ) or equivalently x ∈ supp( p x ) ,
[Equation]
where we have similarly deﬁned ¯ p (cid:48)
z :=
p (cid:48)
z ◦ f (cid:48)− 1 and ¯ g (cid:48) :
= g (cid:48) ◦ ( f (cid:48)− 1 ) S .
Since p and p (cid:48) are semantic-equivalent with reparameterization Φ from p to p (cid:48) , we have p ( y | s ) =
p (cid:48)
( y | Φ S ( s, v )) thus g ( s ) =
g (cid:48) (Φ S ( s, v )) for any v ∈ V .
So for any x ∈ supp( p x ) or equivalently x ∈ supp( p (cid:48) x ) , we have g (( f − 1 ) S ( x )) =
g (cid:48) (Φ S (( f − 1 ) S
( x ) , ( f − 1 ) V ( x )))
=
g (cid:48) (Φ S ( f − 1 ( x )))
=
g (cid:48)
(( f (cid:48)− 1 ) S ( f ( f − 1 ( x ))))
=
g (cid:48)
(( f (cid:48)− 1 ) S ( x )) , i.e. , ¯ g = ¯ g (cid:48) .
For another fact, since ˜ p (cid:48)
z :=
Φ # [˜ p z ] =
( f (cid:48)− 1 ◦ f )
[˜ p z ] by deﬁnition, we have f (cid:48)
# [˜ p (cid:48)
z ]
=
f
# [˜ p z ] , i.e. , ¯˜ p (cid:48)
z V (cid:48) =
¯˜ p z V .
Subtracting Eqs.
and applying these two facts, we have up to O ( σ 2 µ ) , for any x ∈ supp( p (cid:48) x ) ∩ supp(˜ p x ) ,
[Equation]
where the inequality follows Eq.
Using a similar result of Eq.
(40), we have:
[Equation]
where ∇ g (cid:48) and ∇ log( p (cid:48) z / ˜ p (cid:48)
z ) are evaluated at z = f (cid:48)− 1 ( x ) .
This gives Eq.
A. P ROOF OF THE D OMAIN A DAPTATION E RROR T HEOREM 5.
To be consistent with the notation in the proofs, we prove the theorem by denoting the semanticidentiﬁed CSG p and the ground-truth CSG ˜
p ∗ on the test domain as p (cid:48) and ˜ p , respectively.
Proof.
The new prior ˜ p (cid:48)
( z ) is learned by ﬁtting unsupervised data from the test domain ˜ p ( x ) .
Applying the deduction in the proof A.2 of Theorem 5.4’ to the test domain, we have that under any of the three conditions in Theorem 5.4’, ˜ p
( x ) =
˜ p (cid:48)
( x ) indicates f # [˜ p z ] = f (cid:48)
# [˜ p (cid:48)
z ] .
This gives ˜ p (cid:48)
z =
( f (cid:48)− 1 ◦ f )
[˜ p z ] =
Φ # [˜ p z ] .
From Eq.
(12) in the same proof, we have that:
[Equation]
From the proof A.3 of Theorem 5.5’ (ii) (the paragraph under Eq.
(41)), the semantic-equivalence between CSGs p and p (cid:48) indicates that ¯ g = ¯ g (cid:48) .
So from the above two equations, we have ˜ p ( x )
˜ E
[ y | x ] = ˜ p (cid:48)
( x )˜ E (cid:48)
[ y | x ] (recall that ˜ p ( x ) =
˜ p (cid:48)
( x ) indicates f # [˜ p z ] = f (cid:48)
# [˜ p (cid:48) z ] ).
Since ˜ p ( x ) = ˜ p (cid:48) ( x ) (that is how
˜ p (cid:48)
z is learned), we have for any x ∈ supp(˜ p x ) or equivalently x ∈ supp(˜ p (cid:48) x ) ,
[Equation]
B A LTERNATIVE I DENTIFIABILITY T HEORY FOR CSG
The presented identiﬁability theory, particularly Theorem 5.4, shows that the semantic-identiﬁability can be achieved in the deterministic limit ( 1 σ 2 µ → ∞ ), but does not quantitatively describe the extent of violation of the identiﬁability for a ﬁnite variance σ 2 µ .
Here we deﬁne a “soft” version of semanticequivalence and show that it can be achieved with a ﬁnite variance, with a trade-off between the “softness” and the variance.
Deﬁnition B.1 ( δ -semantic-dependency) .
For δ > 0 and two CSGs p and p (cid:48) , we say that they are δ -semantic-dependent, if there exists a homeomorphism Φ on S × V such that: (i) p ( x | s, v ) =
p (cid:48)
( x | Φ( s, v )) , (ii) sup v ∈V (cid:13)(cid:13)
g
( s ) − g (cid:48) (Φ S ( s, v ))
(cid:13)(cid:13) 2 (cid:54) δ where we have denoted g ( s ) :=
E [ y | s ] , and (iii) sup
[Equation] [Equation]
[Equation]
(cid:13)(cid:13)
Φ S ( s, v (1) ) − Φ
[Equation]
( s, v
[Equation]
(cid:13)(cid:13) 2 (cid:54) δ .
In the deﬁnition, we have released the prior conversion requirement, and relaxed the exact likelihood conversion for p ( y | s ) in (ii) and the v -constancy of Φ S in (iii) to allow an error bounded by δ .
When δ = 0 , the v -constancy of Φ S is exact, and under the additive noise Assumption 5.1 we also have the exact likelihood conversion p ( y | s )
= p (cid:48)
( y | Φ S ( s, v )) for any v ∈ V .
So 0 -semantic-dependency with the prior conversion requirement reduces to the semantic-equivalence.
Due to the quantitative nature, the binary relation cannot be made an equivalence relation but only a dependency.
Here, a dependency refers to a binary relation with reﬂexivity and symmetry, but no transitivity.
Proposition B.2.
The δ -semantic-dependency is a dependency relation if the function g :=
E [ y | s ] is bijective and its inverse g − 1 is 12 -Lipschitz.
Proof.
Showing a dependency relation amounts to showing the following two properties.
• Reﬂexivity.
For two identical CSGs p and p (cid:48) , we have p ( x | s, v ) =
p (cid:48)
( x | s, v ) and p ( y | s ) =
p (cid:48)
( y | s ) .
So the identity map as Φ obviously satisﬁes all the requirements in Deﬁnition B.1.
• Symmetry.
Let CSG p be δ -semantic-dependent to CSG p (cid:48) with homeomorphism Φ .
Obviously Φ − 1 is also a homeomorphism.
For any ( s (cid:48) , v (cid:48) )
∈ S × V , we have p (cid:48)
( x | s (cid:48) , v (cid:48) )
=
p (cid:48)
( x | Φ(Φ − 1 ( s (cid:48) , v (cid:48) )))
= p ( x | Φ
[Equation]
s
(cid:48)
, v (cid:48) )) , and (cid:13)(cid:13) g (cid:48)
s (cid:48)
) − g ((Φ − 1 ) S ( s (cid:48)
[Equation]
(cid:48) ))
(cid:13)(cid:13)= (cid:13)(cid:13)
[Equation]
(cid:48)
(Φ
S
s
v
)) − g ( s ) (cid:13)(cid:13) 2 (cid:54) δ where we have denoted ( s, v ) :=
Φ − 1 ( s (cid:48) , v (cid:48) ) here.
So Φ −satisﬁes requirements (i) and (ii) in Deﬁnition B.1.
For requirement (iii) , we need the following fact: for any s (1) , s (2) ∈ S , (cid:13)(cid:13) s (1) − s (2) (cid:13)(cid:13)
= (cid:13)(cid:13)
g − 1 ( g ( s (1) ))
− g − 1 ( g ( s (2) ))
(cid:13)(cid:13) 2 (cid:54) 12 (cid:13)(cid:13) g
( s (1) )
− g ( s (2) )
(cid:13)(cid:13) 2 , where the inequality holds since g − 1 is 12 -Lipschitz.
Then for any s (cid:48) ∈ S , we have: sup
[Equation]
=
[Equation]
[Table]
δ
[Table]
where in the last inequality we have used the fact that Φ − 1 satisﬁes requirement (ii) .
So p
(cid:48) is δ -
semantic
-dependent to p via the
homeomorphism Φ − 1 .
The corresponding δ -semantic-identiﬁability result follows.
Theorem B.3 ( δ -semantic-identiﬁability) .
Assume the same as Theorem 5.4’ and Proposition B.2, and let the bounds B ’s deﬁned in Theorem 5.4’ (iii) hold.
For two such CSGs p and p (cid:48) , if they have p ( x, y )
=
p (cid:48)
( x, y ) , then they are δ -semantic-dependent for any δ (cid:62)
[Equation]
, where d := d S + d V .
Proof.
Let Φ :
=
f
(cid:48)− 1 ◦ f , where f and f (cid:48) are given by the two CSGs p and p (cid:48) via Assumption 5.1.
We now show that p and p (cid:48) are δ -semantic-dependent via this Φ for any δ in the theorem.
Obviously Φ is a homeomorphism on S × V , and it satisﬁes requirement (i) in Deﬁnition B.1 by construction due to Eq.
(7) in the proof A.2 of Theorem 5.4’.
Consider requirement (ii) in Deﬁnition B.1.
Based on the same assumptions as Theorem 5.4’, we have Eq.
(25) hold for both CSGs:
[Equation]
where we have denoted σ 2 µ :
= E [ µ (cid:62) µ ] .
Since both CSGs induce the same p ( y | x )
[Equation]
so E [ y | x ] =
E (cid:48)
[ y | x ] .
This gives:
[Equation]
So for any ( s, v ) ∈ S × V
[Equation]
by denoting x := f ( s, v )
[Equation]
we have:
[Equation]
So the requirement is satisﬁed.
For requirement (iii) , note from the proof of Proposition B.2 that when g is bijective and its inverse is 12 -Lipschitz, requirement (ii) implies requirement (iii) .
So this Φ is a homeomorphism that makes p δ -semantic-dependent to p (cid:48) for any δ (cid:62) σ
[Equation]
µ B
[Equation]
f
[Equation] [Equation]
2 B
[Equation]
B
[Equation]
B
[Equation]
dB
[Equation]
B
[Equation]
B
[Equation]
g
[Equation]
Note that although the δ -semantic-dependency does not have transitivity, the above theorem is still informative: for any two CSGs sharing the same data distribution, particularly for a well-learned CSG p and the ground-truth CSG p ∗ , the likelihood conversion error sup ( s,v ) ∈S×V
(cid:13)(cid:13) g ( s ) − g (cid:48) (Φ S ( s, v )) (cid:13) (cid:13) 2 , and the degree of mixing v into s , measured by sup v (1) ,v (2) ∈V (cid:13)(cid:13)
Φ S ( s, v (1) ) − Φ S ( s, v (2) )
(cid:13)(cid:13) 2 , are bounded by σ 2 µ B (cid:48)
f − 1 (cid:0) 2 B (cid:48) log p B (cid:48)
g + B (cid:48)(cid:48) g + 3 dB (cid:48)
f − 1 B (cid:48)(cid:48)
f B (cid:48) g (cid:1) .
C M ORE E XPLANATIONS ON THE M ODEL
Explanations on our perspective.
We see the data generation process as generating the conceptual latent factors ( s, v ) ﬁrst, and then generating both x and y based on the factors.
This follows
Peters et al.
(2017, Section 1.4) who promote the generation of an OCR dataset as the writer ﬁrst comes up with an intension to write a character, and then writes down the character and gives its label based on the intension.
It is also natural for medical image datasets, where the label may be diagnosed based on more fundamental features ( e.g. , PCR test results showing the pathogen) that are not included in the dataset but actually cause the medical image.
This generation process is also considered by Mcauliffe & Blei (2008); Kilbertus et al.
; Teshima et al.
On the labeling process from images that one would commonly think of, we also view it as a s → y process.
Human directly knows the critical semantic feature s ( e.g. , the shape and position of each stroke) by seeing the image, through the nature gift of the vision system (Biederman, 1987).
The label is given by processing the feature ( e.g. , the angle between two linear strokes, the position of a circular stroke relative to a linear stroke), which is a s → y process.
The causal graph in Fig.
1 implies that x ⊥⊥ y | s .
This does not indicate that the semantic factor s generates an image x
regardless of the label y .
Given s , the generated image is dictated to hold the given semantics regardless of randomness, so the statistical independence does not mean semantic irrelevance.
If an image x is given, the corresponding label is given by p ( y | x ) , which is (cid:82) p ( s | x ) p ( y | s )
d s by the causal graph.
So the semantic concept to cause the label through p ( y | s ) , is inferred from the image through p ( s | x ) .
Comparison with the graph y tx → s → x → y rx .
This graph is considered by one of our reviewers, under the perspective of a communication channel, where y tx is a transmitted signal and y rx is the received.
If the observed label y is treated as y tx , the graph then implies y → s .
This is argued at the end of item (2) in Section 3 that it may make unreasonable implications.
Moreover, the graph also implies that y is a cause of x , as is challenged in item (1) in Section 3.
The unnatural implications arise since intervening y is different from intervening the “ground-truth” label.
We consider y as an observation that may be noisy, while the “ground-truth label” is never observed: one cannot tell if the labels at hand are noise-corrupted, based on the dataset alone.
For example, the label of either image in
Fig.
2 may be given by a labeler’s random guess.
Our adopted causal direction s → y is consistent with these examples and is also argued and adopted by Mcauliffe & Blei (2008);
Peters et al.
Section 1.4); Kilbertus et al.
; Teshima et al.
If the observed label y is treated as y rx , the graph then implies x → y , as is challenged in item (1) in Section 3.
It is also argued by Sch ¨ olkopf et al.
; Peters et al.
(2017, Section 1.4); Kilbertus et al.
Treating the observed label y as y rx and y tx as the “ground-truth” label may be the motivation of this graph.
But the graph implies that y tx ⊥⊥ y rx | x , that is, p ( y tx | x, y rx ) =
p ( y tx | x ) and p ( y rx | x, y tx ) =
p ( y rx | x ) .
So modeling y tx (resp.
y rx ) does not beneﬁt predicting y rx (resp.
y tx )
from x .
D R ELATION TO E XISTING D OMAIN A DAPTATION T HEORY
Existing DA theory In existing DA literature, the objective is to ﬁnd a labeling function h : X →
Y within a hypothesis space H that minimizes the target-domain risk ˜ R ( h ) :
= E ˜ p
( x,y )
[ (cid:96) ( h ( x ) , y )] deﬁned with a loss function (cid:96) :
Y × Y → R .
Since ˜ p ( x, y ) is unavailable, it is of practical interest to consider the source-domain risk R ( h ) and investigate its relation to ˜ R ( h ) .
Ben-David et al.
(2010a) give a bound relating the two risks:
[Equation]
(43) where:
[Equation]
Here X denotes the σ -algebra on X , d 1 ( p x , ˜ p x ) is the total variation between the two distributions, and h ∗ ∈ argmin h ∈H R ( h ) and ˜ h ∗ ∈ argmin ˜
h ∈H ˜ R (˜ h ) are the oracle/ground-truth labeling functions on the source and target domains, respectively ( e.g. , h ∗ ( x ) =
E [ y | x ] and ˜ h ∗ ( x ) =
˜ E
[ y | x ] if supp( p x ) =
supp(˜ p x ) ).
Zhao et al.
(2019) give a similar bound in the case of binary classiﬁcation, in terms of the ˜ H -divergence d ˜ H in place of the total variance d 1 , where ˜ H :
= { sign( | h ( x ) − h (cid:48)
( x ) | − t ) : h, h (cid:48) ∈ H , t ∈ [0 , 1] } .
Ben-David et al.
(2010a) also argue that in this bound, the total variation d 1 is overly strict and hard to estimate, so they develop another bound which is better known (asymptotically; omitting estimation error from ﬁnite samples):
[Equation]
where:
d H ∆ H ( p x , ˜ p x ) :=
[Equation] [Equation]
[Equation]
Here d H ∆ H ( p x , ˜ p x ) is the H ∆ H -divergence measuring the difference between p ( x ) and ˜ p ( x ) under the discriminative efﬁcacy of the labeling function family H , and λ H is the ideal joint risk achieved by H .
Long et al.
(2015) give a similar bound in terms of maximum mean discrepancy (MMD)
d K in place of d H ∆ H .
For successful adaptation, DA often makes the covariate shift assumption :
˜ h ∗ =
h ∗ (or p ( y | x ) =
˜ p ( y | x ) ) on supp( p x , ˜ p x ) :
= supp( p x ) ∪ supp(˜ p x ) .
DA-DIR DA based on learning domain-invariant representations (DA-DIR)
(Pan et al., 2010; Baktashmotlagh et al., 2013; Long et al., 2015; Ganin et al., 2016) aims to learn a deterministic representation extractor η : X → S to some representation space S , in order to achieve a domain-invariant representation (DIR): p ( s ) =
˜ p
( s ) , where p ( s ) :
=
η # [ p x ]( s ) and ˜ p ( s ) :
=
η # [˜ p x ]( s ) are the representation distributions on the two domains.
The motivation is that, if DIR is achieved, then the distribution difference term in bound Eq.
(43) or Eq.
(44) diminishes, thus the bound is hopefully tighter on the representation space S than on the original data space X , so minimizing the source risk is more effective to minimizing the target risk.
Let g : S → Y be a labeling function on the representation space.
The end-to-end labeling function is effectively h
= g ◦ η .
The typical objective for DA-DIR thus combines the two desiderata:
[Equation] [Equation]
p
[Equation]
) , where d ( · , · ) is a metric or discrepancy ( d ( q, p ) =
⇐⇒ q = p ) on distributions, and E and G are the hypothesis spaces for η and g , respectively.
For the existence of the solution of this problem, it is often assumed stronger that there exist η ∗ ∈ E and g ∗ ∈ G such that η ∗ # [ p x ]
= η ∗ # [˜ p x ] and R ( g ∗ ◦ η ∗ )
=
R ( h ∗ ) .
Assumption 3 of Johansson et al.
(2019) further assumes covariate shift and that g ∗ ◦ η ∗ =
h ∗ on supp( p x , ˜ p
x ) ; that is, there exist η ∗ ∈ E and g ∗ ∈ G such that η ∗
# [ p x ] =
η ∗ # [˜ p x ] and g ∗ ◦ η ∗ =
h ∗ =
˜ h ∗ on supp( p x , ˜ p x ) .
They also mention that this is not guaranteed to hold in practice.
Problems of DA-DIR Johansson et al.
; Zhao et al.
(2019) give examples where even under as strong an assumption as Assumption 3 of Johansson et al.
( i.e. , covariate shift and a strong existence assumption), the two desiderata of DA-DIR ( i.e. , minimal source risk R ( g ◦ η )
=
R ( h ∗ ) and DIR η # [ p x ] =
η # [˜ p x ] ) still allow the bounds to be uselessly loose and the target risk
˜ R ( g ◦ η ) to take its worst value (particularly, the two desiderata cannot guarantee η = η ∗ or g = g ∗ or g ◦ η = h ∗ =
˜ h ∗ on supp( p x , ˜ p x ) ).
This is essentially an identiﬁability problem.
The examples do not contradict existing DA bounds.
Consider a given representation extractor η .
(1) Under Eq.
Applying the bound on the representation space S gives:
[Equation] [Equation]
where g ∗ η and ˜ g ∗ η are the optimal labeling functions on top of the representation extractor η .
In the covariate shift case, DIR η # [ p x ] =
η # [˜ p x ] and minimal source risk R ( g ∗ η ◦ η )
=
R ( h ∗ ) are not sufﬁcient to guarantee g ∗ η = ˜
g ∗ η
(Ben-David et al., 2010b; Gong et al., 2016).
Johansson et al.
(2019) argue that they are still not sufﬁcient even under their Assumption 3.
In both examples by Johansson et al.
; Zhao et al.
(2019), the considered η , although achieving both desiderata, is not η ∗ , and this η even renders different optimal g ’s:
g ∗ η (cid:54) =
˜
g ∗ η .
Johansson et al.
(2019) claim that it is necessary to require η to be invertible to make g ∗ η = ˜
g ∗ η , and develop a bound that explicitly shows the effect of the invertibility of η .
The η in the examples is not invertible.
(2) Under Eq.
Applying the bound on the representation space S gives:
[Equation]
where p s,y :
= ( η, id y )
# [ p x,y ] with id y : ( x, y ) (cid:55)→ y and similarly for ˜ p s,y .
Note that
E p ( s,y )
[ (cid:96) ( g ( s ) , y )]
=
E p ( x,y )
[ (cid:96) ( g ( η ( x ) , y ))]
=
R ( g ◦ η ) , so the last term on the r.h.s becomes: inf g ∈G (cid:104)
˜ R ( g ◦ η ) + R ( g ◦ η ) (cid:105) =
λ G◦ η , where G ◦ η :=
{ g ◦ η : g ∈ G} .
So the bound becomes:
[Equation]
This result is shown by Johansson et al.
They argue that ﬁnding η that achieves DIR and minimal training risk cannot guarantee a tighter bound since the last term λ G◦ η may be very large.
In both examples by Johansson et al.
; Zhao et al.
(2019), supp( p x ) ∩ supp(˜ p x ) = ∅ .
It may cause the problem that g ◦ η can be very different from h ∗ on supp(˜ p x ) even when R ( g ◦ η ) =
R ( h ∗ ) .
The developed bound by Johansson et al.
(2019) also explicitly shows the role of support overlap, thus can be called a support-invertibility bound.
They also give an example to show that
DIR (particularly implemented by minimizing MMD) is not necessary (“sometimes too strict”) for learning the shared/invariant p ( y | x ) .
(3) A third bound.
Zhao et al.
(2019) develop another bound for binary classiﬁcation, where Y :
= { 0 , 1 } and R ( h ) :
= E p ( x ) [ | h ∗ ( x ) − h ( x ) | ] .
Denote d JS ( p, q ) :
= (cid:112) JS( p, q ) as the JS distance (Endres & Schindelin, 2003), where JS( p, q ) is the JS divergence.
It is bounded: 0 (cid:54) d JS ( p, q ) (cid:54) 1 .
It is shown that (Zhao et al., 2019, Lemma 4.8):
[Equation]
If d JS
[Equation]
p y , ˜ p
y
[Equation]
( η # [ p x ] , η # [˜ p x ])
, it is shown that (Zhao et al., 2019, Theorem 4.3):
[Equation]
(47) or when the two domains are allowed to have their own representation-level labeling functions g and
˜ g
(Zhao et al., 2019, Corollary 4.1),
[Equation]
So when p ( y ) (cid:54) = ˜ p
( y ) , we have d JS ( p y , ˜ p
y )
> 0 , so DIR that minimizes d JS ( η # [ p x ] , η
# [˜ p x ]) becomes harmful to minimizing the target risk ˜ R (˜ g ◦ η ) .
Arjovsky et al.
(2019) point out that in the covariate shift case, achieving a DIR p ( s ) =
˜ p ( s ) implies p ( y ) =
˜ p
( y ) (since p ( s ) =
˜ p
( s ) and p ( y | s ) =
˜ p ( y | s ) ).
This may not hold in practice.
When it does not hold, the bound above shows that DIR can limit prediction accuracy.
Comparison with CSG Existing bounds Eqs.
(43, 44, 45, 46) relate the source and target risks of a general and common labeling function h ∈ H , i.e. , ˜ R ( h ) − R ( h ) , which is for bounding an objective; while our bound Eq.
(36) relates the target risks of the optimal labeling functions on the source h ∗ and target ˜
h ∗ domains, i.e. , (cid:12) (cid:12) (cid:12) ˜
R ( h ∗ ) − ˜ R
( ˜ h ∗ ) (cid:12) (cid:12) (cid:12) or (cid:12) (cid:12) (cid:12) ˜
R ( h (cid:48) ∗ ) − ˜ R
( ˜ h ∗ ) (cid:12) (cid:12) (cid:12) , which measures the risk leap of the best source labeling function on the target domain.
After adaptation, the prediction analysis (Eq. (42)) shows that CSG-DA achieves the optimal labeling function on the target domain in the inﬁnite data limit.
For Eq.
(47), we are not minimizing d JS ( η # [ p ( x )] , η # [˜ p ( x )]) , so our method is good under that view.
In fact, in our model the representation distributions on the two domains are p ( s ) =
(cid:82) p ( s, v ) d v and ˜ p
( s ) =
(cid:82) ˜ p ( s, v ) d v (replacing η # [ p ( x )] and η # [˜ p ( x )] ).
We allow p ( s, v ) (cid:54) =
˜ p
( s, v ) of course and do not seek to match them.
Essentially, we do not rely on the invariance of p ( s | x ) and p ( y | x ) , or η ∗ and h ∗ , but the invariance of p ( x | s, v ) in the other direction (generative direction).
This thus allows p ( s | x ) (cid:54) =
˜ p
( s | x ) and p ( y | x ) (cid:54) =
˜ p ( y | x ) , or η ∗ (cid:54) =
˜ η ∗ and h ∗ (cid:54) =
˜ h ∗ , so we rely on an assumption different from the idea of all the bounds above.
Since the data at hand is produced following a certain mechanism of nature anyway, the invariance in the generative direction p ( x | s, v ) is thus more plausible (see Section 3.2).
E M ETHODOLOGY D ETAILS E. D ERIVATION OF L EARNING O BJECTIVES
The Evidence Lower BOund (ELBO).
A common and effective approach to matching the data distribution p ∗ ( x, y ) is to maximize likelihood, that is to maximize E p ∗ ( x,y )
[log p ( x, y )] .
It is equivalent to minimizing KL( p ∗ ( x, y ) (cid:107) p ( x, y ))
(note that E p ∗ [log p ∗ ( x, y )] is a constant), so it drives p ( x, y ) towards p ∗ ( x, y ) .
But the likelihood function p ( x, y )
=
(cid:82) p ( s, v, x, y )
d s d v involves an intractable integration, which is hard to estimate and optimize.
To address this, the popular method of variational expectation-maximization (variational EM) introduces a tractable (has closed-form density function and easy to sample)
distribution q ( s, v | x, y ) of the latent variables given observed variables, and a lower bound of the likelihood function can be derived:
[Equation]
where the inequality follows Jensen’s inequality and the concavity of the log function.
The function
L q,p ( x, y ) is thus called Evidence Lower BOund (ELBO).
The tractable distribution q ( s, v | x, y ) is called variational distribution , and is commonly instantiated by a standalone model (from the generative model) called an inference model .
Moreover, we have:
[Equation]
so maximizing L q,p ( x, y ) w.r.t q is equivalent to (note that the r.h.s log p ( x, y ) is constant of q ) minimizing KL( q (cid:107) p ( s, v | x, y )) which drives q towards the true posterior ( i.e. , variational inference ), and once this is (perfectly) done, L q,p ( x, y ) becomes a lower bound of log p ( x, y ) that is tight at the current model p , so maximizing L q,p ( x, y )
w.r.t p effectively maximizes log p ( x, y ) , i.e. , serves as maximizing likelihood.
So the training objective becomes the expected ELBO, E p ∗ ( x,y )
[ L q,p ( x, y )] .
Optimizing it w.r.t q and p alternately drives p ( x, y ) towards p ∗ ( x, y ) and q ( s, v | x, y ) towards p ( s, v | x, y ) eventually.
The derivations and conclusions above hold for general latent variable models, with ( s, v ) representing the latent variables, and ( x, y ) observed variables (data variables).
Variational EM for CSG.
In the supervised case, the expected ELBO objective E p ∗ ( x,y )
[ L q,p ( x, y )] can also be understood as the conventional supervised learning loss, i.e. the cross entropy, regularized by a generative reconstruction term.
As explained in the main text (Section 4), after training, we only have the model p ( s, v, x, y ) and an approximation q ( s, v | x, y ) to the posterior p ( s, v | x, y ) , and prediction using p ( y | x ) is still intractable.
So we employ a tractable distribution q ( s, v, y | x ) to model the required variational distribution as q ( s, v | x, y )
=
q ( s, v, y | x ) /q
( y | x ) , where q ( y | x ) = (cid:82) q
( s, v
, y | x ) d s d v is the derived marginal distribution of y (we will show that it can be effectively estimated and sampled from).
With this instantiation, the expected ELBO becomes:
[Equation]
=
[Equation]
(cid:20)
[Equation]
y
[Equation]
x ) q ( y
[Equation]
log p ( s, v, x, y ) q
( s, v, y | x ) (cid:21) , which is Eq.
The ﬁrst term is the (negative) expected cross entropy loss, which drives the inference model (predictor) q ( y | x ) towards p ∗ ( y | x ) for p ∗ ( x ) -a.e.
x .
Once this is (perfectly) done, the second term becomes E p ∗ ( x ) E q ( s,v,y
|
x ) [log p ( s, v, x, y ) /q
( s, v, y | x )] which is the expected ELBO E p ∗ ( x )
[ L q ( s,v,y | x ) ,p ( x, y )] for q ( s, v, y | x ) .
It thus drives q ( s, v, y | x ) towards p ( s, v, y | x ) and p ( x ) towards p ∗ ( x ) .
It accounts for a regularization by ﬁtting the input distribution p ∗ ( x ) and align the inference model (predictor) with the generative model.
The target of q ( s, v, y | x ) , i.e. p ( s, v, y | x ) , adopts a factorization p ( s, v, y | x )
= p ( s, v | x ) p ( y | s ) due to the graphical structure (Fig. 1) of CSG ( i.e. , y ⊥⊥ ( x, v ) | s ).
The factor p ( y | s ) is known (the invariant causal mechanism to generate y in CSG), so we only need to employ an inference model q ( s, v | x ) for the intractable factor p ( s, v | x ) , so q ( s, v, y | x ) =
q ( s, v | x ) p ( y | s ) .
Using this relation, we can reformulate Eq.
(1) as:
[Equation]
which is Eq.
With this form of q ( s, v, y | x ) =
q ( s, v | x ) p ( y | s ) , we have q ( y | x ) =
E q ( s,v | x ) [ p ( y | s )] which can also be estimated and optimized using reparameterization.
For prediction, we can sample from the approximation q ( y | x ) instead of the intractable p ( y | x ) .
This can be done by ancestral sampling: ﬁrst sample ( s, v ) from q ( s, v | x ) , and then use the sampled s to sample y from p ( y | s ) .
The conclusions and methods can also be applied to general latent generative models for supervised learning, with ( s, v ) representing the latent variables.
When a model does not distinguish the two (groups of) latent factors s and v and treats them as one latent variable z
= ( s, v ) , following a similar deduction gives:
[Equation]
where q ( y | x )
=
E q ( z | x ) [ p ( y | z )] .
This is the conventional supervised variational auto-encoder (sVAE) baseline in our experiments.
Variational EM to learn CSG with independent prior (CSG-ind).
See the main text in Section 4.1 for motivation and basic methods.
Since the prior is the only difference between p ( s, v, x, y ) and p ⊥⊥ ( s, v, x, y ) , we have p ( s, v, x, y ) /p
⊥⊥ ( s, v, x, y )
=
p ( s, v ) /p ⊥⊥ ( s, v ) =
p ( s, v ) /p
( s ) p ( v ) =
p ( v | s ) /p
( v ) .
So p ( s, v, y | x ) = p ( v | s ) p ( v ) p ⊥⊥ ( x ) p ( x ) p ⊥⊥ ( s, v, y | x ) .
As explained, inference models now only need to approximate the posterior ( s, v )
| x .
Since p ( s, v, y | x ) = p ( s, v | x ) p ( y | s ) and p ⊥⊥ ( s, v, y | x ) = p ⊥⊥ ( s, v | x ) p ( y | s ) share the same p ( y | s ) factor, we have p ( s, v | x ) =
p ( v | s ) p ( v ) p ⊥⊥ ( x ) p ( x ) p ⊥⊥ ( s, v | x ) .
The variational distributions q ( s, v | x ) and q ⊥⊥ ( s, v | x ) target p ( s, v | x ) and p ⊥⊥ ( s, v | x ) respectively, so we can express the former with the latter:
[Equation]
Once q ⊥⊥ ( s, v | x ) achieves its goal, such represented q ( s, v | x ) also does so.
So we only need to construct an inference model for q ⊥⊥ ( s, v | x ) and optimize it.
With this representation, we have:
[Equation]
where π ( y | x ) :
=
E q ⊥⊥ ( s,v | x ) (cid:2) p ( v | s ) p ( v ) p ( y | s ) (cid:3) as in the main text, which can be estimated and optimized using the reparameterization of q ⊥⊥ ( s, v | x ) .
From Eq.
(2), the expected ELBO training objective can be reformulated as:
[Equation]
E
[Equation]
where in the second-last equality we have used the deﬁnition of π ( y | x ) .
This gives Eq.
Note that π ( y | x ) is not used in prediction, so there is no need to sample from it.
Prediction is done by ancestral sampling from q ⊥⊥ ( y | x ) , that is to ﬁrst sample from q ⊥⊥ ( s, v | x ) and then from p ( y | s ) .
Using this reformulation, we can train a CSG with independent prior even on data that manifests a correlated prior.
The objective Eq.
(5) on the training domain for domain adaptation can be derived similarly.
For numerical stability, we employ the log-sum-exp trick to estimate the expectations and compute the gradients.
E. I NSTANTIATING THE I NFERENCE M ODEL
Although motivated from learning a generative model, the method can be implemented using a general discriminative model (with hidden nodes) with causal behavior.
By parsing some of the hidden nodes as s and some others as v , a discriminative model could formalize a distribution q ( s, v, y | x ) , which implements the inference model and the generative mechanism p ( y | s ) .
The parsing mode is shown in Fig.
3, which is based on the following consideration.
(1) The graphical structure of CSG in Fig.
1 indicates that ( v, x ) ⊥⊥ y | s , so the hidden nodes for s should isolate y from v and x .
The model then factorizes the distribution as q ( s, v, y | x )
=
q ( s, v | x ) q
( y | s ) , and since the inference and generative models share the distribution on y | s (see the main text for explanation), we can thus use the component q ( y | s ) given by the discriminative model to implement the generative mechanism p ( y | s ) .
(2) The graphical structure in Fig.
1 also indicates that s (cid:54)⊥⊥ v | x due to the v-structure (collider) at x (“explain away”).
The component q ( s, v | x ) should embody this dependence, so the hidden nodes chosen as v should have an effect on those as s .
Note that the arrows in Fig.
3 represent computation directions but not causal directions.
We orient the computation direction v → s since all hidden nodes in a discriminative model eventually contribute to computing y .
After parsing, the discriminative model gives a mapping ( s, v ) =
η ( x ) .
We implement the distribution by 10 q ( s, v | x ) =
N ( s, v | η ( x ) , Σ q ) .
For all the three cases of CSG, CSG-ind and CSG-DA, only one inference model for ( s, v ) | x is required.
The component ( s, v ) | x of the discriminative model thus parameterizes q ⊥⊥ ( s, v | x ) and ˜ q ( s, v | x ) for CSG-ind and CSG-DA.
The expectations in all objectives (except for expectations over p ∗ which are estimated by averaging over data) are all under the respective ( s, v ) | x .
They can be estimated using η ( x ) by the reparameterization trick (Kingma & Welling, 2014), and the gradients can be back-propagated.
We need two more components beyond the discriminative model to implement the method, i.e. the prior p ( s, v ) and the generative mechanism p ( x | s, v ) .
The latter can be implemented using a generator or decoder architecture comparable to the component q ( s, v | x ) .
The prior can be commonly implemented using a multivariate Gaussian distribution, p ( s, v ) =
N (( sv ) | ( µ s µ v ) , Σ = (cid:0) Σ ss Σ sv Σ vs Σ ss (cid:1) ) .
We parameterize Σ via its Cholesky decomposition, Σ = LL (cid:62) , where L is a lower-triangular matrix with positive diagonals, which is in turn parameterized as L = (cid:0) L ss
M vs L vv (cid:1) with smaller lowertriangular matrices L ss and L vv and any matrix M vs .
Matrices L ss and L vv are parameterized by a summation of positive diagonals (guaranteed via an exponential map) and a lower-triangular (excluding diagonals) matrix.
The conditional distribution p ( v | s ) required by training CSG-ind is given by p ( v | s ) =
N ( v | µ v | s , Σ v | s ) , where µ v | s = µ v + M vs L − 1 ss
( s − µ s ) , Σ v | s =
L vv L (cid:62) vv (see e.g. ,
Bishop (2006)).
This prior does not imply a causal direction between s and v (the linear Gaussian case of Zhang & Hyv ¨ arinen (2009)) thus well serves as a prior for CSG.
F E XPERIMENT D ETAILS
We use a validation set from the training domain for hyperparameter selection, to avoid overﬁtting to the ﬁnite training-domain data samples.
The training and validation sets are constructed under a 80%-20% random split in each task.
We note that hyperparameter selection in OOD tasks is itself controversial and nontrivial, and it is still an active research direction (You et al., 2019).
It is argued that if a validation set from the test domain is available, a better choice would be to incorporate it in learning as the semi-supervised adaptation task, instead of using it just for validation.
As our methods are designed to ﬁt the training domain data and our theory shows guarantees under a good ﬁt of the training-domain data distribution, hyperparameter selection using a training-domain validation set is reasonable.
We align the scale of the CE term in the objectives of all methods, and tune the coefﬁcients of the
ELBOs to be their largest values that make the ﬁnal accuracy near 1 on the validation set, so that they wield the most power on the test domain while be faithful to explicit supervision.
The coefﬁcients are preferred to be large to well ﬁt p ∗ ( x ) (and ˜ p ∗ ( x ) for domain adaptation) to gain generalizability in the test domain, while they should not affect training accuracy, which is required for a good ﬁt of the training distribution.
The supervised variational auto-encoder (sVAE) baseline method is a counterpart of CSG that does not separate its latent variable z into s and v .
This means that all its latent variables in z directly ( i.e. , not mediated by s ) affect the output y .
It is learned by optimizing Eq.
(48) for OOD generalization, and adopts a similar method as CSG-DA for domain adaptation.
To align the model architecture for fair comparison, this means that the latent variable z of sVAE can only be taken as the latent variable s in CSG.
All the experiments are implemented in PyTorch.
F. S HIFTED MNIST
We use a multilayer perceptron (MLP) with sigmoid activation with 784(for x )-400-200(ﬁrstfor v )-50(for s or z )
-1(for y ) nodes in each layer for the inference model of generative methods, and use an MLP with 50(for s )
-(100(for v )+100)-400-784(for x ) nodes in each layer for their generative component p
( x | s, v ) .
We use a larger architecture with 784-600-300-75-1 nodes in each layer for discriminative methods to compensate additional parameters of generative methods.
For all the methods, we use a mini-batch of size 128 in each optimization step, and use the RMSprop optimizer (Tieleman & Hinton, 2012), with weight decay parameter 1 × 10 − 5 , and learning rate 1 × 10 − 3 for
OOD generalization and 3 × 10 − 4 for domain adaptation.
These hyperparameters are chosen and then ﬁxed, by running and then validating using CE and DANN.
For generative methods, we take the Gaussian variances of p ( x | s, v ) and q ( s, v | x ) as 0 .
The scale of the standard derivations of these conditional Gaussian distributions are chosen small to meet the intense causal mechanism assumption in our theory ( e.g. , in Theorem 5.4).
We train the models for 100 epochs when all the methods converge in terms of loss and training accuracy.
We align the scale of the CE term in the objectives of all methods, and scale the ELBO terms with the largest weight that makes training accuracy near 1 in OOD generalization.
We then ﬁx the tuned weight and scale the weight of adaptation terms in a similar way for domain adaptation.
Other parameters are tuned similarly.
For generative methods, the ELBO weight is 1 × 10 − 5 selected from { 1 , 3 }× 10 {− 6 , − 5 } ∪ 1 × 10 {− 2 , − 1 , 0 , 1 , 2 } , and the adaptation weights for sVAE-DA and CSG-DA are 1 × 10 − 2 selected from 1 × 10 { 0 , − 1 , − 2 , − 3 , − 4 } and 1 × 10 − 5 selected from 1 × 10 { 0 , − 1 , − 2 , − 3 , − 4 } ∪ { 1 , 3 } × 10 {− 5 , − 6 , − 7 , − 8 } .
For domain adaptation methods, the adaptation weight is 1 × 10 −except for CDAN which adopts 1 × 10 − 2 , all selected from 1 × 10 { 0 , − 1 , − 2 , − 3 , − 4 } .
For CNBB, we use regularization coefﬁcients 1 × 10 − 4 and 3 × 10 − 6 to regularize the sample weight and learned representation, and run 4 inner gradient descent iterations with learning rate 1 × 10 − 3 to optimize the sample weight.
These parameters are selected from a grid search where the range of the parameters are: { 1 , 3 } × 10 {− 2 , − 3 , − 4 } , { 1 , 3 } × 10 {− 4 , − 5 , − 6 } , { 4 , 8 } , 1 × 10 {− 1 , − 2 , − 3 } .
F. I MAGE CLEF-DA
We adopt the same setup as in Long et al.
We use the ResNet50 structure pretrained on
ImageNet as the backbone of the discriminative/inference model.
Input images are cropped and resized to shape (3 , 224 , 224) .
For CSG, we select the ﬁrst 128 dimensions of the bottleneck layer (the resized last fully connected layer of ResNet50, with output dimension 1024) as the variable v , and the output of a subsequent fully connected layer with output dimension 1024 as the variable s .
The output is produced by a linear layer built on s .
For generative methods ( i.e. , our methods and sVAE(-DA)), we construct an image decoder/generator that uses the DCGAN model (Radford et al., 2015) pretrained on Cifar10 as the backbone.
The pretrained DCGAN is adapted from the PyTorch-GAN-Zoo 11 .
The generator connects to the DCGAN backbone by an MLP layer to match DCGAN’s input dimension 120, and generates images of desired size (3 , 224 , 224) by appending to DCGAN’s output of size (3 , 64 , 64) with an transposed convolution layer with kernel size 4, stride size 4 and padding size 16.
Following Long et al.
(2018), we use a mini-batch of size 32 in each optimization step, and adopt the SGD optimizer with Nesterov momentum parameter 0 .
9 , weight decay parameter 5 × 10 − 4 , and a shrinking step size scheme with initial scale 1 × 10 − 3 , shrinking exponent 0 .
75 and per-datum coefﬁcient 6 .
25 × 10 − 6 .
For CSG methods, the Gaussian variances of p ( x | s, v ) and q ( s, v | x ) are taken as 0 . 1 and 3 . 0 , respectively.
The ELBO weight is 1 × 10 − 8 for CSG methods and 1 × 10 − 7 for sVAE, both selected from 1 × 10 {− 2 , − 4 , − 6 } ∪{ 1 , 3 }× 10 {− 7 , − 8 , − 9 , − 10 } .
The adaptation weights for sVAE-DA and CSG-DA are 1 × 10 − 8 for task C
→ P and 1 × 10 − 7 for task P
→
C , selected from the same range.
For CNBB, we use regularization coefﬁcients 1 × 10 − 6 and 3 × 10 − 6 to regularize the sample weight and learned representation, and run 4 inner gradient descent iterations with learning rate 1 × 10 − 4 to optimize the sample weight.
These parameters are selected from a grid search where the range of the parameters are: 1 × 10 {− 4 , − 5 , − 6 , − 7 } ∪ { 3 × 10 − 6 } , { 1 , 3 } × 10 {− 5 , − 6 , − 7 } , { 4 } , 1 × 10 {− 2 , − 3 , − 4 , − 5 } .
11 https://github.com/facebookresearch/pytorch_GAN_zoo