# AptSim2Real: Approximately-Paired Sim-to-Real Image Translation

Charles Y Zhang∗
University of Waterloo, Canada
<EMAIL_ADDRESS>Ashish Shrivastava
Cruise LLC, United States
<EMAIL_ADDRESS>∗Work done during internship at Cruise LLC.

###### Abstract

Advancements in graphics technology has increased the use of simulated data
for training machine learning models. However, the simulated data often
differs from real-world data, creating a distribution gap that can decrease
the efficacy of models trained on simulation data in real-world applications.
To mitigate this gap, sim-to-real domain transfer modifies simulated images to
better match real-world data, enabling the effective use of simulation data in
model training.

Sim-to-real transfer utilizes image translation methods, which are divided
into two main categories: paired and unpaired image-to-image translation.
Paired image translation requires a perfect pixel match, making it difficult
to apply in practice due to the lack of pixel-wise correspondence between
simulation and real-world data. Unpaired image translation, while more
suitable for sim-to-real transfer, is still challenging to learn for complex
natural scenes. To address these challenges, we propose a third category:
approximately-paired sim-to-real translation, where the source and target
images do not need to be exactly paired. Our approximately-paired method,
AptSim2Real, exploits the fact that simulators can generate scenes loosely
resembling real-world scenes in terms of lighting, environment, and
composition. Our novel training strategy results in significant qualitative
and quantitative improvements, with up to a $24\%$ improvement in FID score
compared to the state-of-the-art unpaired image-translation methods.

##  I Introduction

Recent improvements in simulation technology have made it a vital component in
the training and validation of machine learning models for robotics
applications, especially for tasks where real world data is costly or
impossible to collect. For example, OpenAI demonstrated that models trained
only in simulation can be used to solve a Rubik’s cube with a robotic hand
[1], researchers at ETH Zurich were able to learn complex quadrupedal
locomotion using simulation data [2], and Microsoft recently released a
simulation dataset for learning localization models for drones [3]. In
particular, training visual detection and understanding algorithms on
synthetic image data can produce immense gains for a critical part of a
robotic system. Previous studies have shown that enhancing the quality of
synthetic data using sim-to-real domain adaptation techniques improves the
performance of downstream models on real data. ([4, 5, 6]).

Current research in sim-to-real domain adaptation focuses on two main
approaches: paired image translation and unpaired image translation. Paired
methods train a model to translate images between source and target domains
where each source image has a corresponding paired target image with pixel-
wise correspondences. This approach results in high accuracy, but paired data
is often difficult and expensive to obtain. In contrast, the unpaired image
translation methods train a model with no correspondences between source and
target images. This approach is more challenging but benefits from a higher
availability of data.

Figure 1:  AptSim2Real differs from traditional paired or unpaired methods by
rendering simulated images with similar camera pose, background, lighting, and
scene composition to real images, resulting in an approximate pairing between
the two. The approximately-paired samples enable the use of stronger
supervision compared to unpaired methods during the learning process, while
still retaining data scalability, a challenge faced by traditional paired
methods.

In this paper, we introduce a novel approach to sim-to-real domain transfer
called _a_ pproximately-_p_ aired image _t_ ranslation (AptSim2Real). Unlike
paired or unpaired methods, this approach utilizes “approximately-paired” data
that shares contextual information such as camera pose, map location, scene
composition, and lighting while allowing some variations in assets, textures,
appearance, and shapes (see Figure 1). For each real image, we use metadata
and label information to generate a corresponding simulated image in a
graphics engine. Simulated images mirror the camera pose of real images and
are generated using assets and models similar to those in the real image, a
procedurally generated background, and matching lighting. This approach allows
for scalable data generation, like unpaired translation, while additionally
providing some pairing between the source and target images that the model can
take advantage of. We demonstrate that leveraging approximate pairings between
source and target domain samples can lead to a superior model architecture and
better performance compared to unpaired translation methods.

The goal of sim-to-real training is to mimic the real images as closely as
possible. Due to limitations of simulation technology, there is a significant
distribution gap between the simulated and real images. Our method bridges
this gap by exploiting approximately-paired data using style mixing [7].
During the training process, a style encoder network learns to encode the
“realism gap” between a simulated image and its corresponding approximately-
paired real image into a style difference feature. This style difference is
used as an additional input to a generator network to guide image translation
and improve the realism of the simulated image. While prior image translation
methods such as [6, 8, 9] encode the style difference within their parameters,
we take a different approach by presenting this difference as an additional
style input. This alternative strategy not only simplifies the translation
task but also provides greater flexibility and control over the style transfer
process. Note that approximate pairing between the simulated input image and
the generated image is crucial for computing the style difference and,
therefore, is central to our architecture design. Following are our main
contributions:

  * •

We propose approximately-paired image translation – a novel image translation
category for improving the realism of simulated images.

  * •

We propose a novel training strategy that leverages the approximate-pairing
between the source and target domain by utilizing the latest development in
GAN methods.

  * •

We conduct extensive qualitative and quantitative experiments to demonstrate
that approximately paired images translation can be used to produce results
significantly more realistic than existing unpaired methods.

##  II Related Works

Generative Adversarial Networks (GANs) [10] employ a critic, also known as a
discriminator, to differentiate between real and fake data inputs. GANs are
widely used in image translation, as training a generative model to fool the
critic (discriminator) has proven effective in closing distribution gaps. As
GAN methods have advanced ( [11, 12, 13, 14, 15, 16, 10, 17, 18, 19, 20, 21,
22]), the performance of image translation has also improved.

Paired image translation uses an input, typically in the form of a label such
as a semantic segmentation map or edge map, to generate a new output image
[23, 24, 25, 26, 27, 28]. Paired image translation uses pixel-wise
correspondences to jointly optimize an L1 loss between the predicted and
target images alongside an adversarial loss to achieve high accuracy.

Unpaired image translation lacks the pixel-wise correspondences of paired
image translation and instead utilizes alternative loss functions. For
example, SimGAN [6] regularizes the difference between the input and output of
the model, CycleGAN [9] optimizes for cycle-consistency, and CUT [8] maximizes
mutual information between the input and output of the generator. While other
methods have been proposed( [9, 8, 6, 29, 30]), CycleGAN and CUT remain
popular choices for unpaired image translation.

Combining paired and unpaired image translation has also been proposed for
datasets that have a mix of paired and unpaired images [31, 32]. In contrast,
our method does not rely on pixel-wise correspondences, generates
approximately-paired synthetic images through simulation, and leverages these
approximate pairings with state-of-the-art GAN techniques.

##  III Method

Figure 2: Architecture Overview. To leverage approximately-paired data,
AptSim2Real trains a style encoder, ${S}$, to extract a style code from the
approximately paired inputs. During training, we condition the generator,
${G}$, on the difference in input and target style. Given that the simulation
and real images are almost identical in content (as they are approximately-
paired), the difference in style features reflects the realism gap between the
images as any content feature information is cancelled. Content regularization
losses and pooling layers in the style encoder are employed to additionally
minimize content leakage. During inference, a real image with a similar style
as the sim input is selected from the training data as the target style
reference.

###  III-A Generating Approximately-paired Images

To learn a mapping $G:\boldsymbol{x}\rightarrow\boldsymbol{y}$ from simulated
images, $\boldsymbol{x}$, to real images, $\boldsymbol{y}$, we rely on
approximately-paired image pairs, $(\boldsymbol{x},\boldsymbol{y})$. Unlike
paired image translation [23], our pairs do not require pixel-wise alignment.
Instead, we sample a real image $\boldsymbol{y}_{i}$ from the real dataset and
generate a corresponding simulated image by utilizing the metadata and the
label information present in the image. Since our real images are collected
from sensors on an autonomous vehicle, we have a lot of metadata information
including pose of the sensor, time of day, location, lighting, and weather.
Using this contextual information, we render a simulated image
$\boldsymbol{x}_{i}$ in a graphics engine. We create a simulated version of
each real object by selecting the corresponding asset from an asset library.
Our selection process takes into account the label and contextual information
present in the real image. Given the pose information of the autonomous
vehicle, we select the background of the simulation scene from a procedurally
generated 3D map. The lighting and weather conditions are matched by selecting
an environment map that reflects these properties. Finally, we construct the
completed 3D scene in a graphics engine by combining the selected assets,
background, and lighting. This produces a simulated image that mirrors the
camera pose of the real image. We repeat this process for each real image and
generate a dataset of $N$ approximately-paired images
$\\{\boldsymbol{x}_{i},\boldsymbol{y}_{i}\\}_{i=1}^{N}$.

This scalable image generation process yields a dataset consisting of image
pairs that share attributes such as object size, type, background, scene
composition, lighting, and camera pose. Much like unpaired data,
Approximately-paired data is cheap and efficient to generate with minimal
manual labeling and curation needed. In contrast, paired data requires
substantial manual curation due to the need for pixel-level correspondence.
However, like paired data, approximately-paired data incorporates contextual
information that can guide the model and simplify the learning process,
resulting in faster training and improved accuracy.

During training, the model is fed with approximately paired images,
${\boldsymbol{x},\boldsymbol{y}}$. This pairing makes data generation more
straightforward and improves supervision. At inference, a style image
$\boldsymbol{y}$ possessing the desired style is selected from the training
dataset.

###  III-B Model details

SimApt2Real is formulated as a one-sided generative adversarial network [33]
and consists of a generator $G$, a style encoder $S$, and a discriminator $D$.
The goal of the network is to learn a generator $G$ which can take as input
simulated images $\boldsymbol{x}$ and generate realistic images reflecting the
style of the approximately-paired style image. The architecture leverages
approximately paired data to maximize its performance, as shown in the
overview in Figure 2.

Style encoder. The style encoder $S$ takes an image $\boldsymbol{x}$ as an
input and generates a style code $\boldsymbol{s}=S(\boldsymbol{x})$. Given the
approximately-paired style input $\boldsymbol{y}$, we compute the style
difference, $\triangle{\boldsymbol{s}}=S(\boldsymbol{y})-S(\boldsymbol{x})$.
The style difference is used as an additional input to the generator that
identifies what realism differences that must be corrected:

$\boldsymbol{\hat{y}}=G(\boldsymbol{x},\triangle\boldsymbol{s}).$

Approximate pairing is critical for the style encoder design as we assume that
the simulation and real images are almost identical in content, meaning that
the difference in style features will reflect solely the realism gap. Any
content-level feature differences will be cancelled when the style codes are
subtracted.

To prevent the generator from over-fitting to the style input during training,
we remove spatial content information from the style inpuet $\boldsymbol{y}$
by incorporating pooling layers in the style network. We use multiple content
losses between the input simulated image and the generated image to ensure
that the generated image accurately reflects the content of the input image.
These steps help to ensure that the generator is not solely focused on
replicating the style of the real images but is also generating content
accurate to the input image.

Generator. The generator $G$ consists of multiple ResNet blocks [34] and
translates an input simulated image $\boldsymbol{x}$ into a realistic output
image $\boldsymbol{\hat{y}}=G(\boldsymbol{x},\triangle\boldsymbol{s})$ guided
by the style difference, $\triangle\boldsymbol{s}$, which is a $d$-dimensional
learned latent code that represents the “realism gap” between the simulated
image and the corresponding approximately-paired style input. We “modulate”
and “demodulate” the weights of the convolution layers in the generator, $G$,
using this style difference vector, $\triangle\boldsymbol{s}$, similar to the
method proposed in [35]. For each convolution layer, a linear layer is used to
map the vector $\triangle\boldsymbol{s}$ so that the new dimension is same as
the number of input feature maps in the convolution layer. Let $s_{i}$ be the
$i^{\text{th}}$ element of the mapped style vector. The convolution weights
corresponding to the $i^{\text{th}}$ input feature map are “modulated” by
multiplying it with $s_{i}$. Each modulated convolution weight is then
“demodulated” to normalize the output feature map. These modified convolutions
are used to replace a typical instance norm in the generator [35] and allow us
to control the weights of a convolution given the style difference
$\triangle\boldsymbol{s}$. We refer readers to equations 1, 2, and 3 in [35]
for details.

Discriminator. The discriminator, $D$, is trained to distinguish between real
images, $\boldsymbol{y}$, and generated images, $\boldsymbol{\hat{y}}$, in a
manner similar to standard GAN approaches [21]. Following the approach in [6],
the discriminator is modeled with multiple convolution layers, producing a
feature map of a lower resolution than the input image. Each location in the
feature map corresponds to a patch in the input image, and the size of each
patch is determined by the size of the receptive field of the output features.
By classifying each location of the output feature map as real or fake, the
discriminator classifies each patch in the input.

###  III-C Training Losses

Following standard GAN methods, we alternate between solving the following two
optimization problems:

$\displaystyle\min_{D}\;\mathbb{E}_{\boldsymbol{x},\boldsymbol{y}}\left[(D(\boldsymbol{y})-1)^{2}+(D(G(\boldsymbol{x},\triangle\boldsymbol{s}))-0)^{2}\right],$
$\displaystyle\min_{S,G}\mathcal{L}_{total}(S,G).$

Here, we employ the least squares adversarial loss [21], where the
discriminator is trained to predict $0$ for generated images and $1$ for real
images. The total loss for optimizing the generator ($G$) and style encoder
($S$), $\mathcal{L}_{total}$, comprises of an adversarial loss aimed at
fooling the discriminator. Next, we specify the various components that make
up the total loss function.

Adversarial loss. The adversarial loss aims to deceive the discriminator into
classifying the generated images as real, meaning that the discriminator
should predict $1$ for the generated images. Given
$\triangle\boldsymbol{s}=S(\boldsymbol{y})-S(\boldsymbol{x})$,

$\displaystyle\mathcal{L}_{GAN}=\mathbb{E}_{\boldsymbol{x},\boldsymbol{y}}\left[(D(G(\boldsymbol{x},\triangle\boldsymbol{s}))-1)^{2}\right].$

Style Reconstruction loss. To ensure style similarity between the generated
images, $\hat{\boldsymbol{y}}$, and target images, $\boldsymbol{y}$, we
minimize the $\ell_{1}$ loss between the style representations of
$\hat{\boldsymbol{y}}$ and $\boldsymbol{y}$ as follows:

$\displaystyle\mathcal{L}_{sty}=\mathbb{E}_{\boldsymbol{y}}\left[\|S(\boldsymbol{y})-S(\hat{\boldsymbol{y}})\|_{1}\right].$

Note that the style encoder can learn to output a constant vector to minimize
this loss. To circumvent this issue, we utilize the BCE loss (explained below)
to distinguish between real image styles and simulated image styles.

Style classification (BCE) loss. The style encoder’s key property is to
differentiate the styles of approximately paired simulated and real images. To
enforce this, we use a binary cross-entropy (BCE) loss to separate the style
vectors of simulated and real images. We train a linear classifier that maps
the style vector to a scalar, producing $0$ for simulated style vectors and
$1$ for real style vectors. The linear classifier is represented by a $d\times
1$ matrix $W_{s}$. The style classification loss is defined as follows:

$\displaystyle\mathcal{L}_{bce}=\mathbb{E}_{\boldsymbol{x},\boldsymbol{y}}\left[(\log(f(W_{s}(S(\boldsymbol{y})))+\log(1-f(W_{s}(S(\boldsymbol{x}))\right],$

where $f(.)$ is a Sigmoid function: $f(x)=1/(1+e^{-x})$. For improved
stability and convergence during training, $W_{s}$ is pre-trained for a single
epoch and then fine-tuned with a lower learning rate in conjunction with the
other losses during the overall training process. We found that the BCE loss
and the style reconstruction loss are sufficient to capture the style
differences between simulation and real images and that the style vectors are
not ignored by the generator model.

Content NCE loss. We leverage PatchNCE loss [8] to enforce content similarity
between $\boldsymbol{x}$ and $\hat{\boldsymbol{y}}$. Our generator consists of
an encoder and a decoder component, i.e.
$G(\boldsymbol{x},\triangle\boldsymbol{s})=G_{dec}(G_{enc}(\boldsymbol{x},\triangle\boldsymbol{s}))$.
Using $G_{enc}$, we compute the encoded feature maps for the input image,
$\boldsymbol{x}_{enc}$, and the generated image, $\hat{\boldsymbol{y}}_{enc}$,
as follows:
$\boldsymbol{x}_{enc}=G_{enc}(\boldsymbol{x},S(\boldsymbol{y})-S(\boldsymbol{x}))$
and
$\hat{\boldsymbol{y}}_{enc}=G_{enc}(\hat{\boldsymbol{y}},S(\boldsymbol{y})-S(\hat{\boldsymbol{y}}))$.
Next, we sample the encoded feature vectors $\hat{\boldsymbol{v}}$ from the
feature map $\hat{\boldsymbol{y}}_{enc}$ and the corresponding positive and
negative feature vectors, $\boldsymbol{v}^{+}$ and $\boldsymbol{v}^{-}$, from
the simulated feature map $\boldsymbol{x}_{enc}$. Note that
$\boldsymbol{v}^{+}$ and $\hat{\boldsymbol{v}}$ correspond to the same spatial
location while $\boldsymbol{v}^{-}$ and $\hat{\boldsymbol{v}}$ correspond to
different spatial locations in the feature map.

To be precise, we first randomly sample $n$ indices from the generated feature
map, $\hat{\boldsymbol{y}}$. Let this set of indices be represented as
$K=\\{k_{1},\dots,k_{n}\\}$. For each spatial location $k\in K$, we sample
$\hat{\boldsymbol{v}}_{k}=\hat{\boldsymbol{y}}_{enc}(k)$, positive feature
${\boldsymbol{v}}^{+}_{k}=\hat{\boldsymbol{x}}_{enc}(k)$, negative feature
${\boldsymbol{v}}^{-}_{k}=\hat{\boldsymbol{x}}_{enc}(m)$ where $m\in K$ and
$m\neq k$. In all our experiments, we set $n=256$. Using the triplet
$(\hat{\boldsymbol{v}_{k}},{\boldsymbol{v}_{k}}^{+},{\boldsymbol{v}_{k}}^{-})$,
the NCE loss is defined as follows:

$\displaystyle\ell_{nce}^{(k)}=-\log\left[\frac{\exp(\hat{\boldsymbol{v}_{k}}\cdot{\boldsymbol{v}_{k}}^{+}/\tau)}{\exp(\hat{\boldsymbol{v}_{k}}\cdot{\boldsymbol{v}_{k}}^{+}/\tau+\sum_{n=1}^{N}\exp(\hat{\boldsymbol{v}_{k}}\cdot{\boldsymbol{v}_{k}}^{-}/\tau))}\right],$
$\displaystyle\mathcal{L}_{NCE}=\mathbb{E}_{\boldsymbol{x},\boldsymbol{y}}\left[\sum_{k\in
K}\ell_{nce}^{(k)}\right],$

where the sum is over all the features sampled from an image (i.e.
$(\hat{\boldsymbol{v}},{\boldsymbol{v}}^{+},{\boldsymbol{v}}^{-})$ triplets).

Content identity loss. Since we modify the input image $\boldsymbol{x}$ using
the style difference, a zero style difference should result in no modification
to the input. To ensure this identity, we add an $\ell_{1}$ loss between the
input image and the generated image with a zero style difference, expressed as
follows:

$\mathcal{L}_{idt}=\mathbb{E}_{\boldsymbol{x}}\left[\left\|G(\boldsymbol{x},\boldsymbol{0})-\boldsymbol{x}\right\|_{1}\right].$

Content luminance loss. This loss function aims to preserve the content of the
image, such as object locations, shapes, and edges. A naive approach to
preserve the content would be to make sure that the luminance component of the
simulated and generated images is identical. However, this constraint would
prevent the model from making changes to style properties that are dependent
on luminance, such as noise, overall brightness, and contrast. To overcome
this limitation, the difference between normalized luminance patches of size
16x16 is minimized, as described below:

$\displaystyle\mathcal{L}_{lum}=\mathbb{E}_{\boldsymbol{x},\boldsymbol{y}}\Bigg{[}\left\|\frac{\bar{L}_{\boldsymbol{x}}-\mu(\bar{L}_{\boldsymbol{x}})}{\sigma(\bar{L}_{\boldsymbol{x}})}-\frac{\bar{L}_{\hat{\boldsymbol{y}}}-\mu(\bar{L}_{\hat{\boldsymbol{y}}})}{\sigma(\bar{L}_{\hat{\boldsymbol{y}}})}\right\|_{1}\Bigg{]},$

where the luminance of an RGB image, $\boldsymbol{x}$, is calculated as a
weighted combination of its red, green, and blue channels, with
$L_{\boldsymbol{x}}=0.299R_{\boldsymbol{x}}+0.587G_{\boldsymbol{x}}+0.114B_{\boldsymbol{x}}$.
$\bar{L}_{\boldsymbol{x}}$ (or $\bar{L}_{\boldsymbol{y}}$ ) is output of the
$16\times 16$ average pooling operation with a stride of $16$ on the input
luminance $L_{\boldsymbol{x}}$ (or the generated luminance
$L_{\boldsymbol{y}}$). The $\mu(\cdot)$ and $\sigma(\cdot)$ denote the mean
and the standard deviation functions, respectively.

Total loss. We sum all the above losses for $S$ and $G$ with the following
combination weights,

$\displaystyle\mathcal{L}_{total}(S,G)=$
$\displaystyle\mathcal{L}_{GAN}+\lambda^{cls}\mathcal{L}_{bce}+\lambda^{sty}\mathcal{L}_{sty}$
$\displaystyle+\lambda^{nce}\mathcal{L}_{nce}+\lambda^{idt}\mathcal{L}_{idt}+\lambda^{lum}\mathcal{L}_{lum}.$

In all our experiments, we set
$\lambda^{cls}=1.0,\lambda^{sty}=1.0,\lambda^{nce}=0.5,\lambda^{idt}=0.5,\lambda^{lum}=0.1$.

Note on approximate-pairing. It is worth noting that the computation of style
difference, $\triangle\boldsymbol{s}$, assumes that majority of the content in
the simulated input is closely matched with the content in the real style
input. If the input is not approximately-paired, then the computed
$\triangle\boldsymbol{s}$ would not only capture the style difference but also
the content difference. Moreover, using approximately-paired data allows for
generated and approximately-paired real samples to be included in the same
mini-batch for the discriminator training, which enables the adversarial loss
to better focus on style differences and encourage the generator to produce
outputs that more closely match the target style.

##  IV Experiments

Figure 3:  Qualitative results. The left column in the figure depicts the
simulation images, which exhibit several subtle domain gaps in terms of
foliage, road, contrast, sharpness, etc., compared to randomly selected real
images in the right column. These real images serve as the unpaired style
input during inference. Our proposed approach, depicted in the middle column,
is capable of effectively bridging the distribution gap and enhancing the
realism of the simulated images. The results demonstrate the ability of the
AptSim2Real method to bridge the distribution gap and improve the realism of
the simulated images.  Figure 4: Sim style vs real style input. Examples of
generated image using a simulation style image (center) and a real style image
(right). By modifying the style code, we are able to control the style of the
generated image. Figure 5:  Comparisons between the proposed AptSim2Real
method and other existing approaches such as CycleGAN [9] and CUT [8] are
shown in the figure above. We trained the baseline methods with multiple sets
of hyper-parameters, and here we are presenting the best results we could
obtain. The results produced by CycleGAN (left column) and CUT (middle column)
exhibit multiple artifacts. For instance, the first row shows high intensity
artifacts around the traffic light from both CycleGAN and CUT. CycleGAN’s
generated images also exhibit a noticeable “checkerboard” pattern artifact,
most noticeable in the blue car on the second row. CUT results show blurry
foliage, as demonstrated in the second row. Moreover, the road and objects are
also blurrier in the baseline methods. In contrast, our proposed AptSim2Real
method, shown in the right column, reduces these artifacts significantly,
resulting in much more realistic images. This is also reflected in our
quantitative results, which demonstrate the effectiveness of the AptSim2Real
method over the other existing approaches.

###  IV-A Experimental Setup

Dataset. The model was trained on a dataset of $\approx 100,000$ real images
of outdoor road scenes collected by autonomous vehicles driving in the city of
San Francisco. The vehicle contains multiple cameras with a 360-degree view of
the scene. The dataset was labeled with a combination of both automated and
human-verified labeling methods, providing rich 3D attributes such as
positions of signs, lights, pedestrians, vehicles, and other objects. The
simulator ingests these real scenes and a procedurally generated 3D map of the
city to render high-quality simulation scenes that closely resemble the real-
world scenes.

Training setup. Following the standard GAN training process, the generator and
discriminator are alternately trained on mini-batches of training samples.
Unlike other unpaired image translation methods that randomly select samples
from both domains, our method prepares batches such that they contain
corresponding approximately-paired image pairs. Our generator is a fully-
convolutional network, can be trained on random smaller crops of images (size
$256\times 256$), and can be applied to images of any resolution during
inference.

Evaluation Setup. Our aim is to evaluate the effectiveness of our method
through a test dataset composed of $2000$ pairs of simulated and corresponding
approximately-paired images, ($\boldsymbol{x}$, $\boldsymbol{y}$), that were
not utilized during training. To avoid giving a night-time style image to the
daytime simulated input, we limit our selection to those images that closely
match the time of day depicted in the simulated input. The real images,
$\boldsymbol{y}$, are only used as a comparison to gauge the generated quality
and not as a style input. This is because in practical applications, we do not
have access to the corresponding real images for each simulated image during
inference. During inference, we randomly sample a real image from the training
set ($\boldsymbol{y^{\prime}}$) to serve as the style input. Given a simulated
image $\boldsymbol{x}$ from the test dataset and a randomly selected style
image $\boldsymbol{y^{\prime}}$, we generate
$\boldsymbol{\hat{y}}=G(\boldsymbol{x},S(\boldsymbol{y^{\prime}})-S(\boldsymbol{x}))$.
We compare only with the unpaired method, because paired-methods are not
applicable due to lack of pixel-wise correspondence.

###  IV-B Qualitative Results

To evaluate the effectiveness of our method, we visually analyzed multiple
randomly selected examples as depicted in Figure 3. The comparison of the
images in the middle column with the real images in the third column
demonstrates the ability of our approach to accurately capture high-resolution
details and variations in noise, texture, and color. The proposed method not
only improves the overall realism of the scene, but it particularly enhances
the realism of foliage, concrete and asphalt textures, as well as the
reflections on vehicles.

Additionally, our method is able to reduce image artifacts common in GAN
architectures by leveraging approximately paired data. Figure 5 shows a
comparison of CycleGAN (left), CUT (middle), and APT (right) images. We
observed that both the CUT and CycleGAN methods suffer from several visual
artifacts such as the presence of checkerboard patterns, traffic light
distortions, and the “Tear Drop Artifact” [35]. In contrast, the AptSim2Real
method exhibits a significantly reduced occurrence of these artifacts,
resulting in a more visually appealing and realistic output.

We also validate that the style input is not ignored by the generator. Figure
4 displays an example output with a simulation style input and a real style
input. It is noteworthy that when the input style corresponds to a simulated
image, the output appears less realistic in comparison to an input style based
on a real image.

###  IV-C Quantitative Comparisons to Baselines

To evaluate the performance of our model against previous baseline works, we
use Fréchet Inception Distance (FID) scores as a metric. FID scores measure
the distribution similarity of the intermediate features produced when the
real and generated images are processed by the InceptionV3 image network. A
lower FID score indicates that the generated images are more realistic, as the
feature map distributions of the generated and real images are more alike.

Table I demonstrates the effectiveness of AptSim2Real compared to two state-
of-the-art methods: CycleGAN[9] and CUT[8]. As shown in Table I, the existing
unpaired image translation methods are unable to significantly improve the
image quality. We observe in our qualitative experiments that this is mainly
because of artifacts introduced by the models when trained and evaluated on
our complex dataset. We note that the FID score of the baseline methods is
comparable to that of the original simulated images. However, this similarity
can be attributed to the introduction of artifacts by these methods, as
demonstrated by our qualitative results in Figure 5. It is crucial to avoid
artifacts when generating synthetic data for downstream model training,
because these models can overfit to artifacts and fail to generalize, leading
to poor performance in real-world scenarios. Our model improves the FID score
by more than $24\%$ when compared to unpaired methods. We also compute the FID
score between two different sets of real images to find the lower bound on FID
for our datasets. The FID score between two sets of real images is $6.6$,
which means our method is $35\%$ closer to real images than the baseline
simulation.

TABLE I:  FID score of the compared methods Method | FID score (lower is better)
---|---
Unmodified Sim images | $23.4$
CycleGAN | $24.7$
CUT | $23.3$
AptSim2Real | $\mathbf{17.6}$

###  IV-D Other Improvements

While we propose a specific novel architecture that improves on baselines by
leveraging approximately paired data, GANs and image-to-image translation are
constantly improving through newer architectures and more stable training
strategies. Approximately-paired data can be leveraged in a variety of ways to
improve performance independent of specific network design choices.

Projected GANs. To further improve our results, we conducted supplementary
experiments utilizing Projected GANs [36]. In these experiments, the
adversarial loss was calculated on image features extracted from the
activations of the first encoding layer of a pre-trained object detection
model, rather than on the raw RGB image. This approach resulted in a
noticeable improvement in FID score, which decreased to $16.96$, representing
a relative improvement of $4\%$.

Multi-Scale Discriminators. In our method, features were extracted from the
discriminator at multiple resolutions $(64\times 64,32\times 32,16\times 16)$
and the GAN loss was computed at each of these resolutions. Unlike traditional
approaches that employ separate discriminators for each scale, we sample
intermediate feature maps from a single discriminator to increase training
efficiency.

###  IV-E Additional Training Details

The model was trained for a maximum of $100,000$ iterations with a batch size
of $24$. To ensure stability during the training process, one-sided label
smoothing was applied to the adversarial loss, as described in [37]. The ADAM
optimizer [38] was utilized with beta values of $\beta_{1}=0.5$ and
$\beta_{2}=0.99$, and a learning rate of $1e-4$. The learning rate remained
constant for $20,000$ iterations and then decreased linearly until it reached
zero. Before training the generator and discriminator, the style encoder was
pre-trained for one epoch using only the style classification loss with
$\lambda^{bce}=1.0$. Afterwards, the generator and the discriminator were then
trained $\lambda^{bce}=0.01$. For evaluation, we calculated the exponential
moving average of the model parameters for both the generator and style
encoder, as suggested in [39].

TABLE II:  Ablation study of AptSim2Real Method | FID score (lower is better)
---|---
AptSim2Real | $\mathbf{17.6}$
Removing L1 identity loss | $19.1$
Removing Luminance loss | $19.2$
AptSim2Real with Unpaired Data | $19.5$

###  IV-F Ablation Study

The ablation study in Table II show that identity loss helps the model to
explicitly capture style information using the style encoder and preventing it
from ignoring the style input. Moreover, we found that the luminance loss
effectively reduces the artifacts that are commonly encountered in GAN-based
image-to-image networks such as CUT and CycleGAN. By enforcing consistency in
the average relative luminance between the input and output images, we reduce
the bright spot artifacts that would otherwise cause a large difference in
average luminance. Our experiments also reveal that training AptSim2Real on
unpaired data results in a decrease in generated image quality, leading to a
relative increase of $10\%$ in the FID score. Similarly, when training CUT
with approximately paired data, we observed a drop in the FID score, resulting
in an FID score of $19.1$. These results emphasize the importance of
approximately-paired data for achieving high-quality image generation results.

##  V Conclusion

We introduced a new category of image-to-image translation that can operate
with approximately-paired images, making it a practical solution for sim-to-
real applications. Our proposed architecture takes advantage of this
approximately-paired data to produce better results compared to unpaired
translation methods. Our approach integrates the latest advances in GANs and
employs multiple loss functions, including a novel luminance loss, to
effectively overcome the challenges of sim-to-real transfer and bridge the
realism gap.

Acknowledgement: We are grateful to our colleagues Surya Dwarakanath, Luyu
Yang, Abhishek Sharma, Ambrish Tyagi, Zhao Chen, and Yuning Chai for their
unwavering support and valuable suggestions.

## References

  * [1] I. Akkaya _et al._ , “Solving rubik’s cube with a robot hand,” _arXiv preprint arXiv:1910.07113_ , 2019.
  * [2] J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter, “Learning quadrupedal locomotion over challenging terrain,” _Science robotics_ , 2020\.
  * [3] W. Wang, D. Zhu, X. Wang, Y. Hu, Y. Qiu, C. Wang, Y. Hu, A. Kapoor, and S. Scherer, “Tartanair: A dataset to push the limits of visual slam,” in _Proc. IROS_ , 2020.
  * [4] E. Wood, T. Baltrusaitis, C. Hewitt, S. Dziadzio, M. Johnson, V. Estellers, T. Cashman, and J. Shotton, “Fake it till you make it: Face analysis in the wild using synthetic data alone,” in _Proc. ICCV_ , 2021.
  * [5] M. Haiderbhai, R. Gondokaryono, T. Looi, J. M. Drake, and L. A. Kahrs, “Robust sim2real transfer with the da vinci research kit: A study on camera, lighting, and physics domain randomization,” in _Proc. IROS_ , 2022.
  * [6] A. Shrivastava, T. Pfister, O. Tuzel, J. Susskind, W. Wang, and R. Webb, “Learning from simulated and unsupervised images through adversarial training,” in _Proc. CVPR_ , 2017.
  * [7] J.-H. R. Chang, A. Shrivastava, H. Koppula, X. Zhang, and O. Tuzel, “Style equalization: Unsupervised learning of controllable generative sequence models,” in _Proc. ICML_ , 2022.
  * [8] T. Park, A. A. Efros, R. Zhang, and J.-Y. Zhu, “Contrastive learning for unpaired image-to-image translation,” in _Proc. ECCV_ , 2020.
  * [9] J.-Y. Zhu, T. Park, P. Isola, and A. A. Efros, “Unpaired image-to-image translation using cycle-consistent adversarial networks,” in _Proc. ICCV_ , 2017.
  * [10] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, “Generative adversarial nets,” in _Proc. NeuRIPS_ , 2014.
  * [11] A. Brock, J. Donahue, and K. Simonyan, “Large scale GAN training for high fidelity natural image synthesis,” in _Proc. ICLR_ , 2019.
  * [12] X. Huang and S. Belongie, “Arbitrary style transfer in real-time with adaptive instance normalization,” in _Proc. ICCV_ , 2020.
  * [13] A. Karnewar and O. Wang, “MSG-GAN: Multi-scale gradients for generative adversarial networks,” in _Proc. CVPR_ , 2020.
  * [14] T. Karras, T. Aila, S. Laine, and J. Lehtinen, “Progressive growing of GANs for improved quality, stability, and variation,” in _Proc. ICLR_ , 2018.
  * [15] T. Karras, S. Laine, and T. Aila, “A style-based generator architecture for generative adversarial networks,” in _Proc. CVPR_ , 2019.
  * [16] I. Gulrajani, F. Ahmed, M. Arjovsky, V. Dumoulin, and A. C. Courville, “Wasserstine GAN,” in _Proc. NeuRIPS_ , 2017.
  * [17] H. Zhang, I. Goodfellow, D. Metaxas, and A. Odena, “Self-attention generative adversarial networks,” _CoRR, abs/1805.08318_ , 2018.
  * [18] H. Zhang, T. Xu, H. Li, S. Zhang, X. Huang, X. Wang, and D. N. Metaxas, “StackGAN: Text to photo-realistic image synthesis with stacked generative adversarial networks,” in _Proc. ICCV_ , 2017.
  * [19] H. Zhang, T. Xu, H. Li, S. Zhang, X. Wang, X. Huang, and D. N. Metaxas, “StackGAN++: Realistic image synthesis with stacked generative adversarial networks,” _CoRR_ , vol. abs/1710.10916, 2017.
  * [20] M.-Y. Liu and O. Tuzel, “Coupled generative adversarial networks,” in _Proc. NeuRIPS_ , 2016.
  * [21] X. Mao, Q. Li, H. Xie, R. Y. K. Lau, and Z. Wang, “Multi-class generative adversarial networks with the L2 loss function,” in _Proc. ICCV_ , 2016\.
  * [22] T. Karras, M. Aittala, S. Laine, E. Härkönen, J. Hellsten, J. Lehtinen, and T. Aila, “Alias-free generative adversarial networks,” in _Proc. NeuRIPS_ , 2021.
  * [23] P. Isola, J.-Y. Zhu, T. Zhou, and A. A. Efros, “Image-to-image translation with conditional adversarial networks,” in _Proc. CVPR_ , 2017.
  * [24] Y. Qu, Y. Chen, J. Huang, and Y. Xie, “Enhanced pix2pix dehazing network,” in _Proc. CVPR_ , 2019.
  * [25] T. Wang, M. Liu, J. Zhu, A. Tao, J. Kautz, and B. Catanzaro, “High-resolution image synthesis and semantic manipulation with conditional gans,” in _Proc. CVPR_ , 2020.
  * [26] S. Kim, J. Baek, J. Park, G. Kim, and S. Kim, “InstaFormer: Instance-aware image-to-image translation with transformer,” in _Proc. CVPR_ , 2022.
  * [27] P. Sangkloy, J. Lu, C. Fang, F. Yu, and J. Hays, “Scribbler: Controlling deep image synthesis with sketch and color,” in _Proc. CVPR_ , 2017.
  * [28] L. Karacan, Z. Akata, A. Erdem, and E. Erdem, “Learning to generate images of outdoor scenes from attributes and semantic layouts,” _CoRR_ , vol. abs/1612.00215, 2016.
  * [29] S. Yang, L. Jiang, Z. Liu, and C. C. Loy, “Unsupervised image-to-image translation with generative prior,” in _Proc. CVPR_ , 2022.
  * [30] M. Ko, E. Cha, S. Suh, H. Lee, J.-J. Han, J. Shin, and B. Han, “Self-supervised dense consistency regularization for image-to-image translation,” in _Proc. CVPR_ , 2022.
  * [31] S. Tripathy, J. Kannala, and E. Rahtu, “Learning image-to-image translation using paired and unpaired training samples,” in _Proc. ACCV_ , 2019.
  * [32] A. Mustafa and R. K. Mantiuk, “Transformation consistency regularization- A semi-supervised paradigm for image-to-image translation,” in _Proc. ECCV_ , 2020.
  * [33] S. Benaim and L. Wolf, “One-sided unsupervised domain mapping,” in _Proc. NeuRIPS_ , 2017.
  * [34] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in _Proc. CVPR_ , 2016.
  * [35] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila, “Analyzing and improving the image quality of StyleGAN,” in _Proc. CVPR_ , 2020.
  * [36] A. Sauer, K. Chitta, J. Müller, and A. Geiger, “Projected GANs converge faster,” in _Proc. NeuRIPS_ , 2021.
  * [37] I. J. Goodfellow, “NIPS 2016 tutorial: Generative adversarial networks,” _CoRR_ , vol. abs/1701.00160, 2017.
  * [38] D. P. Kingma and J. Ba., “Adam: A method for stochastic optimization,” in _ICLR_ , 2015.
  * [39] Y. Yazıcı, C.-S. Foo, S. Winkler, K.-H. Yap, G. Piliouras, and V. Chandrasekhar, “The unusual effectiveness of averaging in GAN training,” _CoRR_ , vol. abs/1806.04498, 2018.


#  Ideal category of a Noetherian ring

P. G. Romeo and Minnumol P K  Department of Mathematics
Cochin University of Science and Technology(CUSAT)
Kochi, Kerala, India, 682022
$romeo_{-}parackal<EMAIL_ADDRESS>
###### Abstract.

In this paper we describe the categories $\mathbb{L}_{R},\,[\mathbb{R}_{R}]$
whose objects are left [right] ideals of a Noetherian ring $R$ with unity and
morphisms are appropriate $R$-linear transformations. Further it is shown that
these are preadditive categories with zero object and are full subcategories
of the $R$ \- modulue category with the property that these are categories
with subobjects and the morphisms admits factorization property.

###### Key words and phrases:

Ring, Ideals, Finitely generated ideals, Category of ideals of ring

First author wishes to thank Council of Scientific and Industrial
Research(CSIR) INDIA, for providing financial support.

##  1\. Introduction

Category theory was introduced by Samuel Elienberg and Saunders Maclane[1] in
1945 with the grant aim to unify the structural analysis of various stuctures
and to simplify the presentation. Several mathematicians successfully used
category theory to study various mathematical structures. In [4] K.S.S
Nambooripad described certain categories which he call normal categories to
characterize the ideals of a regular semigroup as categories which enabes him
to obtain beautiful representations of regular semigroups. Later in [6] this
approach was extended to regular rings. In this paper we consider a Noetherian
ring $R$ with unity and describe categories of and right ideals of $R$ having
morphisms the left (right) $R$ \- linear transformations and discuss various
properties of these categories and compare these with the categorical
properties of $R$ \- modulue categores.

##  2\. Preliminaries

A category ${\mathcal{C}}$ consisting of a class of objects written as
$\nu{\mathcal{C}}$ and collection of morphisms $f\in{\mathcal{C}(A,B)}$ from
each object $A=dom\;f$ to each object $B=cod\;f$. For each pair $(f,g)$ of
morphisms with $dom\;g=cod\;f$, a morphism $g\circ
f:\operatorname{dom}f\,\rightarrow\,cod\;g$ is the composition $\circ$ and for
each object $a$ there exist a unique morphism $1_{A}\in{\mathcal{C}}(A,A)$ is
called the identity morphism on $a$. Further the composition satisfies
$h\circ(g\circ f)=(h\circ g)\circ f$ whenever defined and $f\circ
1_{A}=f=1_{B}\circ f$ for all $f\in{\mathcal{C}}(A,B)$.

######  Example 2.1.

Set : objects are sets and morphisms are functions between sets.
Grp : groups as objects and homomorphisms as morphisms
Vct${}_{\textbf{K}}$ : objects are the vector spaces over a fixed field $K$
and morphisms are linear maps between them.

If a subcollection $\mathcal{S}$ of objects and morphisms of $\mathcal{C}$,
itselfs consitute a category then $\mathcal{S}$ is called a subcategory of
$\mathcal{C}$.

Let $\mathcal{C}$ and $\mathcal{D}$ be two categories. A covariant functor
$F:\mathcal{C}\rightarrow\mathcal{D}$ consists of a vertex map which assigns
each $A\in\nu\mathcal{C}$ to an object $F(A)\in\nu\mathcal{D}$ and a morphism
map which assigns each morphism $f:A\rightarrow B,$ to a morphism
$F(f):F(A)\rightarrow F(B)\in\mathcal{D}$ such that $F(1_{A})=1_{\nu F(A)}$
for all $A\in\nu\mathcal{C}$ and $F(f\circ g)=F(f)\circ F(g)$ for all
morphisms $f,g\in\mathcal{C}$ for which the composition $f\circ g$ exists.

A functor $F:\mathcal{C}\rightarrow\mathcal{D}$ is said to be full if for
every pair of objects $A,B$ in $\mathcal{C}$ the morphism set
${\mathcal{C}}(A,B)$ is mapped surjectively by $F$ onto
${\mathcal{D}}(F(A),F(B))$. A subcategory $\mathcal{S}$ of $\mathcal{C}$ is
said to be full if the inclusion functor from $\mathcal{S}$ to $\mathcal{C}$
is full.

######  Definition 2.2.

A morphism $m:A\rightarrow B$ in a category $\mathcal{C}$ is a monomorphism if
$f_{1},f_{2}:D\rightarrow A$ in $\mathcal{C}$, the equality $m\circ
f_{1}=m\circ f_{2}\Rightarrow f_{1}=f_{2}$, that is., $m$ is a monomorphism if
it is left cancellable. Dually a morphism $e:A\rightarrow B$ is an epimorphism
if it is right cancellable. That is if $g_{1},g_{2}:b\rightarrow c$ ,
$g_{1}\circ\,e\,=\,g\,_{2}\circ e\Rightarrow g_{1}=g_{2}$.

Note that in the category Set monomorphisms are percisely the injections and
epimorphisms are precisely the surjections.

######  Definition 2.3.

An object $T$ is terminal in a category ${\mathcal{C}}$ if each object $A$ in
${\mathcal{C}}$ there is exactly one arrow $A\rightarrow T$. An object $S$ is
initial in ${\mathcal{C}}$ if each object $A$ there is exactly one arrow
$S\rightarrow A$.

A zero object $0$ in a category ${\mathcal{C}}$ is an object which is both
initial and terminal. For any two objects $A$ and $B$ in ${\mathcal{C}}$ there
is a unique arrow $0_{A,B}\,:\,A\rightarrow 0\rightarrow B$ called the zero
arrow from $A$ to $B$. In the category Set, the empty set is an initial object
and any one point set is a terminal object.

######  Definition 2.4.

Let ${\mathcal{C}}$ be a category with zero objects, kernel of a morphism
$f:A\rightarrow B\in{\mathcal{C}}$ is a pair $(K,i)$ of an object $K$ and a
morphism $i:K\rightarrow A$ such that $f\circ i=0$ satisfying the universal
property, that is for any other morphism $i^{\prime}:K^{\prime}\rightarrow A$
with $f\circ i^{\prime}=0$ there exist a unique arrow $h:K^{\prime}\rightarrow
K$ such that $i\circ h=i^{\prime}$.

Dually a cokernel of a morphism $f:A\rightarrow B$ is a pair $(E,p)$ of an
object $E$ and a morphism $p:B\rightarrow E$ such that $p\circ f=0$ satisfying
the universal property.

######  Definition 2.5.

A product of two object $A$ and $B$ in a category ${\mathcal{C}}$ is an object
$A\,\Pi\,B$ together with morphisms $p_{1}:A\,\Pi\,B\rightarrow A$ and
$p_{2}:A\,\Pi\,B\rightarrow B$ that satises the universal property, viz., for
some object $C$ and any two morphisms $f_{1}:C\rightarrow A,f_{2}:C\rightarrow
B$, there exist a unique morphism $h:C\rightarrow A\,\Pi\,B$ such that
$p_{i}\circ h=f_{i}$ for $i=1,2$.

Dually A coproduct of two object $A$ and $B$ in a category ${\mathcal{C}}$ is
an object $A\,\amalg\,B$ together with morphisms $i_{1}:A\rightarrow
A\,\amalg\,B$ and $i_{2}:B\rightarrow A\,\amalg\,B$ that satises the universal
property: any two morphisms $f_{1}:A\rightarrow C,f_{2}:B\rightarrow C$ for
some object $C$ there exist a unique morphism $h:A\,\amalg\,B\rightarrow C$
such that $h\circ i_{i}=f_{i}$ for $i=1,2$.

$B$$A\Pi B$$A$$C$$f_{1}$$f_{2}$$h$$p_{1}$$p_{2}$$B$$A\amalg
B$$A$$C$$g_{1}$$g_{2}$$h$$i_{1}$$i_{2}$

######  Definition 2.6.

A category ${\mathcal{C}}$ is called preadditive category or $Ab$-category if
each hom-set ${\mathcal{C}(a,b)}$ is an additive abelian group and composition
is bilinear: i.e.,

$(g\,+\,g^{\prime})\circ(f\,+\,f^{\prime})=(g\circ f)\,+\,(g\circ
f^{\prime})\,+\,(g^{\prime}\circ f)\,+\,(g^{\prime}\circ f^{\prime})$

where $f,f^{\prime}:a\rightarrow b\quad\text{and}\quad
g,g^{\prime}:b\rightarrow c$.

An additive category is a preadditive category with a zero object in which
every pair of objects admits a product and coproduct and an abelian category
is a additive category where every morphism admits a kernel and a cokernel,
and every monomorphism is a kernel and every epimorphism is a cokernel. It is
easy to see that the Category of abelian groups Ab, category of left $R$
modules R - Mod, category of right $R$ modules Mod - R are abelian categories.
A morphism $e:A\rightarrow A$ in the category ${\mathcal{C}}$ is called
idempotent if $e^{2}=e$. An idempotent $e:A\rightarrow A$ is said to be a
split idempotent if there exist morphisms $f:B\rightarrow A$ and
$g:A\rightarrow B$ in ${\mathcal{C}}$ such that $g\circ f=1_{B}$ and $f\circ
g=e$.

######  Definition 2.7.

(cf.[5]) A category ${\mathcal{C}}$ is called idempotent complete if all
idempotents are spit idempotents.

A preorder $\mathcal{P}$ is a category such that for any
$p,p^{\prime}\in\nu\mathcal{P},\mathcal{P}(p,p^{\prime})$ contains atmost one
morphism. In this case there is a quasi order relation $\subseteq$ on
$\in\nu\mathcal{P}$ such that $p\subseteq
p^{\prime}\iff\mathcal{P}(p,p^{\prime})\neq\phi$. $\mathcal{P}$ is said to be
a strict preorder if $\subseteq$ is a partial order (see .cf.[4]).

######  Definition 2.8.

(cf.[4]) Let $\mathcal{C}$ be a category and $\mathcal{P}$ be a sub category
of $\mathcal{C}$. The pair ($\mathcal{C}$, $\mathcal{P}$) is called  category
with subobjects if the following conditions hold:

  * •

$\mathcal{P}$ is a strict preorder with $\nu\mathcal{C}=\nu\mathcal{P}$.

  * •

Every $f\in\mathcal{P}$ is a monomorphism.

  * •

If $f,g\in\mathcal{P}$ and $f=gh$ for some $h\in\mathcal{C}$ then
$h\in\mathcal{P}$.

Let $C,D\in\nu\mathcal{C}$, we denote the unique morphism in $\mathcal{P}$
from $C\rightarrow D$ by $j_{(C,D)}$ and is called inclusion. In this case $C$
is referred to as a subobject of $D$.

######  Definition 2.9.

(cf.[4]) Let $\mathcal{C}$ be a category with subobjects. A canonical
factorization of a morphism $f$ in $\mathcal{C}$ is a factorization of the
form $f=jq$ where $q$ is an epimorphism and $j$ is an inclusion.

######  Definition 2.10.

(cf.[3]) Let $R$ be a ring. A left R - module is an abelian group $(M,+)$
together with a scalar multiplication $R\,\times\,M\rightarrow
M,\,(r,x)\mapsto rx$ such that:

  * •

$r(x+y)=rx+ry,\,\,\forall r\,\in R\,\text{and}\,x,y\,\in{M}$

  * •

$(r+r^{\prime})x=rx+r^{\prime}x,\,\,\forall r,r^{\prime}\in R,x\in{M}$

  * •

$(rr^{\prime})x=r(r^{\prime}x),\,\,\forall r,r^{\prime}\in R,x\in{M}$

Similary we can define right R module. If R is commutative left R module and
right R module are the same.

##  3\. Category of left ideals of a Noetherian ring

Let $R$ be a Noetherian ring with unity and $\mathbb{L}_{R}$ be the collection
of all left ideals of $R$. Since ideals of Noetherian rings are finitely
generated, each left ideal in $\mathbb{L}_{R}$ is of the form $A=\langle
a_{1},a_{2},...,a_{n}\rangle_{l},\quad a_{i}\in R$ for all $i=1,2,...,n$. It
is easy to observe that $\mathbb{L}_{R}$ is a category whose objects left
ideals of $R$ and morphisms are $R$ -linear transformations. i.e. for any
$A,B\in\nu\mathbb{L}_{R}$ and $f\in\mathbb{L}_{R}(A,B)$, then $f$ satisfies
the conditions

$f(x+y)=f(x)+f(y)$ $f(rx)=rf(x)\,\,\forall x,y\in{A},r\,\in{R}.$

Since composition of $R$\- linear transformations is again $R$\- linear, the
composition of morphisms in the category is the usual set composition of $R$
linear maps and $1_{A}$ is the identity map on $A$.

######  Theorem 3.1.

Let $R$ be a Noetherian ring with unity. The category $\mathbb{L}_{R}$, of all
left ideals of $R$ is a preadditive category with zero object.

###### Proof.

Consider $A,B\in\nu\mathbb{L}_{R}$ and $f,g\in\mathbb{L}_{R}(A,B)$. Define

$(f+g)(x)=f(x)+g(x)\quad\text{for all}\quad x\in{A}$

then

$\begin{split}(f+g)(x+y)&=f(x+y)+g(x+y)=f(x)+f(y)+g(x)+g(y)\\\
&=f(x)+g(x)+f(y)+g(y)\\\ &=(f+g)(x)+(f+g)(y)\end{split}$
$(f+g)(rx)=f(rx)+g(rx)=rf(x)+rg(x)=r(f+g)(x)$

that is, $f+g\in\mathbb{L}_{R}(A,B)$. Since the zero map is $R$\- linear and
belongs to $\mathbb{L}_{R}(A,B)$ it is the identity and for each
$f\in\mathbb{L}_{R}(A,B)$, let $(-f)(x)=-f(x)$ then $-f\in\mathbb{L}_{R}(A,B)$
and is the invers element. Hence $\mathbb{L}_{R}(A,B)$ is an Abelian group
under above defined addition. For any
$f_{1},f_{2}\in\mathbb{L}_{R}(A,B)g_{1},g_{2}\in\mathbb{L}_{R}(B,C)$,

$(g_{1}\,+\,g_{2})\circ(f_{1}\,+\,f_{2})=(g_{1}\circ f_{2})\,+\,(g_{1}\circ
f_{2})\,+\,(g_{2}\circ f_{1})\,+\,(g_{2}\circ f_{2})$

i.e., the composition is bilinear. Hence $\mathbb{L}_{R}$ is a preadditive
category.
Let $O$ be the zero ideal. For any $A\in\nu\mathbb{L}_{R}$ there is exactly
one arrow in $\mathbb{L}_{R}(A,O)$ and so $O$ is the zero object in
$\mathbb{L}_{R}$, that is $\mathbb{L}_{R}$ is a preadditive category with zero
object. ∎

This category $\mathbb{L}_{R}$ is a subcategory of the category of left
$R$-modules $R-Mod$ and it is easy to see that the inclusion functor
$i:\mathbb{L}_{R}\rightarrow R-Mod$ is full. Similarly it is seen that
$\mathbb{R}_{R}$, the collection of all right ideals of $R$ is a preadditive
category with zero object and is a full sub category of the category of right
$R$-modules $Mod-R$.

######  Theorem 3.2.

Let $R$ be a Noetherian ring. In the category $\mathbb{L}_{R}$, of all left
ideals of $R$ biproduct exist only for ideals with trivial intersection.

###### Proof.

Let $A,B\in\nu\mathbb{L}_{R}$ with $A\cap B=\\{0\\}$. Then
$A+B\in\nu\mathbb{L}_{R}$ and since $A\cap B=\\{0\\}$ every element $x\in A+B$
can be uniquely expressed as $x=a+b$ where $a\in A$ and $b\in B$. Define
$p_{1}:A+B\rightarrow A$ and $p_{2}:A+B\rightarrow B$ respectively as
$p_{1}(x)=a$ and $p_{2}(x)=b$, for all $x=a+b\in A+B$. Clearly $A+B$ together
with $p_{1}$ and $p_{2}$ constitute the product in left ideal category
$\mathbb{L}_{R}$. It has the universal property that : for any object
$C\in\nu\mathbb{L}_{R}$ and morphisms $f_{1}:C\rightarrow A$ and
$f_{2}:C\rightarrow B$ there exist a unique map $h:C\rightarrow A+B$ as
$h(x)=f_{1}(x)+f_{2}(x)\forall x\in{C}$ such that the following diagram
commutes.

$B$$A+B$$A$$C$$f_{1}$$f_{2}$$h$$p_{1}$$p_{2}$

Dually we can define morphism $i_{1}:A\rightarrow A+B$ and $i_{2}:B\rightarrow
A+B$ respectively as $i_{1}(a)=a$ and $i_{2}(b)=b,\forall a\in A,\forall b\in
B$ . Then $A+B$ together with $i_{1}$ and $i_{2}$ constitute the coproduct in
left ideal category $\mathbb{L}_{R}$. It has the universal property that : for
any object $D\in\nu\mathbb{L}_{R}$ and morphisms $g_{1}:A\rightarrow D$ and
$g_{2}:B\rightarrow D$ there exist a unique map $h^{\prime}:A+B\rightarrow D$
as $h(x)=g_{1}(a)+g_{2}(b)\,\,\forall x=a+b\in{A+B}$ such that the following
diagram commutes.

$B$$A+B$$A$$C$$g_{1}$$g_{2}$$h$$i_{1}$$i_{2}$

so in the category $\mathbb{L}_{R}$ product and coproduct (i.e biproduct)
exist only for ideals with trivial intersection. ∎

The following proposition is recalled as it is of interest in the context of
$R$-modules categories.

######  Proposition 3.3.

(cf.[7]) Let $\mathcal{C}$ be an additive category and $\mathcal{D}$ be a full
subcategory of $\mathcal{C}$. If $\mathcal{D}$ has a zero object and is closed
under binary biproduct, then $\mathcal{D}$ with morphism addition inherited
from $\mathcal{C}$ is an additive category.

Since the category $\mathbb{L}_{R}$ is a full sub category of $R-Mod$ category
and $\mathbb{L}_{R}$ is a preadditive category with zero object, by
proposition 3.3 we can conclude that $\mathbb{L}_{R}$ is only a preadditive
category.

######  Theorem 3.4.

Let $R$ be a Noetherian ring. Then every morphism in category $\mathbb{L}_{R}$
admits a kernel.

###### Proof.

Let $f:A\rightarrow B$ be an arrow in $\mathbb{L}_{R}$. Then
$kerf=\\{x\in{A}:f(x)=0\\}$ is an ideal of $R$ and $kerf\in\nu\mathbb{L}_{R}$.
Consider the inclusion map $i:kerf\rightarrow A$. Clearly $f\circ i=0$ and the
pair $(kerf,i)$ is a kernal and admits the universal property, that for any
other pair $(K,j)$ where $K$ is an object in $\mathbb{L}_{R}$ and
$j:K\rightarrow A$ is a morphism with $f\circ j=0$, there exist a unique
morphism $h:K\rightarrow A$ defined by $h(x)=j(x)\,\forall x\in K$ such that
the following diagram commutes.

$B$$A$$kerf$$K$$h$$j$$i$$f$

∎

######  Theorem 3.5.

Let $R$ be a Noetherian ring and $\mathbb{L}_{R}$ be the category of all left
ideals of $R$. Then only zero map and surjective morphism of $\mathbb{L}_{R}$
admits a cokernel.

###### Proof.

Let $f:A\rightarrow B$ be an arrow in $\mathbb{L}_{R}$. If $f=0$, then
$B/f(A)\cong B$ is an ideal and so $B/f(A)\in\nu\mathbb{L}_{R}$. If $f$ is a
surjective map then $B/f(A)\cong$ trivial ideal $\in\nu\mathbb{L}_{R}$. In
these two cases the pair $(B/f(A),p)$, where $p:B\rightarrow B/f(A)$ the usual
projection map will give the cokernel. It has the universal property, since
for any pair $(E,q)$ where $E$ is an object in $\mathbb{L}_{R}$ and
$q:B\rightarrow E$ is a morphism with $q\circ f=0$, there exist a unique
morphism $h:B/f(A)\rightarrow E$ defined by $h(x)=q(b),\,\forall x=b+f(A)\in
B/f(A)$ such that the following diagram commutes.

$B/f(A)$$B$$A$$E$$h$$q$$f$$p$

∎

######  Lemma 3.6.

(cf.[5]) If ${\mathcal{C}}$ a preadditive category then the following are
equivalent:

  1. (1)

${\mathcal{C}}$ idempotent complete.

  2. (2)

All idempotents have kernel.

  3. (3)

All idempotents have cokerne.

######  Theorem 3.7.

Let $R$ be a Noetherian ring. In the category $\mathbb{L}_{R}$, of all left
ideals of $R$ is idempotent complete

###### Proof.

We have already proved that in theoerm 3.4 every morphisms in $\mathbb{L}_{R}$
have kernel. In particular every idempotent arrows have kernel. Hence by Lemma
3.6 , $\mathbb{L}_{R}$ is idempotent complete. ∎

######  Theorem 3.8.

The category $\mathbb{L}_{R}$, of all left ideals of a Noetherian ring $R$ is
a category with subobjects and every morphisms have canonical factorization.

###### Proof.

To prove $\mathbb{L}_{R}$ is a category with subobjects, it will suffices to
construct a subcategory $\mathcal{P}$ of $\mathbb{L}_{R}$, which satisfies the
conditions in Definition 2.8. For, dfine a partial order on
$\nu\mathbb{L}_{R}$ as follows:

$A\subseteq B\iff a_{i}=r_{i1}b_{1}+...+r_{in}b_{n},\,r_{i1},...,r_{in}\in
R,\,i=1,...,n$

where $A=<a_{1},a_{2},...,a_{n1}>_{l},\quad
B=<b_{1},b_{2},...,b_{n2}>_{l}\in\,\nu\mathbb{L}_{R}$. Then the morphism
$j_{(A,B)}:A\rightarrow B$ defined by $j_{(A,B)}(x)=x,\,\,\forall x\in{A}$ is
a unique monomorphism and the subcategory $\mathcal{P}$ of $\mathbb{L}_{R}$
with $\nu\mathcal{P}=\nu\mathbb{L}_{R}$ and morphisms of $\mathcal{P}$ are the
inclusions$j_{(A,B)}$ is a strict preorder.

Suppose that $j_{(A,C)},j_{(B,C)}\in\mathcal{P}$ and $j_{(A,C)}=j_{(B,C)}h$
for some $h\in\mathbb{L}_{R}$. Then $j_{(A,C)}(x)=j_{(B,C)}h(x)$ for every
$x\in A$ and since both $j_{(A,C)}$ and $j_{(B,C)}$ are inclusions we have $h$
is the inclusion. Hence ($\mathbb{L}_{R},\mathcal{P}$) is the category with
subobject.
Consider any morphism $f:A\rightarrow B$ in $\mathbb{L}_{R}$, since $A$ is
left ideal and $f$ is left $R$-linear implies $f(A)$ is a left ideal. Let
$q:A\rightarrow f(A)$ be the restriction of $f$ to $im\,(f)$, then it is easy
to observe that $q$ is an epimorphism, $f(A)\subseteq B$ and
$j_{(f(A),B)}:f(A)\rightarrow B$ is an inclusion. i.e., $f=j_{(f(A),B)}q$ is a
canonical factorization. Thus every morphism in $\mathbb{L}_{R}$ admits
caninical factorization. ∎

##  4\. Examples of ideal category of some rings

In the following we provide some examples of ideal category of some Noetherian
rings.

######  Example 4.1.

Ideal category of $\mathbb{Z}$

Consider the category $\mathbb{L_{Z}}\,[\mathbb{R_{Z}}]$ of left [right]
ideals of the ring of integers $\mathbb{Z}$. Then

$\nu\mathbb{L_{Z}}=\\{\langle n\rangle:n\in\mathbb{Z}\\}$

$\mathbb{L_{Z}}(\langle n\rangle,\langle m\rangle)=\\{\rho_{(n,s,m)}:x\mapsto
xs\,|ns\in\langle m\rangle\,;\,s\in\mathbb{Z}\,\,\forall x\in\langle
n\rangle\\}$

Now $\rho_{(n,s,m)}:\langle n\rangle\,\rightarrow\,\langle m\rangle$ and
$\rho_{(m,t,p)}:\langle m\rangle\,\rightarrow\,<p>$ and thier composition is
$\rho_{(m,t,p)}\circ\rho_{(n,s,m)}=\rho_{(n,st,p)}:\langle
n\rangle\,\rightarrow\,<p>$ . For
$\rho_{(n,s,m)},\rho_{(n,t,m)}\in\mathbb{L_{Z}}(\langle n\rangle\,,\,\langle
m\rangle)$, let $\rho_{(n,s,m)}+\rho_{(n,t,m)}=\rho_{(n,s+t,m)}$, with respect
to this addition $\mathbb{L_{Z}}(\langle n\rangle\,,\,\langle m\rangle)$ is an
abelian group and $\langle 0\rangle$ is the zero element, hence
$\mathbb{L_{Z}}$ is a preadditive category with zero object.
For any two non zero ideals $\langle n\rangle\,,\,\langle m\rangle$ of
$\mathbb{Z}$, the element $mn\ $ always belongs to $\langle
n\rangle\cap\,\langle m\rangle$, and so $\langle n\rangle\cap\langle
m\rangle=\\{0\\}$ only when $n=0$ or $m=0$. Hence in $\mathbb{L_{Z}}$
biproduct exist only for those pair of objects in which one of them is the
zero ideal. A morphism $\rho_{(n,s,m)}:\langle n\rangle\,\rightarrow\,\langle
m\rangle$ is a monomorphism for $s\neq 0$ and zero object together with zero
arrow will give the kernel of this morphism.

######  Example 4.2.

Ideal category of $\mathbb{Z}_{6}$

Let $R=\mathbb{Z}_{6}$ and $\mathbb{L}_{R}$ be the category whose objects are
left ideals of the ring and morphisms are $R$ \- linear transformations, i.e.,

$\nu\mathbb{L_{Z}}_{6}=\\{\langle 0\rangle,\langle 1\rangle,\langle
2\rangle,\langle 3\rangle\\}$

$\mathbb{L_{Z}}_{6}(\langle n\rangle\,,\,\langle
m\rangle)=\\{\rho_{(n,s,m)}:x\mapsto xs\,|\,ns\in\langle
m\rangle\,;\,s\in\mathbb{Z}_{6}\,\,\forall x\in\langle n\rangle\\}$

The composition and addtion is defined as in the case of $\mathbb{Z}$. Hence
$\mathbb{L_{Z}}_{6}$ is a preadditive category with zero object $\langle
0\rangle$. In $\mathbb{L_{Z}}_{6}$ biproduct exisit for the pairs $(\langle
2\rangle,\langle 3\rangle)$ and to $(\langle 0\rangle,\langle n\rangle)$ where
$n=1,2,3$.

## References

  * [1] Mac Lane, S. Categories for a working mathematician 2nd ed, Springer-Verlag New York, Inc. (1998) ISBN: 0-387-98403-8
  * [2] Michael Artin, Algebra, Prentice Hall, New Jersey,(1991), ISBN 0-13-004763-5
  * [3] Musili . C, Introduction to ring and modules,Narosa Publishing House, New Delhi, (1992) ISBN 81-85198-64-0 .
  * [4] Nambooripad, K.S.S.Theory of cross connections , Pub. No. 28, Centre for Mathematical Sciences, Trivandrum, 1994.
  * [5] Rohan Hitchcock , Idempotents in preadditive categories note ;12 August 2022 http://therisingsea.org/notes/metauni/lg-idempotents.pdf
  * [6] Romeo P.G., Sreejamol P.R, On the category of ideals of ring. Journal of Mathematics and systems science,7,94-99,March 2017.
  * [7] Samuel Pettersson,Additive,abelian and exact categories U.U.D.M. Project Report 2016:48 http://www.diva-portal.org/smash/get/diva2:1063166/FULLTEXT01.pdf


# Initial Results for Pairwise Causal Discovery Using Quantitative Information
Flow

Felipe Giori
Universidade Federal de Minas Gerais
<EMAIL_ADDRESS>
&Flavio Figueiredo
Universidade Federal de Minas Gerais
<EMAIL_ADDRESS>

###### Abstract

Pairwise Causal Discovery is the task of determining causal, anticausal,
confounded or independence relationships from pairs of variables. Over the
last few years, this challenging task has promoted not only the discovery of
novel machine learning models aimed at solving the task, but also discussions
on how learning the causal direction of variables may benefit machine learning
overall. In this paper, we show that Quantitative Information Flow (QIF), a
measure usually employed for measuring leakages of information from a system
to an attacker, shows promising results as features for the task. In
particular, experiments with real-world datasets indicate that QIF is
statistically tied to the state of the art. Our initial results motivate
further inquiries on how QIF relates to causality and what are its
limitations.

##  1 Introduction

It is well known that the concept of causality has been studied for centuries,
stimulating discussions among philosophers, legislators, economists, and
computer scientists. One of the major objectives of many studies is to
estimate cause-and-effect relationships based on observational data. For
instance, using a sampled dataset are we able to determine that smoking causes
lung cancer? Or that, studying at a high prestige university implies a higher
salary?

In this paper, we focus on the task of finding causal relationships between
pairs of variables. As it was shown by [14], extracting such relationships is
not only useful from a data exploration perspective, but it may also help us
understand some of the limitations of machine learning models. That is,
knowing the causal relationships between dependent and independent variables
may help in choosing a good machine learning approach (e.g., semi-supervised
vs supervised learning).

The classic example of this setting may be phrased from the perspective of the
owner of an ice cream shop during the summer. In this season, such a person
may notice both an increase in electricity bills as well as sales. Although
there is a strong association between both variables, the weather acts as a
confounding variable being the most likely cause of both other. Thus, when
discovering cause and effect relationships between pairs of variables we must
differentiate four scenarios. In other, are we able state that, (1) variable
$X$ causes $Y$, $X\rightarrow Y$, or that (2) $Y$ causes $X$, $Y\rightarrow
X$. If neither is the case then either, (3) $X$ and $Y$ are related through
some confounding effect $Z$, $X\leftarrow Z\rightarrow Y$, or (4) the
variables are independent, i.e., $X\perp Y$.

Motivated by the importance of the problem and its challenges, this paper
focuses on exploring novel features for causal discovery extracted using
Quantitative Information Flow (QIF) [2]. QIF is an information-theoretic
framework that allows us to measure how much information flows through a
system. Originally, QIF was developed to measure information leakage in
systems for security purposes. This is done by using observable outputs of a
channel or function to update our beliefs about the channel input. To
understand QIF, imagine you want to guess a 4-PIN password. There are 10,000
possible combinations for that password. When we enter a randomly chosen
password in the password-checker, we will likely get a message saying that the
password is incorrect. In this case, the password is the input, the password-
checker is the channel and the message is the output. By observing the channel
output, we gain some information about the input, that is, we know that the
password we typed was incorrect and now we have "only" 9,999 possibilities
left. This means that the channel leaked some information about the true
password. QIF is a framework employed to measure how much information is
leaked based o different attack strategies.

When approaching the causal discovery task, evaluations are performed in
manually labeled real-world datasets [12] or synthetic pairs of
variables111http://www.causality.inf.ethz.ch/cause-effect.php. Whereas some
datasets include all of the four scenarios above, others are restricted to
defining causal ($X\rightarrow Y$) and anticausal ($Y\rightarrow X$)
relationships. Currently, one of the most promising approaches to
differentiate across the four relationships above is Jarfo [8] which computes
several statistical measures of the cause-effect pairs and trains a
GradientBoosting model to predict the causal direction. As we show in this
paper, not only are QIF features, by themselves, able to proving promising
results for caual discovery, combining the features computed by the QIF
framework with the Jarfo features yields the best results in most of our
tests. Overall, we also show that using the QIF features are a promising
direction that needs further exploration from the ML community.

The rest of this paper is organized as follows, in Section 2 we go over the
related work and give a brief overview of the QIF framework, in Section 3 we
present our experiments and results and Section 4 we discuss our results and
propose future work.

##  2 Background and Related Work

Causality is the influence some set of events, or random variables, named
causes have on the outcome of other variables, the effects. There are several
ways to model cause-effect relationships, but in this paper, we will use
causal graphical models (CGMs) pioneered by [20] and [13], and functional
causal models (also known as structural causal models). In the domain of
machine learning, we can categorize previous work on CGMs into two overlapping
sub-domains: causal inference and causal discovery. In causal inference, the
aim is to predict how changes on the cause variables affect the response
variables. Currently, this is mostly done via the do-calculus [13]. In
contrast, causal discovery is focused on identifying cause and effect
relationships from observational data.

###  2.1 Causal Discovery

It is well known that general causal discovery, that is, uncovering full CGMs
from several random variables from observation alone is in general not
possible. However, in some limited settings and under some assumptions this is
possible and previous endeavors have shown promising results. Such efforts may
be categorized as: constraint-based, score-based and methods based on
algorithms that exploit functional causal models.

Constraint-based algorithms focus on learning a set of causal graphs that
satisfy the conditional independence in the data. A famous algorithm is the
Peter-Clark Algorithm [19] and its variant introduced by [9]. This algorithm
starts with a fully connected graph and tests for conditional independence in
order to select which edges to remove. The fast causal inference algorithm
[20] and its extensions presented by [5] and [21] take unobserved confounders
into account when generating the graph.

Score-based algorithms replace the conditional independence tests with the
goodness of fit tests, that is, we want to maximize some score criterion. The
Bayesian Information Criterion (BIC) score [15] is a widely adopted metric,
defined as:
$S(X,G^{\prime})=logP(X|\hat{\theta},G^{\prime})-\frac{J}{2}log(n)$. Where,
$G^{\prime}$ is a causal graph, $X$ is the data, $\hat{\theta}$ is the maximum
likelihood estimator of the parameters, $J$ is the number of variables and $n$
the number of instances. Searching for a causal-graph with maximum score is a
NP-Complete problem, as shown by [4].

Algorithms based on functional causal model exploit the function
$y=f(x,\epsilon)$, where $y$ is the effect, $x$ is the cause and $\epsilon$ is
some noise term. A famous algorithm is the LiNGAM introduced by [17] where we
try to estimate some lower triangle matrix $A$ such that $x=xA+\epsilon$.
There are variations of the LiNGAM algorithm such as ICA-LiNGAM [17] and
DirectICA-LinGAM [18]

###  2.2 Causal and Anticausal Machine Learning

One of the goals of machine learning is to exploit statistical associations or
dependence between endogenous variables to predict the value of other,
exogenous, variables. Endogenous variables are usually defined as $X_{i}$,
with $i$ being some arbitrary index, whereas the exogenous responses are
$Y_{j}$. For simplicity, let us focus on the pairwise setting, where we only
have one $X$ and one $Y$. In this setting, the goal of supervised machine
learning algorithms is to estimate some model, or hypothesis,
$h_{\theta}:X\rightarrow Y$. Here, $\theta$ captures a vector of model
parameters, with one example of such a model being a simple logistic
regression model, i.e.,
$y=h_{\theta}(x)=\frac{1}{1+e^{-(\theta_{0}+\theta_{1}x})}$.

Within this supervised learning, researchers have defined what is known as
causal and anticausal learning. Consider the setting where we are trying to
predict whether one has lung cancer, $Y$, based on the average amount of
cigarettes one smokes per year. It is well known that smoking causes cancer,
thus some real causal relationship $f:X\rightarrow Y$ exists and we are trying
to estimate causes from effects $h_{\theta}:X\rightarrow Y$. Now, consider a
similar setting where we are still trying to predict lung cancer, but from
some x-ray image. Here, $X$ is a feature associated with the number of dark
pixels in this image (usually related to cancer). There is no way some
computer image caused cancer on an individual, here, the image is an effect of
having cancer, i.e., $f:Y\rightarrow X$ (the opposite of the previous
relationship). Nevertheless, via machine learning, we still aim to estimate
$h_{\theta}:X\rightarrow Y$, thus capturing an anticausal learning task.

Several papers have explored the causal or anticausal nature of supervised
learning in different settings. For instance, [14] showed semi-supervised
learning is usually only beneficial in the causal direction. Moreover, [10]
explored anticausal learning in order to estimate the degeneracy of machine
learning models over time.

###  2.3 Quantitative Information Flow

Quantitative Information Flow (QIF) is an information theoretic framework that
computes how much information flows through a system. QIF was developed to
study information security from a perspective of attacks to a system. In order
to understand QIF, consider the setting where an adversary wants to know the
value of some secret $x$ in the domain of the random variable $X$. Given that
the attacker want’s to guess $x$, she/he may use some prior knowledge to guess
this value. This prior knowledge is determined by some prior probability mass
function: $\pi_{x}$. One possible, smart, strategy would be to choose the most
likely value of $x$, that is, the value with maximum probability. The
intuition is that if we only have one shot to guess the value $x$, then it is
smart to choose the most likely value. We call this the Bayes Vulnerability,
defined as:

$V_{b}(\pi)=\max_{x\in X}\pi_{x}.$ (1)

Bayes vulnerability measures one example of a strategy an attacker may take,
there are other measures that capture other definitions of information flow.
For instance, Shannon’s Entropy can be viewed as a measure that captures an
attacker guessing random secrets sampled according to $\pi$. Regardless of the
choice of attack, the work by [3] showed that we measure the flow of
information flow from system to attacker. The intuition is that for every
possible action an adversary can perform, there is a corresponding gain. That
is, for every action $w\in W$ that the adversary can perform, there is some
associated gain for every $x\in X$. This gain is defined by some gain function
$g:W\times X\rightarrow\mathbb{R}$ where an action $w\in W$ can be seen as a
guess that the adversary could make about the secret, in which case it is
natural that $W=X$. For example, in the password checker problem, an action
could be to guess password $a$ and the gain function then maps a gain for
every value of $x\in X$ if we had taken that action. We can also think of an
action as not making a guess if we think the situation is too risky. Now we
can measure the threat of some adversary towards a secret as the expected gain
for a optimal choice of $w\in W$. This is a prior g-vulnerability, defined as

$V_{g}(\pi)=\sup_{w\in W}\sum_{x\in X}\pi_{x}g(w,x).$ (2)

Now, lets consider a channel $C$ that processes a secret $x\in X$. A channel
$C$ is a function $C:X\rightarrow\mathbb{D}Y$, so that for each $x$ in $X$ ,
we have $C(x)$ as a distribution on $Y$, giving the probability of each
possible output value $y$. Entry $C(x,y)$ denotes $P(y|x)$, the conditional
probability of getting output $y$ given input $x$. When a secret passes
through a channel and output $y$ is observed, some information might be
released, that is, observing output $y$ of a channel might help us increase
our knowledge about secret $x$. We can now compute the threat represent by the
adversary given that the output was observed. We call this new threat the
posterior g-vulnerability, defined as

$V_{g}(\pi\triangleright C)=\sum_{y\in Y}\sup_{w\in W}\sum_{x\in
X}\pi_{x}C(x,y)g(w,x).$ (3)

Given both prior and posterior g-vulnerabilities, we can measure how much
knowing $y$ increases our knowledge about secret $x$ by comparing the computed
vulnerabilities. This measure is called g-leakage and can be computed in a
additive or multiplicative manner, as follows:

$\mathcal{L}^{\times}_{g}(\pi\triangleright C)=\frac{V_{g}(\pi\triangleright
C)}{V_{g}(\pi)}$ (4) $\mathcal{L}^{+}_{g}(\pi\triangleright
C)=V_{g}(\pi\triangleright C)-V_{g}(\pi)$ (5)

The leakage functions return how much more vulnerable the secret is once the
output $y$ is observed. As shown by [1] we can compute the information flow in
both directions, from $X$ to $Y$, called direct flow, and from $Y$ to $X$,
called reverse flow. In our experiments we used the QIF framework to compute
leakages in both directions and used those as variables to train classifiers
to predict the causal direction. We used the identity gain function defined
as:

$g_{id}(x,w)=\left\\{\begin{array}[]{lr}1,\text{if }w=x\\\ 0,\text{if }w\neq
x\end{array}\right\\}$ (6)

to compute the Bayes Vulnerability and used an alternate version of the
framework that, instead of maximizing a gain function, minimizes a loss
function. We used the following loss function to measure the Shannon leakage:

$\ell_{H}(w,x)=-\log_{2}w_{x}.$ (7)

Finally, we also measured the channel capacity which is a measure of how much
information the channel can leak independent of the prior and the gain
function.

##  3 Experiments and Results

In this section, we provide our experimental setup and share some of the
results obtained with models trained using variables computed by the QIF
framework.

Dataset: In our experiments, we use two datasets. The first is the cause-
effect pairs from the cause-effect pair
challenge222http://www.causality.inf.ethz.ch/cause-effect.php consisting of
20k datasets of synthetic pairs of variables labeled as causal, anticausal,
confounded, and independent. The second dataset consists of 99 real-world
known cause-effect pairs made available by [12]. This second set of data is
called the Tuebingen dataset. The dataset simply states the causal direction
of variables, thus we randomized the pairs in order to have two labels, causal
and anticausal, of similar sizes (roughly 50 pairs).

Experimental setup: Our approach is similar to [8] where we compute several
statistical measures from the relationship between the cause-effect pairs and
train a machine learning model on those statistics to predict the causal
direction. To serve as a baseline we train a model on the features computed by
Jarfo [8] and compare the results of a model trained with features computed by
QIF. We also consider a third setting where we combine features from both
approaches. We also point out that we trained classifiers for solving two
problems: predicting causal or anticausal and predicting all four classes on
the cause-effect pair challenge datasets. Finally, given that labels are of
the same size, we measure accuracy as a metric of performance (results are
reported with 95% confidence intervals).

Model training: We tested different learning methods for classification and,
on average, we found the best results using the XGBoost classifier. We perform
a 10-fold cross-validation in all of our experiments and we test our
predictions on a holdout test set containing 20% of the data.

QIF features: The QIF framework implementation we used has limitations where
it needs relative frequencies to measure the leakages. These relative
frequencies can be quite tricky to compute when we have continuous variables.
In order to overcome these limitations, we adapted the framework to use a
Gaussian kernel estimated by the numerical variables pairs and use this kernel
to compute the leakages. When we had a numerical variable and another non-
numerical variable we used a simple binning discretizer and optimized the
number of bins in cross-validation. Finally, the features we used were the
Bayes vulnerability, risk, and Shannon leakages, such as multiplicative and
additive, the difference between direct and reverse leakages of those
measures, and the channel capacity.

In our first experiment, we trained models on the challenge dataset. Given
that in this dataset we have all four classes, we present results for the four
classes as well as for the causal vs anticausal setting only. The results are
shown in Figure 1. From the figure, we can see that in the problem where we
have to predict all four classes, the classifiers’ performances were quite
similar, with the best results found in the classifier using both QIF and
Jarfo features. In the causal/anticausal setting, the model using only QIF
features performed significantly below the other two. However, it is important
to point out that in real-world datasets, using only QIF is as good as using
several other features explored by Jarfo. These numbers are shown in Figure
1(d).

We computed the feature importance and Shapley additive explanations [11],
which can be seen in figure 2. The most important features were the difference
between direct and reverse leakages for the Bayes vulnerability, Shannon, and
Bayes risk. A clear relationship on the Shannon leakage, where high values
have a positive impact and low values have a negative impact. The Bayes
vulnerability additive leakage difference also shows a moderate relationship
where low values have a positive impact and high values have a negative
impact. That means that when the reverse leakage is higher, we tend to predict
causal orientation and when the direct leakage is higher, we tend to predict
anticausal orientation.

Our results in these initial experiments show that QIF measures are a
prospective line of research for the causal discovery task. Our goal in future
experiments is to better understand how QIF relates, in a theoretical sense,
to other causal discovery approaches discussed in Section 2.

(a) All classes and all variable types

(b) Causal/Anticausal and all variable types

(c) Model trained on all variable types of the challenge cause-effect pairs
and tested on real data

(d) Accuracy results with the model trained and tested on real data

Figure 1: Accuracy results for the challenge cause-effect pairs

(a) Feature importance of the top 10 features of the model trained only with
QIF variables for the causal/anticausal problem

(b) SHAP values of the top 10 features of the model trained only with QIF
variables for the causal/anticausal problem

Figure 2: Feature importance and SHAP values

##  4 Conclusion and Future Work

In this paper, we studied the impact of trying to predict the causal direction
of the cause-effect pairs by using models trained on features computed by the
quantitative information flow framework. We used the features computed by
Jarfo as a baseline and saw that our results were slightly better on the real-
world cause-effect pairs.

Initial promising lines of future work may be performed by expanding the set
of gain functions used by QIF. This allows one to compute other features which
may improve results.

Before concluding, it is important to point out that we did experiment with
different approaches to estimate probability distributions for numeric
datasets before using QIF (e.g., Kernel Density Estimators [16] or Flow Models
[7] [6]). In these settings, we found that results are mostly the same as the
binned categorization we performed. Thus, we believe that the QIF, as is, is a
promising approach for causal discovery and needs to be better understood
theoretically (e.g., how the measure relates to other causal discovery
approaches such as LiNGAM or ANM).

## Acknowledgements

This work has been partially supported by the project GO Deep (Geo-sciences
Oriented Deep Learning) project funded by Petrobras (2019/00480-9
PT-200.20.00121). Funding was provided by the authors’ individual grants from
CNPq and CAPES. In particular, CNPQ’s Universal 2018 Grant: 421884/2018-5.

## References

  * [1] T. Alcantara.  On the relationship of privacy and fairness in machine learning.  Master’s thesis, Department of Computer Science - Federal University of Minas Gerais, 2019.
  * [2] M. S. Alvim, K. Chatzikokolakis, A. McIver, C. Morgan, C. Palamidessi, and G. Smith.  The Science of Quantitative Information Flow.  Springer International Publishing, 2020.
  * [3] M. S. Alvim, K. Chatzikokolakis, C. Palamidessi, and G. Smith.  Measuring information leakage using generalized gain functions.  In Proceedings of the 2012 IEEE 25th Computer Security Foundations Symposium, CSF ’12, page 265–279, USA, 2012. IEEE Computer Society.
  * [4] D. M. Chickering.  Learning bayesian networks is np-complete.  In D. Fisher and H. Lenz, editors, Learning from Data - Fifth International Workshop on Artificial Intelligence and Statistics, AISTATS 1995, Key West, Florida, USA, January, 1995. Proceedings, pages 121–130. Springer, 1995.
  * [5] D. Colombo, M. H. Maathuis, M. Kalisch, and T. S. Richardson.  Learning high-dimensional directed acyclic graphs with latent and selection variables.  The Annals of Statistics, 40(1):294 – 321, 2012.
  * [6] C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios.  Neural spline flows.  In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019.
  * [7] C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios.  nflows: normalizing flows in PyTorch, 2020.
  * [8] J. A. R. Fonollosa.  Conditional Distribution Variability Measures for Causality Detection, pages 339–347.  Springer International Publishing, Cham, 2019.
  * [9] M. Kalisch and P. Bühlmann.  Estimating high-dimensional directed acyclic graphs with the pc-algorithm.  J. Mach. Learn. Res., 8:613–636, May 2007.
  * [10] Z. C. Lipton, Y. Wang, and A. J. Smola.  Detecting and correcting for label shift with black box predictors.  CoRR, abs/1802.03916, 2018.
  * [11] S. M. Lundberg and S.-I. Lee.  A unified approach to interpreting model predictions.  In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30, pages 4765–4774. Curran Associates, Inc., 2017.
  * [12] J. M. Mooij, J. Peters, D. Janzing, J. Zscheischler, and B. Schölkopf.  Distinguishing cause from effect using observational data: Methods and benchmarks.  J. Mach. Learn. Res., 17(1):1103–1204, jan 2016.
  * [13] J. Pearl.  Causality: Models, Reasoning and Inference.  Cambridge University Press, USA, 2nd edition, 2000.
  * [14] B. Schölkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. Mooij.  On causal and anticausal learning.  In Proceedings of the 29th International Coference on International Conference on Machine Learning, ICML’12, page 459–466, Madison, WI, USA, 2012. Omnipress.
  * [15] G. Schwarz.  Estimating the Dimension of a Model.  The Annals of Statistics, 6(2):461 – 464, 1978.
  * [16] D. W. Scott.  Multivariate Density Estimation.  Wiley, 1992.
  * [17] S. Shimizu, P. O. Hoyer, A. Hyvärinen, and A. Kerminen.  A linear non-gaussian acyclic model for causal discovery.  J. Mach. Learn. Res., 7:2003–2030, Dec. 2006.
  * [18] S. Shimizu, T. Inazumi, Y. Sogawa, A. Hyvärinen, Y. Kawahara, T. Washio, P. O. Hoyer, and K. Bollen.  Directlingam: A direct method for learning a linear non-gaussian structural equation model.  J. Mach. Learn. Res., 12(null):1225–1248, July 2011.
  * [19] P. Spirtes and C. Glymour.  An algorithm for fast recovery of sparse causal graphs.  Social Science Computer Review, 9(1):62–72, 1991.
  * [20] P. Spirtes, C. Glymour, and R. Scheines.  Causation, Prediction, and Search.  MIT press, 2nd edition, 1993.
  * [21] P. Spirtes, C. Meek, and T. Richardson.  Causal inference in the presence of latent variables and selection bias.  In Proceedings of the Eleventh Conference on Uncertainty in Artificial Intelligence, UAI’95, page 499–506, San Francisco, CA, USA, 1995\. Morgan Kaufmann Publishers Inc.