
Preprint
using generative modeling when there are confounders is challenging (Sauer & Geiger, 2021; Reddy
et al., 2022; Funke et al., 2022). As stated earlier, a classifier may rely on non-causal features to
make predictions in the presence of confounders (Sch¨
olkopf et al., 2021). Recent years have seen
a few efforts to handle the spurious correlations caused by confounding effects in observational
data (Tr¨
auble et al., 2021; Sauer & Geiger, 2021; Goel et al., 2021; Reddy et al., 2022). However,
these methods either make strong assumptions on the underlying causal generative process or require
strong supervision. In this paper, we study the adversarial effect of confounding in observational data
on a classifier’s performance and propose a mechanism to marginalize such effects when performing
data augmentation using counterfactual data. Counterfactual data generation provides a mechanism
to address such issues arising from confounding and building robust learning models without the
additional task of building complex generative models.
The causal generative processes considered throughout this paper are shown in Figure 1(a). We
assume that a set of generative factors (attributes) Z1, Z2, . . . , Zn(e.g., background, shape, texture)
and a label Y(e.g., cow)cause a real-world observation X(e.g., an image of a cow in a particular
background) through an unknown causal mechanism g(Peters et al., 2017b). To study the effects
of confounding, we consider Y, Z1, Z2, . . . , Znto be confounded by a set of confounding variables
C1, . . . , Cm(e.g., certain breeds of cows appear only in certain shapes or colors and appear only in
certain countries). Such causal generative processes have been considered earlier for other kinds of
tasks such as disentanglement Suter et al. (2019); Von K¨
ugelgen et al. (2021); Reddy et al. (2022).
The presence of confounding variables results in spurious correlations among generative factors in
the observed data, whose effect we aim to remove using counterfactual data augmentation.
Figure 1: (a) causal data generating process con-
sidered in this paper (CONIC = Ours); (b) causal
data generating process considered in CGN (Sauer
& Geiger, 2021).
A related recent effort by (Sauer & Geiger,
2021) proposes Counterfactual Generative Net-
works (CGN) to address this problem using
a data augmentation approach. This work as-
sumes each image to be composed of three
Independent Causal Mechanisms (ICMs) (Pe-
ters et al., 2017a) responsible for three fixed
factors of variations: shape, texture, and back-
ground (as represented by Z1, Z2, and Z3in
Figure 1(b). This work then trains a generative
model that learns three ICMs for shape, texture,
and background separately, and combines them
in a deterministic fashion to generate observa-
tions. Once the ICMs are learned, sampling im-
ages by making interventions to these mecha-
nisms give counterfactual data that can be used along with training data to improve classification
results. However, fixing the architecture to specific number and types of mechanisms (shape, tex-
ture, background) is not generalizable, and may not directly be applicable to settings where the
number of underlying generative factors is unknown. It is also computationally expensive to train
different generative models for each aspect of an image such as texture,shape or background.
In this work, we begin with quantifying confounding in observational data that is generated by an
underlying causal graph (more general than considered by CGN) of the form shown in Figure 1(a).
We then provide a counterfactual data augmentation methodology called CONIC (COunterfactual
geNeratIon under Confounding). We hypothesize that the counterfactual images generated using the
proposed CONIC method provide a mechanism to marginalize the causal mechanisms responsible
for spurious correlations (i.e., causal arrows from Cito Zjfor some i, j). We take a generative mod-
eling approach and propose a neural network architecture based on conditional CycleGAN (Zhu
et al., 2017) to generate counterfactual images. The proposed architecture improves CycleGAN’s
ability to generate quality counterfactual images under confounded data by adding additional con-
trastive losses to distinguish between fixed and modified features, while learning the cross domain
translations. To demonstrate the usefulness of such counterfactual images, we consider classification
as a downstream task and study the performance of various models on unconfounded test set. Our
key contributions include:
• We formally quantify confounding in causal generative processes of the form in Fig 1(a), and
study the relationship between correlation and confounding between any pair of generative factors.
2